﻿function MM_swapImgRestore(){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(){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){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(){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 swapImage(strObject,strImage)
{var obj=document.getElementById(strObject);obj.src=strImage;}
function toggleMe(a){var e=document.getElementById(a);if(!e)return true;if(e.style.display=="none"){e.style.display="block"}else{e.style.display="none"}
return true;}
function CheckUser(emVal)
{debugger; var password=document.getElementById("password");var email=document.getElementById("email");var retype_password=document.getElementById("retype_password");if(password.value=="")
{alert("Password is Mandatory field");return;}
if(password.value!=retype_password.value)
{alert("Password Confirmation Check didn't passed");return;}
if(password.value.length<4)
{alert("The password you have entered is too short. Please choose another password.");return;}
if(password.value.length>10)
{alert("The password you have entered is too long. Please choose another password.");return;}
var URL="NewPaymentHandler.aspx?Username=";URL+=email.value;URL+="&Password=";URL+=password.value;URL+="&Step1=1";postFile(URL,HandleRegistration);}
function HandleRegistration(theXMLHttp)
{if(theXMLHttp.readyState==4)
{if(theXMLHttp.status==200)
{result1=theXMLHttp.responseText;result=result1.split("~~|~~")[0];if(result=="UserCredentialsOK")
{var usid = result1.split("~~|~~")[1];var redirect = "http://www.watchindia.tv/newcart.aspx?ID="+usid; document.location = redirect;}
if(result=="GeneralFail")
{alert("An error occured during mail sending. Please Try Again Later");}}}}
function postFile(pURL,pHandlerFunc)
{pParameters="";if(pURL.split("?").length>1)
pParameters=pURL.split("?")[1];if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();xmlhttp.open("POST",pURL,false);xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlhttp.send(pParameters);return pHandlerFunc(xmlhttp);}
else if(window.ActiveXObject)
{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');if(xmlhttp)
{xmlhttp.open('POST',pURL,false);xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlhttp.send(pParameters);return pHandlerFunc(xmlhttp)}}}
function CheckLogin(emVal)
{var uName=document.getElementById("txtEmail");var uPass=document.getElementById("txtPass");return postFile("Login.aspx?uname="+uName.value+"&upass="+uPass.value,HandleLogin);}
function HandleLogin(theXMLHttp)
{if(theXMLHttp.readyState==4)
{if(theXMLHttp.status==200)
{result1=theXMLHttp.responseText;result=result1.split("~~|~~")[0];if(result=="LOGINOK")
{var redVal = "http://www.watchindia.tv/login.aspx?sID="; redVal += result1.split("~~|~~")[1]; window.location.href=redVal;}
if(result=="LOGINFAIL")
{alert(result1.split("~~|~~")[1]);}}}}
function EmptyBoxes(obj)
{var box2Empty=document.getElementById(obj);box2Empty.value="";var cVal="";if(box2Empty.id=="txtEmail")
{cVal=getCookie("WatchIndiaUserName");if(cVal!="")
{box2Empty.value=cVal;}}}
function CheckKeyLogin(e)
{if(window.even)t
{if(e.keyCode==13)
{CheckLogin(1);}}
if(e.which==13)
{CheckLogin(1);}}
function CheckKeyRegistration(e)
{if(window.event)
{if(e.keyCode==13)
{CheckUser(1);}}
else if(e.which==13)
{CheckUser(1);}}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
function ForgotPassword(emVal)
{var from=document.getElementById("txtEmail");if(from.value==""||from.value=="Email")
{alert("Please fill you email address");return;}
var Url="Sender.aspx?UserName=";Url+=from.value;Url+="&ForgotPass=1";postFile(Url,HandleSending);}
function HandleSending(theXMLHttp)
{if(theXMLHttp.readyState==4)
{if(theXMLHttp.status==200)
{alert("Password was sent to the provided Email");}}}
function CheckPersonalInfo()
{var Err="";var fname=document.getElementById("fname");var lname=document.getElementById("lname");var address=document.getElementById("address");var city=document.getElementById("city");var Country=document.getElementById("Country");var zip=document.getElementById("zip");var phone=document.getElementById("phone");var address2=document.getElementById("address2");if(!CompareValues(fname.value,fname.value))
{Err+="Error. Verification Failed on First Name Field\r \n";fname.style.borderColor="Red";fname.style.borderColor="Red";}
if(!CompareValues(lname.value,lname.value))
{Err+="Error. Verification Failed on Last Name Field\r \n";lname.style.borderColor="Red";lname.style.borderColor="Red";}
if(!CompareValues(address.value,address.value))
{Err+="Error. Verification Failed on Address Field\r \n";address.style.borderColor="Red";address.style.borderColor="Red";}
if(!CompareValues(city.value,city.value))
{Err+="Error. Verification Failed on City Field\r \n";city.style.borderColor="Red";city.style.borderColor="Red";}
if(!CompareValues(Country.value,Country.value))
{Err+="Error. Verification Failed on Country Field\r \n";Country.style.borderColor="Red";Country.style.borderColor="Red";}
if(!CompareValues(zip.value,zip.value))
{Err+="Error. Verification Failed on ZIP Field\r \n";zip.style.borderColor="Red";zip.style.borderColor="Red";}
if(!CompareValues(phone.value,phone.value))
{Err+="Error. Verification Failed on Phone Field\r \n";phone.style.borderColor="Red";phone.style.borderColor="Red";}
if(Err!="")
{alert(Err);return;}
var URL="NewPaymentHandler.aspx?Step2=1";URL+="&FirstName=";URL+=fname.value;URL+="&LastName=";URL+=lname.value;URL+="&Address=";URL+=address.value;URL+="&Address2=";URL+=address2.value;URL+="&City=";URL+=city.value;URL+="&Country=";URL+=Country.value;URL+="&Zip=";URL+=zip.value;URL+="&Phone=";URL+=phone.value;postFile(URL,HandleRegistrationStep2);}
function CompareValues(obj1,obj2)
{if(obj1.value!="")
{if(obj1.value!=obj2.value)
{return false;}
return true;}
return false;}
function HandleRegistrationStep2(theXMLHttp)
{if(theXMLHttp.readyState==4)
{if(theXMLHttp.status==200)
{result1=theXMLHttp.responseText;result=result1.split("~~|~~")[0];if(result=="UserPrivacyOK")
{document.location.href="BuildCart.aspx";}
if(result=="GeneralFail")
{alert("An internal error occured. Please Try Again Later");}}}}
function CheckKeyRegistration(e)
{if(window.event)
{if(e.keyCode==13)
{CheckPersonalInfo();}}
else if(e.which==13)
{CheckPersonalInfo();}}
function CheckKeyRegistrationHP(e)
{if(window.event)
{if(e.keyCode==13)
{CheckUser(1);}}
else if(e.which==13)
{var check = CheckUser(1);}}
var current="faq1";function toggleMe1(a){var e=document.getElementById(a);var qlink="q"+a;var l;if(!e)return true;if(e.style.display=="none")
{document.getElementById(current).style.display="none";e.style.display="block"
l=document.getElementById(qlink);document.getElementById("q"+current).style.fontWeight='400';l.style.fontWeight='bold';current=a;}
return true;}