<!--function jsOpenWindow(filename, width, height){	window.open(filename, "Window_" + Math.floor(Math.random()*110),"left=200,top=100,toolbar=no,width=" + width + ",height=" + height + ",directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=no");}
function jsOpenWindow2(filename, width, height){	window.open(filename,"Window2","toolbar=no,width=" + width + ",height=" + height + ",directories=no,status=yes,location=no,scrollbars=yes,resizable=yes,menubar=no");}
function Link(s){  window.self.location.href = s.options[s.selectedIndex].value;}
function Disable(){  if (event.button == 2)   {		alert('What ... ?');  }}
function CloseWindow(){	window.close();	window.opener.location=window.opener.location.pathname;}
function CloseWindow1(arg){	window.close();	window.opener.location=window.opener.location.pathname+'?ctp='+arg;}
// Function for Expanding and Contracting the Messenger Groupsfunction displaySubs(the_sub){  if (document.getElementById(the_sub).style.display=="")  {    document.getElementById(the_sub).style.display = "none";	document.getElementById("img" + the_sub).src = "../images/expand.gif";	return  }	else		document.getElementById("img" + the_sub).src = "../images/contract.gif";	   document.getElementById(the_sub).style.display = "";}


function MM_swapImgRestore()
{ //v3.0
  var i,x,a=document.MM_sr;

  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
    x.src=x.oSrc;
}

function MM_preloadImages()
{ //v3.0
  var d=document;
  if(d.images)
  {
    if(!d.MM_p)
      d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
    for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!=0)
      {
        d.MM_p[j]=new Image;
        d.MM_p[j++].src=a[i];
      }
  }
}

function MM_findObj(n, d)
{ //v4.0
  var p,i,x;
  if(!d)
    d=document;

  if((p=n.indexOf("?"))>0&&parent.frames.length)
  {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);
  }

  if(!(x=d[n])&&d.all)
    x=d.all[n];

  for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    x=MM_findObj(n,d.layers[i].document);

  if(!x && document.getElementById)
    x=document.getElementById(n);

  return x;
}

function MM_swapImage()
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments;
  document.MM_sr=new Array;
  
  for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null)
    {
      document.MM_sr[j++]=x;
      if(!x.oSrc)
        x.oSrc=x.src;
      x.src=a[i+2];
    }
}


function fnAddToCart(varLocation)
{
  this.ShoppingCart.location = varLocation;
}

// Credit Card Functions

function mod10( cardNumber )
{ // LUHN Formula for validation of credit card numbers.
	var ar = new Array( cardNumber.length );
	var i = 0,sum = 0;

	for( i = 0; i < cardNumber.length; ++i ) {
		ar[i] = parseInt(cardNumber.charAt(i));
	}
	
	for( i = ar.length -2; i >= 0; i-=2 ) { // you have to start from the right, and work back.
		ar[i] *= 2;							 // every second digit starting with the right most (check digit)
		if( ar[i] > 9 ) ar[i]-=9;			 // will be doubled, and summed with the skipped digits.
	}										 // if the double digit is > 9, add those individual digits together 

	for( i = 0; i < ar.length; ++i ) {
		sum += ar[i];						 // if the sum is divisible by 10 mod10 succeeds
	}
	return (((sum%10)==0)?true:false);	 	
}

function expired( month, year ) {
	var now = new Date();							// this function is designed to be Y2K compliant.
	var expiresIn = new Date(year,month,0,0,0);		// create an expired on date object with valid thru expiration date
	expiresIn.setMonth(expiresIn.getMonth()+1);		// adjust the month, to first day, hour, minute & second of expired month
	if( now.getTime() < expiresIn.getTime() ) return false;
	return true;									// then we get the miliseconds, and do a long integer comparison
}

function fnVisible(varElement,value)
{
	if(value=='')
		value=0;
		
	if(value==-1) //Toggle
	{
		if(varElement.style.display=='none')
			varElement.style.display='';
		else
			varElement.style.display='none';
	}
	else if(value==1) //Visible
		varElement.style.display='';
	else if(value==0) //not Visible
		varElement.style.display='none';
}

function getCountryCode(val)
{
	if(val.length==0)
	return '';
	else
	var valArr=val.split("-");
	
	if(valArr.length>0)
	return valArr[1];
	else
	return '';
}

function getCountryId(val)
{
	if(val.length==0)
	return '';
	else
	var valArr=val.split("-");
	
	if(valArr.length>0)
	return valArr[0];
	else
	return '';
}

function getProviderCode(val)
{
	if(val.length==0)
	return '';
	else
	var valArr=val.split("-");
	
	if(valArr.length>0)
	return valArr[1];
	else
	return '';
}

function getProviderId(val)
{
	if(val.length==0)
	return '';
	else
	var valArr=val.split("-");
	
	if(valArr.length>0)
	return valArr[0];
	else
	return '';
}

function insertNewOption(targetcombo,newtext,newval)
{
	myOption=new Option();
	myOption.text=newtext;
	myOption.value=newval;
	if (targetcombo.selectedIndex>0)
		insertIndex=targetcombo.selectedIndex;
	else
		insertIndex=targetcombo.options.length;
	
	targetcombo.options[insertIndex]=myOption;	
}

function insertNewOptions(targetcombo,sourcecombo)
{
	var cmb1value;
	cmb1value=getCountryId(sourcecombo.value);
	
	deleteOptions(targetcombo);
		
	if(arrCat[cmb1value]!=null)
	{
		insertNewOption(targetcombo,'-- Select One --','');
		for(var i=0;i<arrCat[cmb1value].length;i++)
		{
			insertNewOption(targetcombo,arrCat[cmb1value][i][1],arrCat[cmb1value][i][0]+'-'+arrCat[cmb1value][i][1]+'-'+arrCat[cmb1value][i][2]);
		}
	}
	else
	{
		insertNewOption(targetcombo,'-- Select One --','');
	}
	
}

function deleteOption(targetcombo)
{
	if (targetcombo.selectedIndex>0)
		deleteIndex=targetcombo.selectedIndex;
	else
		deleteIndex=targetcombo.options.length-1;

	targetcombo.options[deleteIndex]=null;
}

function deleteOptions(targetcombo)
{ 
	while (targetcombo.options.length>0)
	{
 		deleteIndex=targetcombo.options.length-1;
 		targetcombo.options[deleteIndex]=null;
	}
}

function isAlphabetic(val)
{
	if (val.match(/^[a-zA-Z]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function isAlphaNumeric(val)
{
	if (val.match(/^[a-zA-Z0-9]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function isNumeric(val)
{
	if (val.match(/^[0-9]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
	
}

function isEmailAddress(val)
{
	// /^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/
	if (val.match(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9- ]+)*(\.[a-z]{2,3})+/))
	{
		return true;
	}
	else
	{
		return false;
	}	
}


function MultiDimensionalArray(iRows, iCols)
{
		var i;
		var j;
		var a = new Array(iRows);
		
		for (i=0; i < iRows; i++)
		{
				a[i] = new Array(iCols);
				for (j=0; j < iCols; j++)
					a[i][j] = "";
		}
		return(a);
}

function OptionsList_RemoveSelected(oListName)
{
	if (document.getElementById(oListName).options.selectedIndex >= 0)
		document.getElementById(oListName).options[document.getElementById(oListName).options.selectedIndex] = null;
}

function OptionsList_RemoveAll(oListName)
{
	document.getElementById(oListName).options.length = 0;
}

function toggleChecks( cbElem )
{
	var f = cbElem.form;
	for ( var elem, i = 0; ( elem = f.elements[i]); i++ )
		if ( elem.type == 'checkbox' && elem != cbElem )
			if (elem.checked == true)
				elem.checked = false;
			else
				elem.checked = true;
}

function validEmail(email)
{
	email = trim(email)
	invalidChars = " /:,;"
	if (email == "") 
		return false

	for (i=0; i<invalidChars.length; i++)
	{
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1)
			return false
	}

	atPos = email.indexOf("@",1)
	if (atPos == -1)
		return false

	if (email.indexOf("@",atPos+1) > -1)
		return false

	periodPos = email.indexOf(".",atPos)
	
	if (periodPos == -1)
		return false

	if (periodPos+3 > email.length)
		return false

	return true
}

function notemptystring (stringa)
{
	if (stringa == "")
		return false

	return true
}

function trim(stringa)
{
	while (stringa.charAt(0) == " ")
		stringa = stringa.substring (1,stringa.length)

	while (stringa.charAt(stringa.length-1) == " ")
		stringa = stringa.substring (0,(stringa.length-1))

	return stringa
}

function DoCnt(fieldid, counter)
{ 
   document.getElementById(counter).value = document.getElementById(fieldid).value.length;
}


//-->

