
var hostName = 'http://parkavept.com';

function onLoadCommonFunction() {
	//MM_preloadImages('http://parkavept.com/admin_images/slide_right.jpg');
}

function popupWindow(path, where, hite, wide){
	if (window.event){ 
		window.event.returnValue = false;   
	}
	var width;
	var height;
	var imgWidth;
	var imgHeight;
	
	if (screen.width <wide){
		width=screen.width-20;
		imgWidth=width-10;
		var windowX = (screen.width-width)/2;
	}
	else{
		var windowX = (screen.width-wide)/2;
		width=wide;
	}

	if (screen.height<hite){
		height=screen.height-70;
		imgHeight=height-20;
		var windowY = (screen.height-height)/2-30;
	}
	else{
		var windowY = (screen.height-hite)/2-10;
		height=hite;
	}

	var rand_no = Math.random();
	var i = Math.round(100*Math.random());
	if(screen.height<hite || screen.width<wide)
	{
		var props=window.open(path, i, 'scrollbars=1,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	else
	{
		var props=window.open(path, i, 'scrollbars=1,toolabars=0,resizable=1,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	props.moveTo(windowX,windowY);
}


if(window.ActiveXObject) 
{
	try 
	{
		var oHTTP = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch(e) 
	{
		var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	}
} 
else 
{
	var oHTTP = new XMLHttpRequest();
}


/*******************************************************
For Check User Details
*******************************************************/
function checkUserName()
{
	if(document.forms['userRegistration'].elements['user_name'].value=="")
	{
		document.getElementById('textContentHTML').innerHTML = 'Please enter user name.';
		document.getElementById('theLayer').style.visibility = 'visible';	
		return false;
	}
	var userLoginName = document.forms['userRegistration'].elements['user_name'].value;
	var firstName = document.forms['userRegistration'].elements['first_name'].value;
	var lastName = document.forms['userRegistration'].elements['last_name'].value;
	
	checkUser(hostName+'/ajax_call.php?mode=check_username&user_name='+userLoginName+'&first_name='+firstName+'&last_name='+lastName+'');
}

function checkUser(page) 
{
	oHTTP.open("POST", page, true);
	oHTTP.onreadystatechange=function() 
	{
		if (oHTTP.readyState==4) 
		{
			var getValue=oHTTP.responseText;
			document.getElementById('textContentHTML').innerHTML = getValue;
			document.getElementById('theLayer').style.visibility = 'visible';
		}
	}
	oHTTP.send(null);
}
function changeUsernameValue(val)
{
	document.forms['userRegistration'].elements['user_name'].value = val;
	hideMe(); 
	return false;
}
function open_div(id)
{
	if(document.getElementById('whatsnew_'+id).style.display == 'none')
	{
		document.getElementById('whatsnew_'+id).style.display = '';
	} 
	else 
	{
		document.getElementById('whatsnew_'+id).style.display = 'none';
	}
}
function open_divtest(id)
{
	if(document.getElementById('testiomonial_'+id).style.display == 'none')
	{
		document.getElementById('testiomonial_'+id).style.display = '';
	} 
	else 
	{
		document.getElementById('testiomonial_'+id).style.display = 'none';
	}
}
function checkappointment() 
{ 
	if(!document.getElementById('radio1').checked && !document.getElementById('radio2').checked && !document.getElementById('radio3').checked && !document.getElementById('radio4').checked && !document.getElementById('radio5').checked )
	{
		alert("Please  Select Day of Appointment");
		return false;		  
	}
	if(document.form1.name.value=="")
	{  
		alert("Please Enter Name");
		document.form1.name.focus();
		return false; 	  
	}
	if(document.form1.phone.value=="")
	{  
		alert("Please Enter Phone Number");
		document.form1.phone.focus();
		return false; 	  
	}		 
	if(document.form1.email.value=="")
	{
		alert("Please Enter Email");
		document.form1.email.focus();
		return false;
	}
	if(document.form1.email.value!="")
	{
		var str=document.form1.email.value;
		var er=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if(!er.test(str))
		{
			alert("Please enter your valied email address")
			return false;
		}
	}
	if(!document.getElementById('radio6').checked && !document.getElementById('radio7').checked)
	{  
		alert("Please Select Time");
		return false; 	  
	}			  
}

   
      var baseText = null;
   
       
   
 function showPopup(w,h)
	 {
   
      var popUp = document.getElementById("popupcontent");
   
      popUp.style.top = "50px";
   
      popUp.style.left = "50px";
   
      popUp.style.width =  "50px";
   
      popUp.style.height = "50px";
  
       
  
      if (baseText == null) baseText = popUp.innerHTML;
  
      popUp.innerHTML = baseText +
  
      "<div id=\"popupcontent\"><button onclick=\"hidePopup();\">Close window<button></div>";
  
       
  
      var sbar = document.getElementById("statusbar");
  
      sbar.style.marginTop = (parseInt(h)-40) + "px";
  
      popUp.style.visibility = "visible";
  
      }
	  
   
  function hidePopup()
	  {
   		var popUp = document.getElementById("popupcontent");
   		popUp.style.visibility = "hidden";
  
      }	  
	  
 function open_divlink(id)
{
	if(document.getElementById('link_'+id).style.display == 'none')
	{
		document.getElementById('link_'+id).style.display = '';
	} 
	else 
	{
		document.getElementById('link_'+id).style.display = 'none';
	}
}	  