function toggle(id) {
         var state = document.getElementById(id).style.display;
             if (state == 'block') {
                 document.getElementById(id).style.display = 'none';
		 showdiv('hiddeninfo');

             } else {
                 document.getElementById(id).style.display = 'block';
		 hidediv('hiddeninfo');
    }
            }
function toggleleftside(id,lid) {
document.getElementById(id).style.display = 'block';
document.getElementById(lid).style.display = 'none';
}

function toggleloginregfpass(id,divstatus) {
    if(divstatus=='close'){
        document.getElementById('hiddenlogindiv').style.display = 'none';
        document.getElementById('hiddenregdiv').style.display = 'none';
        document.getElementById('hiddenfpassdiv').style.display = 'none';
    }
    if(id=='hiddenlogindiv' && divstatus=='open'){
	loginstatus=document.getElementById('hiddenlogindiv').style.display;
	if(loginstatus=='block'){
		document.getElementById('hiddenlogindiv').style.display = 'none';
	}
	else{
	        document.getElementById('hiddenlogindiv').style.display = 'block';
        	if(document.getElementById('email')!=undefined){
	            document.getElementById('email').focus();   
        	}
	}
        document.getElementById('hiddenregdiv').style.display = 'none';
        document.getElementById('hiddenfpassdiv').style.display = 'none';
        if(document.getElementById('loginerrormsgdisplay')!=undefined){
            document.getElementById('loginerrormsgdisplay').style.display = 'none';
        }
        if(document.getElementById('loginerrormsg')!=undefined){
            document.getElementById('loginerrormsg').style.display = 'none';   
        }
    }
    else if(id=='hiddenregdiv' && divstatus=='open'){
	regstatus=document.getElementById('hiddenregdiv').style.display;
	if(regstatus=='block'){
		document.getElementById('hiddenregdiv').style.display = 'none';
	}
	else{
	        document.getElementById('hiddenregdiv').style.display = 'block';
        	if(document.getElementById('regemail')!=undefined){
	            document.getElementById('regemail').focus();   
        	}
	}
        document.getElementById('hiddenlogindiv').style.display = 'none';
        document.getElementById('hiddenfpassdiv').style.display = 'none';
        if(document.getElementById('regerrormsgdisplay')!=undefined){
            document.getElementById('regerrormsgdisplay').style.display = 'none';
        }
        if(document.getElementById('regerrormsg')!=undefined){
            document.getElementById('regerrormsg').style.display = 'none';
        }
    }
    else if(id=='hiddenfpassdiv' && divstatus=='open'){
        document.getElementById('hiddenfpassdiv').style.display = 'block';
        if(document.getElementById('fpassemail')!=undefined){
            document.getElementById('fpassemail').focus();   
        }
        document.getElementById('hiddenlogindiv').style.display = 'none';
        document.getElementById('hiddenregdiv').style.display = 'none';
        if(document.getElementById('fpasserrormsgdisplay')!=undefined){
            document.getElementById('fpasserrormsgdisplay').style.display = 'none';
        }
        if(document.getElementById('fpasserrormsg')!=undefined){
            document.getElementById('fpasserrormsg').style.display = 'none';
        }
    }
}
function toggleinvitefriend(id,divstatus) {
    if(divstatus=='open'){
	invitestatus=document.getElementById('hiddeninvitefrienddiv').style.display;
	if(invitestatus=='block'){
		document.getElementById('hiddeninvitefrienddiv').style.display = 'none';
	}
	else{
        	document.getElementById('hiddeninvitefrienddiv').style.display = 'block';
	        if(document.getElementById('senderemail')!=undefined){
        	    document.getElementById('senderemail').focus();   
	        }
	}
    }
    if(divstatus=='close'){
        document.getElementById('hiddeninvitefrienddiv').style.display = 'none';
    }
}
function gotopage(sefurl,sestype,sessubtype,currentpageurl,action){
    if(document.getElementById("state").value==''){
        document.getElementById('hidden').style.display='none';
    }
    if(document.getElementById("state").value!='' && (document.getElementById("dist").value=='All Districts' || document.getElementById("dist").value=='') && (document.getElementById("city").value=='All Locations' || document.getElementById("city").value=='')){
        var state=document.getElementById("state").value;
        state=state.replace(/ /g, "-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/general-info.htm";
            }
            else{
                window.location.href="/?action=general-info&country=India&state="+state+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
           
        else{
            if(sefurl){
                window.location.href="/India/" + state+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
           
    }
    if(document.getElementById("state").value!='' && (document.getElementById("dist").value!='All Districts' && document.getElementById("dist").value!='')&& (document.getElementById("city").value=='All Locations' || document.getElementById("city").value=='')){
        var state=document.getElementById("state").value;
        var dist=document.getElementById("dist").value;
        state=state.replace(/ /g, "-");
        dist=dist.replace(/ /g,"-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + dist + "/" + sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=item&country=India&state="+state+"&dist="+dist+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/general-info.htm";
            }
            else{
                window.location.href="/?action=general-info&country=India&state="+state+"&dist="+dist;
            }
        }
           
        else{
           
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist;
            }
        }
    }
    if(document.getElementById("state").value!='' && document.getElementById("dist").value=='All Districts' && document.getElementById("city").value!='All Locations' && document.getElementById("city").value!=''){
        var state=document.getElementById("state").value;
        var dist=document.getElementById("dist").value;
        var city=document.getElementById("city").value;
        state=state.replace(/ /g, "-");
        dist=dist.replace(/ /g,"-");
        city=city.replace(/ /g,"-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + dist + "/" +city+"/"+ sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=item&country=India&state="+state+"&dist="+dist+"&city="+city+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
        else{
   
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
    }
    if(document.getElementById("state").value!='' && document.getElementById("dist").value!='' && document.getElementById("dist").value!='All Districts' && document.getElementById("city").value!='' && document.getElementById("city").value!='All Locations'){
        var state=document.getElementById("state").value;
        var dist=document.getElementById("dist").value;
        var city=document.getElementById("city").value;
        state=state.replace(/ /g, "-");
        city=city.replace(/ /g,"-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + dist + "/" +city+"/"+ sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=item&country=India&state="+state+"&dist="+dist+"&city="+city+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
        else{
   
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
    }
}

function showsubtype(id){
if(document.getElementById('subtype')!=undefined){
document.getElementById('subtype').style.display='block';
}
if(document.getElementById('hiddendivatt')!=undefined){
    document.getElementById('hiddendivatt').setAttribute("class", "hiddendiv1");
}   
for(var i=0;i<=15;i++){
    var divname='div'+i;
    if(document.getElementById(divname)!=undefined){
        document.getElementById(divname).style.display='none';
    }
}
var selecteddiv='div'+id;
if(document.getElementById(selecteddiv)!=undefined){
document.getElementById(selecteddiv).style.display='block';
}
for(var i=0;i<=15;i++){
    var liclass='li'+i;
    if(document.getElementById(liclass)!=undefined){
//        document.getElementById(liclass).setAttribute("class", "abcd");;
        document.getElementById(liclass).className='';
    }
}


var selectedli='li'+id;
//document.getElementById(selectedli).setAttribute("class", "selectedtype");
if(document.getElementById(selectedli)!=undefined){
    document.getElementById(selectedli).className='selectedtype';
}
}

function closesubtype(){
if(document.getElementById('subtype')!=undefined){
document.getElementById('subtype').style.display='none';
}
for(var i=0;i<=15;i++){
    var liclass='li'+i;
    if(document.getElementById(liclass)!=undefined){
//        document.getElementById(liclass).setAttribute("class", "abcd");;
        document.getElementById(liclass).className='';
    }
}
}
function bookmark(title,url){
   pagetitle=showTitle();
   if (document.all)
     window.external.AddFavorite(url, pagetitle);
   else if (window.sidebar)
     window.sidebar.addPanel(pagetitle, url, "")
   else if (window.sidebar&&window.sidebar.addPanel)
     window.sidebar.addPanel(pagetitle,url,"");
}
function showTitle()
{
var t = document.getElementsByTagName('title')[0];
if ( !!t.childNodes.length ) {
return t.firstChild.data ;
} else if ( t.innerHTML ) {
return t.innerHTML ;
}
}
function echeckinvite(str,ermsgid) {
      var at="@"
      var dot="."
      var lat=str.indexOf(at)
      var lstr=str.length
      var ldot=str.indexOf(dot)
      if (str.indexOf(at)==-1){
	      document.getElementById(ermsgid).style.display="block";
        document.getElementById(ermsgid).innerHTML='Invalid Email Id';
         return false;
      }

      if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	      document.getElementById(ermsgid).style.display="block";
         document.getElementById(ermsgid).innerHTML='Invalid Email Id';
         return false;
      }


      if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	      document.getElementById(ermsgid).style.display="block";
           document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
      }

       if (str.indexOf(at,(lat+1))!=-1){
	       document.getElementById(ermsgid).style.display="block";
           document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
       }

       if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	       document.getElementById(ermsgid).style.display="block";
           document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
       }

       if (str.indexOf(dot,(lat+2))==-1){
	       document.getElementById(ermsg).style.display="block";
	 document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
       }
       if (str.indexOf(" ")!=-1){
	       document.getElementById(ermsgid).style.display="block";
          document.getElementById(ermsgid).innerHTML='Invalid Email Id';
          return false;
   }

       return true;
   }
function validateLogin(){
   var emailID=document.getElementById('lemail');
   var password=document.getElementById('lpassword');
   if ((emailID.value==null)||(emailID.value=="")){
      document.getElementById('errormsgdisplay').style.display="block";
	document.getElementById('errormsgdisplay').innerHTML='Enter Email Id';
	setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);

      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'errormsgdisplay')==false){
      emailID.focus();
     return false;
   }
   if ((password.value==null)||(password.value=="")){
      document.getElementById('errormsgdisplay').style.display="block";
      document.getElementById('errormsgdisplay').innerHTML='Enter Password';
      password.focus();
      setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);
      return false;
      return false;
   }
  return true;
 }
function validateRegister(){
   var emailID=document.getElementById('rregemail');
   if ((emailID.value==null)||(emailID.value=="")){
	 document.getElementById('errormsgdisplay').style.display="block";
	document.getElementById('errormsgdisplay').innerHTML='Enter Email Id';
	setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);

      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'errormsgdisplay')==false){
      emailID.focus();
     return false;
   }
   return true;
 }
function validateForgotPass(){
	var emailID=document.getElementById('lfpassemail');
   if ((emailID.value==null)||(emailID.value=="")){
	emailID.focus();
      document.getElementById('errormsgdisplay').style.display="block";
	document.getElementById('errormsgdisplay').innerHTML='Enter Email Id';
	setTimeout('document.getElementById(\'errormsgdisplay\').style.display="none"', 5000);
      return false;
   }
   if (echeckinvite(emailID.value,'errormsgdisplay')==false){
      emailID.focus();
     return false;
   }
   return true;
 }

 function validateInviteFriend(){
   var senderemail=document.getElementById('invitesenderemail'); 
   var receiveremail=document.getElementById('invitereceiveremail');
   var message=document.getElementById('message'); 	
  
   if ((senderemail.value==null)||(senderemail.value=="")){
	document.getElementById('invitefrienderrormsg').style.display="block";
      document.getElementById('invitefrienderrormsg').innerHTML='Enter Your Email Id';
      senderemail.focus();
      return false;
   }
   if (echeckinvite(senderemail.value,'invitefrienderrormsg')==false){
      senderemail.focus();
     return false;
   }
   if ((receiveremail.value==null)||(receiveremail.value=="")){
	document.getElementById('invitefrienderrormsg').style.display="block";
      document.getElementById('invitefrienderrormsg').innerHTML='Enter Your Friend\'s Email Id';
      receiveremail.focus();
      return false;
   }
   if (echeckinvite(receiveremail.value,'invitefrienderrormsg')==false){
      receiveremail.focus();
     return false;
   }	
   return true;
 }

function IsAlpha(strString)
   {
   var strValidChars = "abcdefghijklmnopqrstuvwxyz.ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function IsNumeric(strString)
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
function isValidURL(url){
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    }
}
function isValidDate(dateStr,ermsgid) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat = /^(\d{4})(\/|-)(\d{1,2})\2(\d{1,2})$/;
//var datePat = /^(\d{4})(\/|-)(\d{2})\2(d{2})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
var dt = new Date();
var y  = dt.getYear();
var m = dt.getMonth()+1;
var d = dt.getDate();
if(d<10){
	d="0"+d;
}
if(m<10){
	m="0"+m;
}
// Y2K compliant
if (y < 1000) y +=1900;

var currentdate=y+"0"+m+"0"+d;
// -->

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter "Date of Birth" in (YYYY-MM-DD) format';
return false;
}
month = matchArray[3]; // parse date into variables
day = matchArray[4];
year = matchArray[1];
var dob=year+"0"+month+"0"+day;
if(currentdate<=dob){
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';	
return false;
}

if (month < 1 || month > 12) { // check month range
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';	
return false;
}
if (day < 1 || day > 31) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';	
return false;
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
document.getElementById(ermsgid).style.display="block";
document.getElementById(ermsgid).innerHTML='Please enter valid "Date Of Birth"';
return false;
   }
}
return true;  // date is valid
}



function validateFullRegister(){
   if (document.getElementById('contactno').value!=null && document.getElementById('contactno').value!="" ){
	   if(IsNumeric(document.getElementById('contactno').value) == false || document.getElementById('contactno').value.length!=10 || (document.getElementById('contactno').value.substr(0, 1)!=8 && document.getElementById('usermobile').value.substr(0, 1)!=9)){
      document.getElementById('fullregerrormsg').style.display="block";
      document.getElementById('fullregerrormsg').innerHTML='Please enter 10 digit valid "Mobile Number"';
      document.getElementById('contactno').focus();
      return false;
	   }
   }
   if (document.getElementById('alternateemail').value!=null && document.getElementById('alternateemail').value!="" ){
	   if (echeckinvite(document.getElementById('alternateemail').value,'fullregerrormsg')==false){
	      document.getElementById('alternateemail').focus();
	     return false;
	   }
   }
   if (document.getElementById('website').value!=null && document.getElementById('website').value!="" ){
	   if (isValidURL(document.getElementById('website').value)==false){
		document.getElementById('fullregerrormsg').style.display="block";
	        document.getElementById('fullregerrormsg').innerHTML='Please enter valid "Website URL"';	   
	        document.getElementById('website').focus();
	     return false;
	   }
   }	
   if (document.getElementById('dob').value!=null && document.getElementById('dob').value!="" ){
	   if (isValidDate(document.getElementById('dob').value,'fullregerrormsg')==false){
	        document.getElementById('dob').focus();
	     return false;
	   }
   }
   if (document.getElementById('txtPhoto').value!=null && document.getElementById('txtPhoto').value!="" ){
	   document.getElementById('photouploadmessage').style.display="";
   }
   return true;

}

function hidediv(divname)
{if(iddetails(divname)!=null)
{iddetails(divname).style.display='none';iddetails(divname).style.visibility='hidden';}}

function showdiv(divName){
	if(iddetails(divName)!=null){
		iddetails(divName).style.display='block';iddetails(divName).style.visibility='visible';
	}
}

function iddetails(id)
{
	return document.getElementById(id);
}


function gotohiddenpage(sefurl,sestype,sessubtype,currentpageurl,action){
    if(document.getElementById("hiddenstate").value==''){
        document.getElementById('hidden').style.display='none';
    }
    if(document.getElementById("hiddenstate").value!='' && (document.getElementById("hiddendist").value=='All Districts' || document.getElementById("hiddendist").value=='') && (document.getElementById("hiddencity").value=='All Locations' || document.getElementById("hiddencity").value=='')){
        var state=document.getElementById("hiddenstate").value;
        state=state.replace(/ /g, "-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/general-info.htm";
            }
            else{
                window.location.href="/?action=general-info&country=India&state="+state+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
           
        else{
            if(sefurl){
                window.location.href="/India/" + state+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
           
    }
    if(document.getElementById("hiddenstate").value!='' && (document.getElementById("hiddendist").value!='All Districts' && document.getElementById("hiddendist").value!='')&& (document.getElementById("hiddencity").value=='All Locations' || document.getElementById("hiddencity").value=='')){
        var state=document.getElementById("hiddenstate").value;
        var dist=document.getElementById("hiddendist").value;
        state=state.replace(/ /g, "-");
        dist=dist.replace(/ /g,"-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + dist + "/" + sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=item&country=India&state="+state+"&dist="+dist+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/general-info.htm";
            }
            else{
                window.location.href="/?action=general-info&country=India&state="+state+"&dist="+dist;
            }
        }
           
        else{
           
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist;
            }
        }
    }
    if(document.getElementById("hiddenstate").value!='' && document.getElementById("hiddendist").value=='All Districts' && document.getElementById("hiddencity").value!='All Locations' && document.getElementById("hiddencity").value!=''){
        var state=document.getElementById("hiddenstate").value;
        var dist=document.getElementById("hiddendist").value;
        var city=document.getElementById("hiddencity").value;
        state=state.replace(/ /g, "-");
        dist=dist.replace(/ /g,"-");
        city=city.replace(/ /g,"-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + dist + "/" +city+"/"+ sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=item&country=India&state="+state+"&dist="+dist+"&city="+city+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
        else{
   
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
    }
    if(document.getElementById("hiddenstate").value!='' && document.getElementById("hiddendist").value!='' && document.getElementById("hiddendist").value!='All Districts' && document.getElementById("hiddencity").value!='' && document.getElementById("hiddencity").value!='All Locations'){
        var state=document.getElementById("hiddenstate").value;
        var dist=document.getElementById("hiddendist").value;
        var city=document.getElementById("hiddencity").value;
        state=state.replace(/ /g, "-");
        city=city.replace(/ /g,"-");
        if(sessubtype !='' && currentpageurl.match(sessubtype)!=null){
            if(sefurl){
                window.location.href="/India/" + state+ "/" + dist + "/" +city+"/"+ sestype + "/" + sessubtype + "/item.htm";
            }
            else{
                window.location.href="/?action=item&country=India&state="+state+"&dist="+dist+"&city="+city+"&type="+sestype+"&subtype="+sessubtype;
            }
        }
        else if(action=='general-info'){
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
        else{
   
            if(sefurl){
                window.location.href="/India/" + state+"/"+dist+"/"+city+"/index.htm";
            }
            else{
                window.location.href="/?action=index&country=India&state="+state+"&dist="+dist+"&city="+city;
            }
        }
    }
}


function validateAjaxLogin(){
   var emailID=document.getElementById('email');
   var password=document.getElementById('password');
   if ((emailID.value==null)||(emailID.value=="") ||(emailID.value=="Email Id")){
      document.getElementById('loginerrormsg').style.display="block";
      document.getElementById('fpasserrormsg').style.display="none";      
      document.getElementById('loginerrormsg').innerHTML='Enter Email Id';
      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'loginerrormsg')==false){
      emailID.focus();
     return false;
   }
   if ((password.value==null)||(password.value=="")||(password.value=="*****")){
      document.getElementById('loginerrormsg').style.display="block";
      document.getElementById('fpasserrormsg').style.display="none";
      document.getElementById('loginerrormsg').innerHTML='Enter Password';
      password.focus();
      return false;
   }
  return ajaxlogin();
 }

function validateAjaxRegister(){
   var emailID=document.getElementById('regemail');
   if ((emailID.value==null)||(emailID.value=="")||(emailID.value=="Email Id")){
      document.getElementById('regerrormsg').style.display="block";
      document.getElementById('regerrormsg').innerHTML='Enter Email Id';
      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'regerrormsg')==false){
      emailID.focus();
     return false;
   }
   return ajaxregister();
 }
function validateAjaxForgotPass(){
	var emailID=document.getElementById('fpassemail');
   if ((emailID.value==null)||(emailID.value=="")||(emailID.value=="Email Id")){
	document.getElementById('loginerrormsg').style.display="none";
      document.getElementById('fpasserrormsg').style.display="block";
      document.getElementById('fpasserrormsg').innerHTML='Enter Email Id';
      emailID.focus();
      return false;
   }
   if (echeckinvite(emailID.value,'fpasserrormsg')==false){
      emailID.focus();
     return false;
   }
   return ajaxforgotpass();
 }
function ajaxlogin(){
Email=document.getElementById('email').value;
Password=document.getElementById('password').value;
logincheck= HttpRequest("/?action=ajaxlogin&email="+ Email +"&password="+ Password +"&id="+Math.random());
//logincheck=logincheck.substring(3);
if(logincheck==1){
	return true;
}
else{
	document.getElementById('loginerrormsg').style.display="block";
	document.getElementById('loginerrormsg').innerHTML=logincheck;
	return false;
}
}
function ajaxregister(){
Email=document.getElementById('regemail').value;
regcheck= HttpRequest("/?action=ajaxregister&regemail="+ Email +"&id="+Math.random());
//regcheck=regcheck.substring(3);
if(regcheck==1){
	return true;
}
else{
	document.getElementById('regerrormsg').style.display="block";
	document.getElementById('regerrormsg').innerHTML=regcheck;
	return false;
}
}
function ajaxforgotpass(){
Email=document.getElementById('fpassemail').value;
fpasscheck= HttpRequest("/?action=ajaxfpass&fpassemail="+ Email +"&id="+Math.random());
//fpasscheck=fpasscheck.substring(3);
if(fpasscheck==1){
	document.getElementById('fpasssucmsg').style.display="block";
	document.getElementById('fpasserrormsg').style.display="none";
	document.getElementById('fpasssucmsg').innerHTML='Password sent to your mailbox.Please Check Spam folder too';
	return false;
}
else{
	document.getElementById('fpasserrormsg').style.display="block";
	document.getElementById('fpasserrormsg').innerHTML=fpasscheck;
	return false;
}
}

function HttpRequest( url )
 {
if(document.getElementById('systemWorking')!=null)
{
      document.getElementById('systemWorking').style.display='block';
}
     var pageRequest = false // variable to hold ajax object
	/*@cc_on
          @if (@_jscript_version >= 5)
             try {
             pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
             }
             catch (e){
                try {
                pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
                }
                catch (e2){
                pageRequest = false
                }
             }
          @end
       @*/
       if (!pageRequest && typeof XMLHttpRequest != 'undefined')
          pageRequest = new XMLHttpRequest()

       if (pageRequest){ //if pageRequest is not false
          pageRequest.open('GET', url, false); //get page synchronously
          pageRequest.send(null);

          return( embedpage(pageRequest) );
          }
       }
   function embedpage(request) {
       if (window.location.href.indexOf("http")==-1 || request.status==200)
 if(document.getElementById('systemWorking')!=null)
{
      document.getElementById('systemWorking').style.display='none';
}
          return(request.responseText);

       }

function validateSendListingSms(){
	var mobile=document.getElementById('mobilenumber');
   if ((mobile.value==null)||(mobile.value=="")){
	 document.getElementById('listingsmserrormsg').style.display="block";
	document.getElementById('listingsmserrormsg').innerHTML='Enter Mobile Number';
	setTimeout('document.getElementById(\'listingsmserrormsg\').style.display="none"', 5000);

      mobile.focus();
      return false;
   }

   if (mobile.value!=null && mobile.value!="" ){
	    if(IsNumeric(mobile.value) == false || mobile.value.length!=10 || (mobile.value.substr(0, 1)!=8 && mobile.value.substr(0, 1)!=9)){
	      document.getElementById('listingsmserrormsg').style.display="block";
	document.getElementById('listingsmserrormsg').innerHTML='Please enter valid Mobile Number';
	setTimeout('document.getElementById(\'listingsmserrormsg\').style.display="none"', 5000);
      mobile.focus();
      return false;
	   }
   }

   return true;
}
  	
