function popup(choice,wt,ht)
{
	var winOpts="toolbar=no,location=no,directories=no,status=no,scrolling=auto,scrollbars=yes,menubar=no,width="+wt+",height="+ht;
	confirmWin=window.open(choice,'theconfirmWin',winOpts);
	window.open(choice,'theconfirmWin',winOpts);
}
function validate()
{
	if ( isPass() && isHintQuesAns()  && isValidemail() &&isDate())
	{
		document.frm1.submit();
	}
}

function validatecard()
{
	errmsg="";
	flag=true;

	if (document.location.search.indexOf("?") == 0){
			document.frm1.frompg.value = window.location.search.substring(1);
	}


	if (trimString(document.frm1.yname.value)=="")
	{
        errmsg = errmsg + "Enter Your First Name\n";
    }
	if (trimString(document.frm1.ylname.value)=="")
	{
        errmsg = errmsg + "Enter Your Last Name\n";
    }

	if ((trimString(document.frm1.yaddr1.value)=="")&&(trimString(document.frm1.yaddr2.value)==""))
	{

        errmsg = errmsg + "Enter Your Address\n";
    }
	if (trimString(document.frm1.ycity.value)=="")
	{

        errmsg = errmsg + "Enter Your City\n";
    }
     if (document.frm1.ycountry.value=="")
	{
       errmsg = errmsg + "Enter Your Country\n";
    }
	//if (trimString(document.frm1.yphone.value)=="")
	//{
       //errmsg = errmsg + "Enter Your Phone number\n";
    //}
	
	if (trimString(document.frm1.ystate.value)=="")
	{
       errmsg = errmsg + "Enter Your State\n";
    }
    if (trimString(document.frm1.yzip.value)=="")
	{
       errmsg = errmsg + "Enter Your Zip/Postal code\n";
    }

     if (trimString(document.frm1.ycard.value)=="")
	{
       errmsg = errmsg + "Enter Your Card Number\n";
    }
     if (document.frm1.expmonth.value=="")
	{
        //flag=false;
       errmsg = errmsg + "Enter Expiration Month\n";
    }
     if (document.frm1.expyr.value=="")
	{
        //flag=false;
       errmsg = errmsg + "Enter Expiration Year\n";
    }

     if (!document.frm1.chk1.checked)
	{
        //flag=false;
       errmsg = errmsg + "Please agree with the terms & conditions\n";
    }

     //if (!document.frm1.chk2.checked)
//	{
        //flag=false;
       //errmsg = errmsg + "Please accept the privacy policy\n";
 //   }

	if (errmsg) {
	alert ("Please :\n\n" + errmsg);
	}
	else
	document.frm1.submit();


}
function validatecancel()
{
	errmsg="";
	flag=true;

	if (document.frm1.usname.value=="")
	{
        errmsg = errmsg + "Enter Username\n";
    	}
    	if (document.frm1.transid.value=="")
		{
	        errmsg = errmsg + "Enter Transaction ID\n";
    	}
    	
		if (errmsg) {
		alert ("Please :\n\n" + errmsg);
		}
		else
	document.frm1.submit();
   }
   
function trimString (str) {
  while (str.charAt(0) == ' ')
	str = str.substring(1);
  while (str.charAt(str.length - 1) == ' ')
	str = str.substring(0, str.length - 1);
  return str;
}
