// JavaScript Document

<!-- Begin
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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}

//Validation Forms
function validate_form()
{
	if(document.mail.name.value == "") {
		alert("Please enter your Surname and Name");
		return false;
	}
	if(document.mail.address.value == "") {
		alert("Please enter your Address");
		return false;		
	}
	if(document.mail.city.value == "") {
		alert("Please enter your City");
		return false;		
	}
	if(document.mail.state.value == "") {
		alert("Please enter your State");
		return false;		
	}
	if(document.mail.zip.value == "") {
		alert("Please enter your Zip Code");
		return false;		
	}
	if(isNaN(document.mail.zip.value)) {
		alert("Zip Code must be number");
		return false;		
	}	
	if(document.mail.phone.value == "") {
		alert("Please enter your Telephone");
		return false;		
	}	
	if(isNaN(document.mail.phone.value)) {
		alert("Telephone must be number");
		return false;		
	}	
	if(document.mail.mobile.value != "") {
		if(isNaN(document.mail.mobile.value)) {
			alert("Mobile Number must be number");
			return false;		
		}	
	}	
	if(document.mail.email.value == "") {
		alert("Please enter your Email");
		return false;		
	} 
  if ((document.mail.email.value.indexOf ('@',0) == -1 || document.mail.email.value.indexOf ('.',0) == -1) && document.mail.email.value != "")
  {
    alert("Please verify that your email address is valid.");
	return false;
  }	
	if((document.mail.hour.value == "") || (document.mail.minute.value == "")) {
		alert("Please select the best time for us to contact you");
		return false;		
	}
	
	return true;
}


// End -->

//Validate Support Form
function validate_support_form()
{
	if(document.support.name.value == "") {
		alert("Please enter your Name");
		return false;
	}
	if(document.support.email.value == "") {
		alert("Please enter your Email");
		return false;		
	} 
	if ((document.support.email.value.indexOf ('@',0) == -1 || document.support.email.value.indexOf ('.',0) == -1) && document.support.email.value != "")
  	{
    	alert("Please verify that your email address is valid.");
		return false;
  	}	
	if(document.support.member.value == "") {
		alert("Please enter your Membership Number");
		return false;		
	}
	if(document.support.problem.value == "") {
		alert("Please enter your Problem Description");
		return false;		
	}
	return true;
}

//End


/**
* Identify the product picked by cusomter 
* and call on ccavenue to process payment 
*/
function signUpProd(myform)
{
    var btn = valButton(myform.group1);
    
    if (btn == null)
    {
     alert('Please Select a Membership Plan');
     return null;
    } 
    alert("This may take a few seconds.Please wait for the page to load.");
    if(btn=="P1")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,P1,http://www.flickxpress.com/signup.asp";
    } 
    else if (btn=="P2")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,P2,http://www.flickxpress.com/signup.asp";
    }
    else if (btn=="P3")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,P3,http://www.flickxpress.com/signup.asp";
    }
    else if (btn=="P4")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,P4,http://www.flickxpress.com/signup.asp";
    }
}

/**
* Identify the product picked by cusomter 
* and call on ccavenue to process payment 
*/
function rechargeProd(myform)
{
    var btn = valButton(myform.group1);
    
    if (btn == null)
    {
     alert('Please Select a Membership Plan');
     return null;
    } 
    alert("This may take a few seconds.Please wait for the page to load.");
    if(btn=="P1")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,R1,http://www.flickxpress.com/signup.asp";
    } 
    else if (btn=="P2")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,R2,http://www.flickxpress.com/signup.asp";
    }
    else if (btn=="P3")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,R3,http://www.flickxpress.com/signup.asp";
    }
    else if (btn=="P4")
    {
     window.document.location.href ="https://www.ccavenue.com/shopzone/custcart/sendtocart.jsp?M_fxpdvd_8315,R4,http://www.flickxpress.com/signup.asp";
    }

}

/**
 * This function indentifies the 
 * check box that is chosen and 
 * extracts its value and will pass
 * it back to the calling function. 
*/
function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

var theObj="";
function toolTip(text,me)
{
  theObj=me;
  document.getElementById('toolTipBox').innerHTML=text;
  document.getElementById('toolTipBox').style.display="block";
  theObj.onmouseout=hideMe;
}

function hideMe() {
  document.getElementById('toolTipBox').style.display="none";
}

