function DIV_onmouseover(cid){
var z=document.getElementById(cid);
z.className="MenuHover";
}
function DIV_onmouseout(cid) {
var z=document.getElementById(cid);
z.className="MenuBlur";
}
var myWidth = 0, myHeight = 0,TopScroll=0,BottomScroll=0, myselvalue=0; 
function NepaliSocietyPartialDiv(url,title)
{
CheckElements();
document.getElementById("CancelButton").style.display='none';
document.getElementById("OkButton").style.display='inline';
document.getElementById("OkButton").value='Ok';
document.getElementById("AlertText").innerHTML='Loading ..... .. '; 
document.getElementById("AlertHeaderDiv").innerHTML = "<img src=\"/resources/icons/win_close_icon.gif\" style=\"float:right;cursor:pointer;\" onclick=\"ClickCancel();\">";
if(title!=null)
{document.getElementById("AlertHeaderDiv").innerHTML +="<b>"+title+"</b>";}
else
{
document.getElementById("AlertHeaderDiv").innerHTML +="<b>NepaliSociety Alert</b>";
}
WindowSize();
document.getElementById("ContentDivContainer").style.left= (myWidth/2)-125 + "px";
document.getElementById("ContentDivContainer").style.top = TopScroll + (myHeight/2)-60 + "px";
document.getElementById("NepaliSocietyAlertBox").style.display ='block'; 
document.getElementById("TransparentDivContainer").style.top = TopScroll; 
document.getElementById("OkButton").style.display='none';
PartialPageUpdate('/pages/searchlist.aspx?as=4&q=d','AlertContentDiv');
}

function NepaliSocietyCustomPartialDiv(url,title,height,width)
{
CheckElements();
document.getElementById("CancelButton").style.display='none';
document.getElementById("AlertText").innerHTML='Loading ..... .. '; 
document.getElementById("AlertHeaderDiv").innerHTML = "<img src=\"/resources/icons/win_close_icon.gif\" style=\"float:right;cursor:pointer;\" onclick=\"ClickCancelErase();\">";
if(title!=null)
{document.getElementById("AlertHeaderDiv").innerHTML +="<b>"+title+"</b>";}
else
{
document.getElementById("AlertHeaderDiv").innerHTML +="<b>NepaliSociety Alert</b>";
}
WindowSize();
document.getElementById("ContentDivContainer").style.left= (myWidth/2)-(width/2) + "px";
document.getElementById("ContentDivContainer").style.top = TopScroll + (myHeight/2)-(height/2) + "px";
document.getElementById("AlertHeaderDiv").style.width=width + 'px';
document.getElementById("AlertContentDiv").style.height=height + 'px';
document.getElementById("AlertContentDiv").style.width=width + 'px';
document.getElementById("NepaliSocietyAlertBox").style.display ='block'; 
document.getElementById("TransparentDivContainer").style.top = TopScroll; 
document.getElementById("OkButton").style.display='none';
PartialPageUpdate(url,'AlertContentDiv');
}

function NepaliSocietyCustomInputBox(AlertText,FunctionToHit,FalseCaseFunction,width,height,title)
{
	CheckElements();
    document.getElementById("AlertHeaderDiv").style.width=width;
    document.getElementById("AlertContentDiv").style.width=width;
    document.getElementById("AlertContentDiv").style.height="100%";
    document.getElementById("CancelButton").style.display='inline';
    document.getElementById("OkButton").style.display='inline';
    document.getElementById("OkButton").value='OK';
    document.getElementById("CancelButton").value='Cancel';
    document.getElementById("AlertText").innerHTML=AlertText + "<br>" + "<textarea id=CustomInputBox  />"; 
    /*  */
    
    document.getElementById("CustomInputBox").style.height=height;
    document.getElementById("CustomInputBox").style.width='95%';
    
    document.getElementById("AlertHeaderDiv").innerHTML = "<img src=\"/resources/icons/win_close_icon.gif\" style=\"float:right;cursor:pointer;\" onclick=\"ClickCancel();\">";
    if(title==null)
    {
    document.getElementById("AlertHeaderDiv").innerHTML +="<b>NepaliSociety Confirm</b>"; 
    }else
    {
    document.getElementById("AlertHeaderDiv").innerHTML +="<b>"+ title +"</b>"; 
    }
    try
    {
    WindowSize();    
    document.getElementById("ContentDivContainer").style.left= (myWidth/2)-125 + "px";
    document.getElementById("ContentDivContainer").style.top = TopScroll + (myHeight/2)-200 + "px";
    document.getElementById("NepaliSocietyAlertBox").style.display ='block'; 
    document.getElementById("TransparentDivContainer").style.top = TopScroll;             
    var param=FunctionToHit.split('(',')');    
    var test1=FunctionToHit.split('(');
    var fns=test1[0];
    var test2=test1[1].split(')');    
    var fntrue = new Function("term", "return " + fns + "(term)");        
    document.getElementById("OkButton").onclick= function (){
                                                             if(document.getElementById("CustomInputBox").value.length>0)
                                                             {
                                                             ClickOk();    
                                                             var inputtext=document.getElementById("CustomInputBox").value;                                                         
                                                             fntrue(inputtext);
                                                             }
                                                             }; 
    }
    catch(err)
    {
    
    }
    try
    {
        var test3=FalseCaseFunction.split('(');
        var test4=test3[1].split(')');            
        var fnfalse = new Function("term", "return " + FalseCaseFunction + "(term);");
        document.getElementById("CancelButton").onclick= function (){        
        ClickCancel();        
        }; 
    }
    catch(err)
    {
        document.getElementById("CancelButton").onclick=ClickCancel;
    }    
}

function NepaliSocietyAlert(AlertText,title)
{
CheckElements();
document.getElementById("CancelButton").style.display='none';
document.getElementById("OkButton").style.display='inline';
document.getElementById("OkButton").value='Ok';
document.getElementById("AlertText").innerHTML=AlertText; 
document.getElementById("AlertHeaderDiv").innerHTML = "<img src=\"/resources/icons/win_close_icon.gif\" style=\"float:right;cursor:pointer;\" onclick=\"ClickCancel();\">";
if(title!=null)
{
document.getElementById("AlertHeaderDiv").innerHTML +="<b>"+title+"</b>";
}
else
{document.getElementById("AlertHeaderDiv").innerHTML +="<b>NepaliSociety Alert</b>";
}
WindowSize();
document.getElementById("ContentDivContainer").style.left= (myWidth/2)-125 + "px";
document.getElementById("ContentDivContainer").style.top = TopScroll + (myHeight/2)-60 + "px";
document.getElementById("NepaliSocietyAlertBox").style.display ='block'; 
document.getElementById("TransparentDivContainer").style.top = TopScroll; 
document.getElementById("OkButton").onclick=ClickOk;
}


function CheckElements()
{
if(document.getElementById("NepaliSocietyAlertBox")==null)
{
DesignElements();
} 
}

function NepaliSocietyConfirm(AlertText,FunctionToHit,FalseCaseFunction)
{
    CheckElements();
    document.getElementById("CancelButton").style.display='inline';
    document.getElementById("OkButton").style.display='inline';
    document.getElementById("OkButton").value='Yes';
    document.getElementById("CancelButton").value='No';
    document.getElementById("AlertText").innerHTML=AlertText; 
    document.getElementById("AlertHeaderDiv").innerHTML = "<img src=\"/resources/icons/win_close_icon.gif\" style=\"float:right;cursor:pointer;\" onclick=\"ClickCancel();\">";
    document.getElementById("AlertHeaderDiv").innerHTML +="<b>Confirm</b>"; 
    try
    {
    WindowSize();    
    document.getElementById("ContentDivContainer").style.left= (myWidth/2)-125 + "px";
    document.getElementById("ContentDivContainer").style.top = TopScroll + (myHeight/2)-60 + "px";
    document.getElementById("NepaliSocietyAlertBox").style.display ='block'; 
    document.getElementById("TransparentDivContainer").style.top = TopScroll;             
    var param=FunctionToHit.split('(',')');    
    var test1=FunctionToHit.split('(');
    var test2=test1[1].split(')');    
    var fntrue = new Function("term", "return " + FunctionToHit);        
    document.getElementById("OkButton").onclick= function (){
                                                             ClickOk();                                                             
                                                             fntrue(test2[0]);
                                                             }; 
    }
    catch(err)
    {
    
    }
    try
    {
        var test3=FalseCaseFunction.split('(');
        var test4=test3[1].split(')');            
        var fnfalse = new Function("term", "return " + FalseCaseFunction + "(term);");
        document.getElementById("CancelButton").onclick= function (){        
        ClickCancel();             
        }; 
    }
    catch(err)
    {
        document.getElementById("CancelButton").onclick=ClickCancel;
    }

}

function NepaliSocietyConfirmRedirect(AlertText,url,FalseCaseFunction)
{
CheckElements();
document.getElementById("CancelButton").style.display='inline';
document.getElementById("OkButton").style.display='inline';
document.getElementById("OkButton").value='Yes';
document.getElementById("CancelButton").value='No';
document.getElementById("AlertText").innerHTML=AlertText; 
document.getElementById("AlertHeaderDiv").innerHTML="NepaliSociety Confirm"; 
WindowSize();
document.getElementById("ContentDivContainer").style.left= (myWidth/2)-125 + "px";
document.getElementById("ContentDivContainer").style.top = TopScroll + (myHeight/2)-60 + "px";
document.getElementById("NepaliSocietyAlertBox").style.display ='block'; 
document.getElementById("TransparentDivContainer").style.top = TopScroll; 
document.getElementById("OkButton").onclick= function(){window.open(url,"_top");}; 
try{
var param2=FalseCaseFunction.split('(',')');
var fnfalse = new Function("term", "return " + FalseCaseFunction + "(term);");
document.getElementById("CancelButton").onclick= function(){ClickCancel();fnfalse(param2[1]);}; 
}catch(e)
{
document.getElementById("CancelButton").onclick=ClickCancel;
}
}

function DesignElements()
{
var NepaliSocietyAlertBoxe = document.createElement("div");
NepaliSocietyAlertBoxe.setAttribute("id","NepaliSocietyAlertBox");
NepaliSocietyAlertBoxe.style.display= 'none';

var TransparentDivContainere = document.createElement("div");
TransparentDivContainere.setAttribute("id","TransparentDivContainer");
NepaliSocietyAlertBoxe.appendChild(TransparentDivContainere);

var ContentDivContainere = document.createElement("div");
ContentDivContainere.setAttribute("id","ContentDivContainer");
ContentDivContainere.setAttribute("align","center");
ContentDivContainere.setAttribute("valign","middle");

NepaliSocietyAlertBoxe.appendChild(ContentDivContainere);

var AlertHeaderDive = document.createElement("div");
AlertHeaderDive.setAttribute("id","AlertHeaderDiv");
ContentDivContainere.appendChild(AlertHeaderDive);

var AlertContentDive = document.createElement("div");
AlertContentDive.setAttribute("id","AlertContentDiv");
ContentDivContainere.appendChild(AlertContentDive);

var AlertTexte = document.createElement("div");
AlertTexte.setAttribute("id","AlertText");
AlertContentDive.appendChild(AlertTexte);

var ButtonContainerDive = document.createElement("div");
ButtonContainerDive.setAttribute("id","ButtonContainerDiv");
ButtonContainerDive.innerHTML="<br><input id=\"OkButton\" class=\"ConfirmButtons\" type=\"button\" value=\"Ok\" />&nbsp;&nbsp;<input id=\"CancelButton\" class=\"ConfirmButtons\" type=\"button\" value=\"Cancel\" />";
AlertContentDive.appendChild(ButtonContainerDive); 
document.body.appendChild(NepaliSocietyAlertBoxe); 
}

function ClickOk()
{
document.getElementById("NepaliSocietyAlertBox").style.display ='none'; 
}
function ClickCancel()
{
document.getElementById("NepaliSocietyAlertBox").style.display ='none';
}
function ClickCancelErase()
{
var NepaliSocietyAlertBoxe= document.getElementById("NepaliSocietyAlertBox");
document.body.removeChild(NepaliSocietyAlertBoxe); 
}
function WindowSize() 
{ 
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
{
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
{
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
} 

if( typeof( window.pageYOffset ) == 'number' ) 
{
TopScroll = window.pageYOffset; 
}
else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
TopScroll = document.body.scrollTop; 
}
else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
{ 
TopScroll = document.documentElement.scrollTop; 
}
}
function PartialPageUpdate(url,displaydiv)
{
	var xmlhttp=null;
	if (window.XMLHttpRequest)
	{
	xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	if (xmlhttp!=null)
	{ 
		xmlhttp.onreadystatechange = function()
											{ 
													if(xmlhttp.readyState == 4)
													{
															if(xmlhttp.status == 200) 
															{
																	var response=xmlhttp.responseText;
																	if(response.length>0)
																	{
																		if(displaydiv=='SommAsyncUpd')
																		{
																			document.getElementById('SommAsyncUpd').innerHTML=response.replace('.aspx','.php');
																		}else
																		{
																			document.getElementById(displaydiv).innerHTML=response;
																		}
																	} 
															
															}
													}
											};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	}
}

function GetCities(id)
{
	PartialPageUpdate('/CommunityPortal/asyncupdates.php?cc=' + id,'LocListHolder');
}

function RemovePicture(id)
{
	SilentFunctionUpdate('/CommunityPortal/asyncupdates.php?rmvpic=' + id);
	document.getElementById('PicInfoHolder').style.display='none';	
}

function SilentFunctionUpdate(url)
{
var xmlhttp=null;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{ 
xmlhttp.onreadystatechange = function()
{ 
if(xmlhttp.readyState == 4)
{
if(xmlhttp.status == 200) 
{
var response=xmlhttp.responseText;
if(response.length>0)
{
NepaliSocietyAlert(response,'Information');
} 

}
}
};
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
}


function PartialPageUpdateSync(url,displaydiv,funct)
{
var fnfunct = new Function("term", "return " + funct + "(term);");
var xmlhttp=null;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{ 
xmlhttp.onreadystatechange = function()
{ 
if(xmlhttp.readyState == 4)
{
if(xmlhttp.status == 200) 
{
var response=xmlhttp.responseText;
if(response.length>0)
{
document.getElementById(displaydiv).innerHTML=response;
fnfunct();
}
}
}
};
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
}
}

 
function SilentASyncUpdate(url)
{
var xmlhttp=null;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{ 
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
}
function SilentASyncUpdatePost(url,formsend)
{
var xmlhttp=null;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var today = new Date();
url=url + '&nocache=' + today.valueOf();
if (xmlhttp!=null)
{ 
xmlhttp.open("Post",url,true);
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send(formsend);
}
}

function SilentSyncUpdatePost(url,formsend)
{
var xmlhttp=null;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var today = new Date();
url=url + '&nocache=' + today.valueOf();
if (xmlhttp!=null)
{ 
xmlhttp.open("Post",url,false);
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send(formsend);
}
}

function follow()
{
NepaliSocietyConfirm("do you want to click yes or no?","NepaliSocietyAlert('Wow Worked.. you click ok.')","NepaliSocietyAlert('hmmm.. guess you clicked No..')");
}

function ChangeLang(lang)
{
createCookie('Lang',lang,40);    
window.top.location="http://www.nepalisociety.com/communityportal/Society_Page.aspx?i=10&g=0";
    //window.top.location.reload();    
}
////////////////////////////////////////
function createCookie(name,value,days) 
{
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+escape(value)+expires+"; path=/;";
	// + baseDomainString()
;
}

function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
	}
	return null;
}

function eraseCookie(name) 
{
	createCookie(name,"",-1);
}


function baseDomainString(){
  e = document.domain.split(/\./);
  if(e.length > 1) {
    return("domain=" + e[e.length-2] + "." +  e[e.length-1]) + ";"  ;
  }else{
    return("");
  }
}

var postid='';
var postid1='';
function ProcessContact1(pid)
{
postid1=pid;
var html='<div align=\"left\"><br /> Email:<input type=\"text\" id=\"senderemail\" /><br />Please Write your Message Below.</div>';
NepaliSocietyCustomInputBox(html,"RetrieveValues1('notknow');","NepaliSocietyAlert('Action Cancelled')","450px","200px","Share This page");
}
function RetrieveValues1(inputvalue)
{
    var commstring='action=SharePage&amp;val1=' + document.getElementById("senderemail").value + '&amp;Comment=' + inputvalue + "&amp;t=" + escape(postid1);                                    
    url='/ActionPage3.aspx?'+ commstring;                                    
    SilentASyncUpdatePost(url,commstring); 	        
    NepaliSocietyAlert('An Email along with your message has been sent to the email address.','Nepali Mp3 Download');	                                                      
}
var postid2='';
function ProcessContact2(pid)
{
postid2=pid;
var html='<div align=\"left\"><br />Your Email:<input type=\"text\" id=\"senderemail2\" /><br />Please Write your Message Below.</div>';
NepaliSocietyCustomInputBox(html,"RetrieveValues2('notknow');","NepaliSocietyAlert('Action Cancelled')","450px","200px","Contact Support");
}
function RetrieveValues2(inputvalue)
{
    var commstring='action=ContactSupport&amp;val1=' + document.getElementById("senderemail2").value + '&amp;Comment=' + inputvalue + "&amp;t=" + escape(postid2);                                    
    url='/ActionPage3.aspx?'+ commstring;                                    
    SilentASyncUpdatePost(url,commstring); 	        
    NepaliSocietyAlert('An Email along with your message has been sent to the support team.','Nepali Mp3 Download');	                                                      
}
var postid3='';
function ProcessContact3(pid)
{
postid3=pid;
var html='<div align=\"left\"><br />Your Email:<input type=\"text\" id=\"senderemail3\" /><br />Please Write your Message Below.</div>';
NepaliSocietyCustomInputBox(html,"RetrieveValues3('notknow');","NepaliSocietyAlert('Action Cancelled')","450px","200px","Report Page");
}
function RetrieveValues3(inputvalue)
{
    var commstring='action=ReportPage&amp;val1=' + document.getElementById("senderemail3").value + '&amp;Comment=' + inputvalue + "&amp;t=" + escape(postid3);                                    
    url='/ActionPage3.aspx?'+ commstring;                                    
    SilentASyncUpdatePost(url,commstring); 	        
    NepaliSocietyAlert('An Report along with your message has been sent to the support team.','Nepali Mp3 Download');	                                                      
}


function search()
{
	if(document.getElementById("Text1").value.length>0)
	{
		window.top.location="/music/musicstation.php?q=" + document.getElementById("Text1").value;
	}
	else{alert("Please type in the song name.");}
}
function CloseMusicSearchList()
{
	document.getElementById("SearchDiv").style.display="none";
}
function onEnter(event){var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if(keyCode==13)
	{
		window.top.location="/music/musicstation.php?q=" + document.getElementById("Text1").value; 
	}
else{
		/*
		if(document.getElementById("Text1").value.length>1)
		{
		*/
		PartialPageUpdate("/pages/searchlist.php?music=1&q=" + document.getElementById("Text1").value,"SearchDiv");
		document.getElementById("SearchDiv").style.display="inline";
		/*
		}*/
	}
} 

function DIVTop_onmouseover(cid)
{
	var z=document.getElementById(cid);
	z.className="TopMenuHover";
}
function DIVTop_onmouseout(cid) 
{
	var z=document.getElementById(cid);
	z.className="TopMenuBlur";
}
function DIVS_onmouseover(cid)
{
	var z=document.getElementById(cid);
	z.className="MenuHover";
}
function DIVS_onmouseout(cid) 
{
	var z=document.getElementById(cid);
	z.className="MenuBlur";
}
function CheckAll( checkAllBox )							
{		
	document.getElementById('hdnplaylist1').value='';
	document.getElementById('hdnplaylist2').value='';
    for (var i = 0; i < document.aspnetForm.elements.length; i++) 
    {
        var e = document.aspnetForm.elements[i];
        if ((e.type == 'checkbox')) 
        {
            e.checked = document.getElementById(checkAllBox).checked;
            document.getElementById('hdnplaylist2').value= document.getElementById('hdnplaylist2').value + ','+ e.id; 
            document.getElementById('hdnplaylist1').value= document.getElementById('hdnplaylist1').value + ','+ e.id;
        }
     }

}
function Check(checkid)							
{
	if(document.getElementById('hdnplaylist2').value.indexOf(checkid)<0)
	{	
		document.getElementById('hdnplaylist2').value= document.getElementById('hdnplaylist2').value + ','+ checkid; 
    	document.getElementById('hdnplaylist1').value= document.getElementById('hdnplaylist1').value + ','+ checkid;
    }else
    {
    	document.getElementById('hdnplaylist2').value= document.getElementById('hdnplaylist2').value.replace(','+checkid, '');
    	document.getElementById('hdnplaylist1').value= document.getElementById('hdnplaylist1').value.replace(','+checkid, '');
    }        
}

function CheckLogin(id)
{   
var str=id.replace('Button2','');
var url='/checksts.php?val1='+ document.getElementById(str + 'TextBox1').value + '&val2=' + document.getElementById(str + 'TextBox5').value ;
var xmlhttp=null;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{ 
xmlhttp.onreadystatechange = function()
{
 if(xmlhttp.readyState == 4)
 {
 if(xmlhttp.status == 200) 
 {
 var response=xmlhttp.responseText;
 if(response.length>0)
 {
 if(response=="202")
 {
 NepaliSocietyAlert('Invalid UserId/ PassWord.Please Try Again.','Information');
 document.getElementById(str + 'Messlabel').innerHTML='<span style=\'color:red;\'>Invalid UserId/ PassWord.Please Try Again.</span>';
  }
  else
  {
  window.top.location ="" + response;///gateway.php?
  }
  }  }
  }
  };
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
  }

function showcity(ix) 
{        
document.getElementById(ix).innerHTML = "Hide Area List<img src='/Pages/styles/NewStyles24/uparrow.png' border=0 />";        
document.getElementById(ix).style.cursor = 'pointer';        
document.getElementById('CitiesListPanel').style.display = 'inline';        
document.getElementById(ix).onclick = function(){ hidecity(ix);};   
}     
function hidecity(ix) 
{        
document.getElementById(ix).innerHTML = "Select my Area<img src='/Pages/styles/NewStyles24/downarrow.png' border=0 />";        
document.getElementById(ix).style.cursor = 'pointer';        
document.getElementById('CitiesListPanel').style.display = 'none';        
document.getElementById(ix).onclick = function() { showcity(ix); };    
}

function checkForm()
{
    
}

function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}

function isEmail(str)
{
   var regex = '/^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i';
   return regex.test(str);
}


/*-----------------------------------------------------*/
var cssmenuids=["cssmenu1"]; //Enter id(s) of CSS Horizontal UL menus, separated by commas
                var csssubmenuoffset=-1; //Offset of submenus from main menu. Default is 0 pixels.

                function createcssmenu2(){
                for (var i=0; i<cssmenuids.length; i++){
                  var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul");
                    for (var t=0; t<ultags.length; t++){
                			ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px";
                    	var spanref=document.createElement("span");
                			spanref.className="arrowdiv";
                			spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;";
                			ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref);
                    	ultags[t].parentNode.onmouseover=function(){
                					this.style.zIndex=100;
                    	this.getElementsByTagName("ul")[0].style.visibility="visible";
                					this.getElementsByTagName("ul")[0].style.zIndex=0;
                    	};
                    	ultags[t].parentNode.onmouseout=function(){
                					this.style.zIndex=0;
                					this.getElementsByTagName("ul")[0].style.visibility="hidden";
                					this.getElementsByTagName("ul")[0].style.zIndex=100;
                    	};
                    }
                  }
                }

                if (window.addEventListener)
                window.addEventListener("load", createcssmenu2, false);
                else if (window.attachEvent)
                window.attachEvent("onload", createcssmenu2);

/* -----------------------------------------------------------------------*/
                


                function SortableTable(tableEl) {

                    this.tbody = tableEl.getElementsByTagName('tbody');
                    this.thead = tableEl.getElementsByTagName('thead');
                    this.tfoot = tableEl.getElementsByTagName('tfoot');

                    this.getInnerText = function (el) {
                        if (typeof (el.textContent) != 'undefined') return el.textContent;
                        if (typeof (el.innerText) != 'undefined') return el.innerText;
                        if (typeof (el.innerHTML) == 'string') return el.innerHTML.replace(/<[^<>]+>/g, '');
                    };

                    this.getParent = function (el, pTagName) {
                        if (el == null) return null;
                        else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())
                            return el;
                        else
                            return this.getParent(el.parentNode, pTagName);
                    };

                    this.sort = function (cell) {

                        var column = cell.cellIndex;
                        var itm = this.getInnerText(this.tbody[0].rows[1].cells[column]);
                        var sortfn = this.sortCaseInsensitive;

                        if (itm.match(/\d\d[-]+\d\d[-]+\d\d\d\d/)) sortfn = this.sortDate; // date format mm-dd-yyyy
                        if (itm.replace(/^\s+|\s+$/g, "").match(/^[\d\.]+$/)) sortfn = this.sortNumeric;

                        this.sortColumnIndex = column;

                        var newRows = new Array();
                        for (j = 0; j < this.tbody[0].rows.length; j++) {
                            newRows[j] = this.tbody[0].rows[j];
                        }

                        newRows.sort(sortfn);

                        if (cell.getAttribute("sortdir") == 'down') {
                            newRows.reverse();
                            cell.setAttribute('sortdir', 'up');
                        } else {
                            cell.setAttribute('sortdir', 'down');
                        }

                        for (i = 0; i < newRows.length; i++) {
                            this.tbody[0].appendChild(newRows[i]);
                        }

                    };

                    this.sortCaseInsensitive = function (a, b) {
                        aa = thisObject.getInnerText(a.cells[thisObject.sortColumnIndex]).toLowerCase();
                        bb = thisObject.getInnerText(b.cells[thisObject.sortColumnIndex]).toLowerCase();
                        if (aa == bb) return 0;
                        if (aa < bb) return -1;
                        return 1;
                    };

                    this.sortDate = function (a, b) {
                        aa = thisObject.getInnerText(a.cells[thisObject.sortColumnIndex]);
                        bb = thisObject.getInnerText(b.cells[thisObject.sortColumnIndex]);
                        date1 = aa.substr(6, 4) + aa.substr(3, 2) + aa.substr(0, 2);
                        date2 = bb.substr(6, 4) + bb.substr(3, 2) + bb.substr(0, 2);
                        if (date1 == date2) return 0;
                        if (date1 < date2) return -1;
                        return 1;
                    };

                    this.sortNumeric = function (a, b) {
                        aa = parseFloat(thisObject.getInnerText(a.cells[thisObject.sortColumnIndex]));
                        if (isNaN(aa)) aa = 0;
                        bb = parseFloat(thisObject.getInnerText(b.cells[thisObject.sortColumnIndex]));
                        if (isNaN(bb)) bb = 0;
                        return aa - bb;
                    };

                    // define variables
                    var thisObject = this;

                    var sortSection = this.thead;

                    // constructor actions
                    if (!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length > 0)) return;

                    if (sortSection && sortSection[0].rows && sortSection[0].rows.length > 0) {
                        var sortRow = sortSection[0].rows[0];
                    } else {
                        return;
                    }

                    for (var i = 0; i < sortRow.cells.length; i++) {
                        sortRow.cells[i].sTable = this;
                        sortRow.cells[i].onclick = function () {
                            this.sTable.sort(this);
                            return false;
                        };
                    }

                }

                            
