var login="Member ID";

var spass="Password";

var sre="Confirm-Password";

var nam="Name";

var mail="E-Mail";

var add="Address";

var cit="City";

var stat="State";

var coun="Country";

var ref="Reference";

var mod="Mode Of Payment";

var frid="Friend User ID";

var ddn="Demand Draft Number";

var dodd="Demand Draft Date";

var bnam="Bank Name";

var bcit="Bank City";

var bcode="Bank Code";

var delid="Dealer ID";

var delpass="Dealer Password"

var sque="Question";

var sans="Answer";

var im=new Image()

//var reset1=true

/*function checkdt(dt)

{

var p=/[0-3][0-9]\/[0-1][0-2]\/[1900-9999]/;

var x=p.test(dt)

if (ValidatorEvaluateIsValid(fieldValue,expr,msg,alertStatus)

	{



	}

/*var arr=dt.split("/")

if(parseInt(dt(0))==0||x==false)

{

alert("Date is not valid")

return false*/

function checkdt(dt)

{

var p=/[0-3][0-9]\/[0-1][0-2]\/[1900-9999]/;

var x=p.test(dt)

var arr=dt.split("/")

if(parseInt(arr[0])==0||x==false)

{

alert("Date is not valid")

return false;



}

}

function checkradio(val,ctrl)

{

	var l=ctrl.length;

	for(i=0;i<l;i++)

	{

		if(ctrl[i].value==val)

		{

		ctrl[i].checked=true;

		}

	}

}

function selectCombo(val,ctrl)

{

	ctrl.selectedIndex=val;

}

function CheckCountry(val)

{

if (val==-1)

{

alert("Country must be selected")

return false

}

return true

}



function isEmpty(s) {

        return ((s == null) || (s.length == 0));

}

function isWhitespace (s) {

        var i;

      if (isEmpty(s)) return true;

      for (i = 0; i < s.length; i++){

                var c = s.charAt(i);

            if (c == " ") return true;

        }

        return false;

}

function isSame(fir,sec){

        var j,k;

      var lnt;

      if(fir.length > sec.length){

                lnt=fir.length;

                        }

        else{

                lnt=sec.length;

        }

                for (j = 0; j < lnt; j++)

                {

                      if(fir.charAt(j) !=sec.charAt(j))

                          return true;}

                                return false;}

function warnEmpty (theField, s)

        {   theField.focus()

                alert( s+" can not be empty and White spaces are not allowed in   "+ s + " field. ")

                return false}

     <!--### PASSWORD  VALIDATION ###-->

function checkPassuserSame(fir,sec){

if(isSame(fir.value,sec.value))

{

return true;

}

else{

alert("Password should not  be same as User ID");

                        return false;}

}

function checkSamePass(Pas,theFields, si)

        {           var ll=theFields.value.length;

    //           if (isWhitespace(theFields.value))

      //             return warnEmpty (theFields, si);

            if(isSame(Pas.value,theFields.value)) {

            	alert("The Password and Confirm Password do not match. Please try again.");

            	theFields.focus();

            	return false;

            }else return true;

        }

function checkPassLen (theField, s){ 

       var l=theField.value.length;

	  var fieldValue1 = theField.value;

          if (isEmpty(theField.value)) { 

          	alert(s + " can not be empty."); 

         	theField.focus();

         	return false;

          }

           if (isWhitespace(theField.value)){

                  return warnEmpty (theField, s);

}               if(l < 5) { 

                	alert("The length of "+s+" should minimum of 5 characters.");

                      theField.focus();

                      return false;

                    }

                 if(l > 15) {

  	              alert("The length of "+s +" should not more than 15 characters");

  	               theField.focus();

  	              return false;}

                        return true;     }



function checkCorrect3(theField, s){ 

    var l=theField.value.length;

	  var fieldValue1 = theField.value;

          if (isEmpty(theField.value)) { 

          	alert(s + " can not be empty."); 

          	theField.focus();

          	return false;

          }

        return true;     

    }





<!--### E MAil Validaation ###-->





function checkEmail(theField,s)

{



var l=theField.value.length;

var fieldvalue=theField.value;



          if (isEmpty(theField.value)) { 

          	alert(s  + "   can not be empty."); 

          	theField.focus();

          	return false;

          }

    	for(i=0;i<l;i++)

	{

		

		if(fieldvalue.charAt(i)=='@')

		{

//			for(k=i;k<l;k++)

//			{

//				if(fieldvalue.charAt(k)=='yahoo')

//				{

//				

//					break;

//				}

		

			for(j=i;j<l;j++)

			{

				if(fieldvalue.charAt(j)=='.')

				{

				

					break;

				}

				

				if((j+1)==l)

				{

				

				alert(s + "  not valid");

				theField.focus();

				return false;

				break;

				}

				

			}

		

		break;

		}

	

		if((i+1)==l)

		{

			

			alert(s + "  not valid");

			theField.focus();

			return false;

			break;

			

		}		

	

	}

		



return true;						

		

}



	

function checkDealerID(theField,s)

{

if(document.all.payment.value=="By Cash")

	{

	var l=theField.value.length;

        var fieldValue1 = theField.value;

        if (isEmpty(theField.value)) 

		{ 

	       	alert(s + " can not be empty."); 

          	theField.focus();

        	return false;

        	}

	return true;

	   }

	else

	return true;

}

//----------for Numeric validation-----------

function checkNumeric(theField,s,emptycheck)

{	var l=theField.value.length;

	validString = "0123456789.";

	var fieldvalue = theField.value;

	if(emptycheck!=false)

	{

        if(isEmpty(theField.value))

	{

	alert(s+" can not be empty.");

	theField.focus();

	return false;

	}

	}

	 if(theField.value!="")

	{	var j;

		for (j = 0; j < l ; j++)

	        {



			if(validString.indexOf(fieldvalue.charAt(j)) == -1)

			{

				alert ("Please enter 0-9//dot(.) in"+s +" Field");

				theField.focus();

				return false;

			}

         }



	}

return true;



}

function checkNumericWithComma(theField,s,emptycheck)

{	var l=theField.value.length;

	validString = "0123456789.,";

	var fieldvalue = theField.value;

	if(emptycheck!=false)

	{

        if(isEmpty(theField.value))

	{

	alert(s+" can not be empty.");

	theField.focus();

	return false;

	}

	}

	 if(theField.value!="")

	{	var j;

		for (j = 0; j < l ; j++)

	        {



			if(validString.indexOf(fieldvalue.charAt(j)) == -1)

			{

				alert ("Please enter 0-9//dot(.) in"+s +" Field");

				theField.focus();

				return false;

			}

         }



	}

return true;



}



function checkNumericWithOutDot(theField,s,checkempty)

{	var l=theField.value.length;

	validString = "0123456789";

	var fieldvalue = theField.value;

	

        if(isEmpty(theField.value)&&checkempty!=false)

	{

	alert(s+" can not be empty.");

	theField.focus();

	return false;

	}

	else

	{	var j;

		for (j = 0; j < l ; j++)

	        {



			if(validString.indexOf(fieldvalue.charAt(j)) == -1)

			{

				alert ("Please enter 0-9 in"+s +" Field");

				theField.focus();

				return false;

			}

         }



	}

return true;



}

function checkAlphaNumeric(theField,s,checkempty)

{	var l=theField.value.length;

	validString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.- ,";

	var fieldvalue = theField.value;

        if(isEmpty(theField.value)&&checkempty!=false)

	{

	alert(s+" can not be empty.");

	theField.focus();

	return false;

	}

	else

	{	var j;

		for (j = 0; j < l ; j++)

	        {



			if(validString.indexOf(fieldvalue.charAt(j)) == -1)

			{

				alert ("Please enter 0-9/A-Z/a-z/ in "+ s +" Field");

				theField.focus();

				return false;

			}

         }



	}

return true;



}



//--------------for draft date--------

function checkDraftDate(form,s)

{

alert("date")

date=new Date()

			day=date.getDate()

			yy=date.getYear()

		    mm=date.getMonth()

	        if(frmMain.elements["yob"].value==yy)

			{

			 if(frmMain.elements["mob"].selectedIndex<mm)

			  {alert("Month cann't be lesser then current month")

			  return false

  			  }

			 if(frmMain.elements["mob"].selectedIndex==mm)

			 {

		      if(day>frmMain.elements["dob"].value)

			  {

			  alert("Day cann't be lesser then current day")

			  return false

			  }

			 }

			}

		  

}





<!--### USER ID VALIDATION ###-->

function checkUserID(theField,s)

{	var l=theField.value.length;

	validString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";

	var fieldvalue = theField.value;

        if(isEmpty(theField.value))

	{

	alert(s+" can not be empty.");

	theField.focus();

	return false;

	}

	else

	{	var j;

		for (j = 0; j < l ; j++)

	        {



			if(validString.indexOf(fieldvalue.charAt(j)) == -1)

			{

				alert ("Please enter 0-9/A-Z/a-z/underscore(_)/dot(.) in User ID Field");

				theField.focus();

				return false;

			}

         }



	}

return true;



}



function ValidatorEvaluateIsValid(fieldValue,expr,msg,alertStatus) {

	

    var value = fieldValue

   if (ValidatorTrim(value).length == 0)

        return true;        

    var rx = new RegExp(expr)

    var matches = rx.exec(value);

    if((matches != null && value == matches[0])==false)

    {

    if(alertStatus==true)

    {

    alert(msg)

    }

    return false

    }

    return true

}

function ValidatorTrim(s) {

    var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);

   return (m == null) ? "" : m[1];

   // return("d")

}



function checkImage(field,emptyflag,str,format)

{

value=field.value

var divHtml,imgsrc,ss

var divHtml1,imgHt,imgWt,imgSize,name

//imgHt=height //frm.hdnHeight.value

//imgWt=width //frm.hdnWidth.value

//imgsrc=value//frm.imgFile.value

//imgSize=size//frm.hdnSize.value

var str,arrStr,fileName,filen,filearr



	filearr=value.split('.');

	filearr.reverse()

filen=filearr[0];



if(emptyflag==true)

{

	if(value=="")

	{

 alert(str+" can't be empty!")

 field.focus()

 return false

	}

}



if(filen.toUpperCase()!="JPEG"&&filen.toUpperCase()!="JPG"&&filen.toUpperCase()!="GIF"&&filen.toUpperCase()!="")

{

alert(str+" should be jpeg/jpg/gif .");

return false;

}



return true

}



function GetFileExtension(val,type,msg)

{

var arr=val.split(".")

if((arr[arr.length-1]).toUpperCase()!=type.toUpperCase())

{

 alert(msg)

 return false

}

}



function checkAttchmentFile(field,emptyflag,str,format)

{

value=field.value

var divHtml,imgsrc,ss

var divHtml1,imgHt,imgWt,imgSize,name

//imgHt=height //frm.hdnHeight.value

//imgWt=width //frm.hdnWidth.value

//imgsrc=value//frm.imgFile.value

//imgSize=size//frm.hdnSize.value

var str,arrStr,fileName,filen,filearr



	filearr=value.split('.');

	filearr.reverse()

filen=filearr[0];







	if(value=="")

	{

		if(emptyflag==true)

		{

 alert("Attachment can't be empty!")

 field.focus()

 return false

	}

}





else

	{

if(filen.toUpperCase()=="PDF"||filen.toUpperCase()=="PPT"||filen.toUpperCase()=="XLS"||filen.toUpperCase()=="DOC")

{

}

else

	{

alert("Attachment should be ppt/pdf/doc/xls ." + field.name);

return false;

}

	}

return true

}



function checkFile1(x)

{

document.getElementById("div1").style.visibility="hidden"

if (frm.file.value=="")

{

	return 0;

	}

document.getElementById("div1").style.visibility="visible"

document.getElementById("1").src=frm.file.value

}



function checkFile2(x)

{

document.getElementById("div2").style.visibility="hidden"

if (frm.file2.value=="")

{

	return 0;

}

document.getElementById("div2").style.visibility="visible"

document.getElementById("2").src=frm.file2.value

}

function checkFile3(x)

{

document.getElementById("div3").style.visibility="hidden"

if (frm.file3.value=="")

{

	return 0;

	}

document.getElementById("div3").style.visibility="visible"

document.getElementById("3").src=frm.file3.value

}





function checksynphone(dt)

{



var p=/\d{3,5}[" "]\d{6,8}$/;

var q=/\(\d{3,5}\)[" "]\d{6,8}$/;

var x=p.test(dt)

var y=q.test(dt)

//var arr=dt.split("/")



if(x==true ||y==true )

{}

else

{

alert("Phone No. is not valid")

return false;



}

}



function checksynpostcode(dt)

{

var p=/\D{2}\d{1,2}[" "]\d{1}\D{2}/;

var q=/\D{1}\d{2,3}[" "]\d{1}\D{2}/;



var x=p.test(dt)

	var y=q.test(dt)



//var arr=dt.split("/")

if(x==true ||y==true )

{}

else

{

alert("Post code is not valid")

return false;



}

}



function resetall()

{

	

	//alert(document.getElementById("div1").style.visibility)

//document.getElementById("div1").style.visibility="hidden"

//document.getElementById("div2").style.visibility="hidden"

//document.getElementById("div3").style.visibility="hidden"

document.getElementById("1").src="http://localhost/synergy/images/spacer.gif"

document.getElementById("2").src=""

document.getElementById("3").src=""

	//document.getElementById("2").src=""

	//	document.getElementById("3").src=""

		reset1=true

//alert(document.getElementById("div1").childNodes.length)



//document.getElementById("div1").removeChild(document.getElementById("div1").lastChild)



//document.getElementById("1").src="./spacer.gif"

//document.getElementById("1").alt=""

}

function checkFile1(x)

{

	

document.getElementById("div1").style.visibility="hidden"

if (frm.file.value=="")

{

	return 0;

	}

document.getElementById("div1").style.visibility="visible"

document.getElementById("1").src=frm.file.value

}



function checkFile2(x)

{

document.getElementById("div2").style.visibility="hidden"

if (frm.file2.value=="")

{

	return 0;

}

document.getElementById("div2").style.visibility="visible"

document.getElementById("2").src=frm.file2.value

}

function checkFile3(x)

{

document.getElementById("div3").style.visibility="hidden"

if (frm.file3.value=="")

{

	return 0;

	}

document.getElementById("div3").style.visibility="visible"

document.getElementById("3").src=frm.file3.value

}

function DateDiff(date1,date2)

{

	var s,s1

s=date1

s1=date2



var d=Date.parse(s)



var myd=new Date(d)

var d1=Date.parse(s1)



var myd1=new Date(d1)



if((myd1-myd)<0)

	{

	 alert("End date should be greater than start date")

        return false

	}

	 return true

}



	 function checkAllImage()

	 {

      for (var i=1;i<=3;i++)

	{



    j=i

 	if (document.getElementById(j).src!="" && document.getElementById(j).width>200)

	{

	if(j==1&&frm.file.value!="")

	{

	alert("Image"+j+" width can not be more than 200px ")

	frm.file.focus()

	document.getElementById("div1").style.visibility="hidden"

	

	return false

	}

	if(j==2&&frm.file2.value!="")

	{



	alert("Image"+j+" width can not be more than 200px ")

	frm.file2.focus()

	document.getElementById("div2").style.visibility="hidden"

	return false

	}

	if(j==3&&frm.file3.value!="")

	{	

		alert("Image"+j+" width can not be more than 200px ")

	frm.file3.focus()

	document.getElementById("div3").style.visibility="hidden"

	return false

	}



	}

 }



 return true

	 }



 function checkdiscount(field)

 {

var val=field.value;

if (val<=0 || val>100)

	 {

	alert("Discount can be between 1 to 100 percent")

		return false

}

 }



 function checkimages(theField,str,height,width,size,emptyFlag)

{

	if (checkImage(theField,emptyFlag,str,"")==false)

	return false

if (theField.value=="")

{

if (emptyFlag==true)

{

alert(str+" Can not be empty")

return false

}

}

else

{

  

   // alert(im)

 im.src=theField.value

 setTimeout('var x;',2000)

//alert(im.fileSize+ " "+ im.height+ "sdsds"+im.width)

	   

  if (parseInt(im.fileSize)/1024>parseInt(size))

{

//alert(str+" size Can not be greater than "+size +"KB")

//return false/

}



  if (parseInt(im.height)>parseInt(height))

{

alert(str+" height Can not be greater than "+height +"px")

return false

}

  if (parseInt(im.width)>parseInt(width))

{

alert(str+" width Can not be greater than "+width +"px")

return false

}

 

  

}

return true

}

function expressinterest(id,val)

{

 window.open("expressinterest.php?id="+id,'',"width=800,height=620,toolbar=no,resizable=yes,scrollbars=yes")

}

function expressProfileInterest(id,val,gen1,gen2)

{

if(gen1!=gen2)

 window.open("./m/expressinterest.php?id="+id,'',"width=800,height=620,toolbar=no,resizable=yes,scrollbars=yes");

 else

 alert("Gender is not matching");

}

 function accept(id,val)

{

	var userid=id;

	var msg;

	

	if(val==1)

		msg="I m interested with your profile please contact me.";

	if(val==2)

		msg="I m not interested with your profile.";	

	try{

		x= new XMLHttpRequest();

		

	}catch(microsoft){

		try{

			x=new ActiveXObject('Msxml2.XMLHTTP');

		}catch(autremicrosoft){

			try{

				x=new ActiveXObject('Microsoft.XMLHTTP');

			}catch(echec){

				xmlRequest=null;

				alert("Browser Not supported XMLHttpRequest");

			}

		}

	}





			//x=new ActiveXObject("Microsoft.XMLHTTP")

			if(val==1)

			x.open("post","accept.php?call=1&id="+userid+"&msg="+msg,false)

			if(val==2)

			x.open("post","accept.php?call=2&id="+userid+"&msg="+msg,false)



			x.send(null)

			if(x.responseText=="1")

				{

					alert("Your interest have been sent")					

				}

			else

				(

				alert("There are some error")

				)

}

 function ignore(id,gen1,gen2)

{

if(gen1!=gen2)

 window.open("sendmail.php?id="+id,'',"width=510,height=510,toolbar=no")

 else

 alert("Gender is not matching");

}

  function send_mail(id,gen1,gen2)

{
 if(gen1!=gen2)

 window.open("sendmail.php?id="+id,'',"width=790,height=620,toolbar=no,resizable=yes,scrollbars=yes");

 else

 alert("Gender is not matching");

}

 function profile_send_mail(id,gen1,gen2)

{

 //alert(gen1+' '+gen2);

 if(gen1!=gen2)

 window.open("./m/sendmail.php?id="+id,'',"width=790,height=620,toolbar=no,resizable=yes,scrollbars=yes");

  else

 alert("Gender is not matching");

}

 function checksall()

	{

  form=document.forms['frm'];

  if(form.chkall.checked)

   val=form.chkall.checked;	 

  else

	 val=form.chkall1.checked

	for( i=0 ; i < form.length ; i++)

	{

		if( form.elements[i].type == 'checkbox' && form.elements[i].name == "chk" ){

			form.elements[i].checked = val;

			}

	}

}

function count_user(gen1,gen2)

{

	if(gen1==gen2)

	{

		alert("Gender is not matching");

		return false;

	}

	if(noselect()==false)return false;

	//arr=new Array();

	//carr=new Array();

	var str=0;

	obj=document.forms['frm'];

	slength=obj.elements.length;

	var x=0;

	l=document.frm.chk.length;	 

	for(i=0;i<slength;i++)

	{

		if (obj.elements[i].type=="checkbox" && obj.elements[i].name=="chk")

		{

		if(obj.elements[i].checked)

		{

			if(str==0)

			{

				str=obj.elements[i].value;

			}

			else

			{

				str=str+','+obj.elements[i].value;

			}			

		}		

		

		}

	}	

	expressinterest(str)



}

function noselect()

{

	obj=document.forms['frm'];



	slength=obj.elements.length;

	

	checked=0;

	totalchecked=0;

	

	for(i=0;i<slength;i++)

	{

		if (obj.elements[i].type=="checkbox")

			{

			if(obj.elements[i].checked)

				{

				checked=1;

				totalchecked=totalchecked+1;

				}

			}

	}

	if(checked==1)return true;

	else

	{

		alert("First Select checkbox");

			return false;

	}



}

function fillheight(st,ed)

{

	l=st.length;

	l1=ed.length;

	sel=st.options[st.selectedIndex].index;

	var x = new Array();

	var y = new Array();

	for(i=0;i<l1;i++)

	{

		ed[i]=null;

	}

	j=0;

	scount=0;

	for(i=sel;i<l;i++)

	{		

		x[j]=st[i].value;

		y[j]=st[i].text;

		j++;

	}

	for(i=0; i<j; i++)

	{

		var newOpt=new Option(y[i],x[i]);

		var selLength = ed.length;

		ed.options[selLength] = newOpt;



	}



}

function checkphoto(formname)

{

	alert("this is testing messsage")

	if(formname.chkphoto.checked)

	{

		formname.hdnphoto.value=1;

	}

	else

		formname.hdnphoto.value=0;

}


