 var windowID = 1;

 function help(id) {
	popURL('help/id/'+id, 500, 240, null, 'true', null, null, 'help'); 
 }

 function popURL(url, w, h, scrollbars, center, toolbar, resizable, name) {
  if (w == null) w = 530;
  if (h == null) h = 500;
  if (scrollbars == null) scrollbars = 'yes';
  if (center == null) center = false;
  if (toolbar == null) toolbar = 'no';
  if (resizable == null) resizable = 'no';
  
  lt = (center) ? ',left='+(screen.availWidth - w) / 2 + ',top='+(screen.availHeight - h) / 2 : '';

  if (url.indexOf(':') == -1 && url.indexOf('/p/') == -1) url = '/index.cfm/p/'+url; 
 
  if (name == null) { 
 	windowID = url.length*windowID; 
	windowID++;
  }
  else windowID = name;

  try {
   wID = window.open(url,'mpop'+windowID,'menubar=no,resizable='+resizable+',width='+w+',height='+h+',screenX=0,screenY=0,scrollbars='+scrollbars+',statusbar=no,toolbar='+toolbar + lt);
   wID.focus();
  }
  catch(e) {} 
 }

 function check_email(email) {
  if (email.indexOf('@')==-1 || email.indexOf('.')==-1) return false; 
  else return true; 
 }

 function show(theLayer){
	if (document.all){	//IE browser
		eval("document.all.myLayer.style.visibility = 'visible'");
		eval("document.all.MenuLayer.style.visibility = 'hidden'");
		}
	else if (document.layers){	//NN browser
		document.layers.myLayer.visibility = 'visible';
		document.layers.MenuLayer.visibility = 'hidden';
		}
 }
 function hide(theLayer){
	if (document.all){	//IE browser
		eval("document.all.myLayer.style.visibility = 'hidden'");
		eval("document.all.MenuLayer.style.visibility = 'visible'");}
	else if (document.layers){	//NN browser
		document.layers.myLayer.visibility = 'hidden';
		document.layers.MenuLayer.visibility = 'visible';}
 }

 function webCheckAll() {
  if (document.webCheck.weburl.value=="") { alert("Please enter your URL"); document.webCheck.weburl.focus(); return false; }
  else return true; 
 }
 
 function loginCheckAll() {
  if (document.login.username.value=="") { alert("Please enter your username"); document.login.username.focus(); return false; }
  else if (document.login.password.value=="") { alert("Please enter your password"); document.login.password.focus(); return false; }
  else return true; 
 } 
 function newsletterCheckAll() {
  if (!check_email(document.newsletter.email.value)) { alert("Please enter your email address."); document.newsletter.email.focus(); return false; }
  else return true; 
 } 
 function checkContact() {
  if (document.Contact.sndrName.value.length <= 2) { alert("Please enter your name."); document.Contact.sndrName.focus(); return false; }
   else if (!check_email(document.Contact.sndrEmail.value)) { alert("Please check the Email address."); document.Contact.sndrEmail.focus(); return false; }
    else if (document.Contact.sndrCountry.selectedIndex == 0) { alert("Please select your country."); document.Contact.sndrCountry.focus(); return false; }
     else if (document.Contact.sndrSubject.value.length <= 6) { alert("Please enter a subject."); document.Contact.sndrSubject.focus(); return false; }
      else if (document.Contact.sndrMessage.value.length <= 6) { alert("Please enter your message."); document.Contact.sndrMessage.focus(); return false; }
  else return true;
 } 
 function printPage() {
	 if (window.print) window.print()
	 else alert("Sorry, your browser doesn't support this feature.");
 }

//change the server mode of Website
function changeStat(website_id,mode)	
{
	//alert(website_id +' - '+ mode);
	var formval = {ias_website_id:website_id,server_mode:mode };
	if(confirm("Are you sure you want change website mode ?")) {
		$.ajax({
		  type: "POST",
		  url: "/__source/admin/ajax/testAjax.cfc?method=changeWebsiteMode",
	      data: formval
		});
    }
}	
 