
function notYet()
{
	alert("Sorry this item is not available!")
}

function localDate()
{
	var d=new Date()
	var strTime=""
	var strDate=""
	var strPad=""
	var strInd=""
	var strMins=""
	var dayname=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
	var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	
	strPad = "&nbsp;&nbsp;&nbsp;"
	
	if (d.getMinutes() < 10)
	{strMins = "0" + d.getMinutes()}
	else
	{strMins = d.getMinutes()}
	
	if (d.getHours()> 12)
	{strInd=[d.getHours()-12] + ":"+ strMins + "&nbsp;PM&nbsp;&nbsp;"}
	else
	{strInd=d.getHours() + ":"+ strMins + "&nbsp;AM&nbsp;&nbsp;"}
	
	strTime = strInd

	strDate=dayname[d.getDay()] + " " + d.getDate() + " " + monthname[d.getMonth()] + " " + d.getFullYear();
	document.getElementById("clock").innerHTML=strDate
}
function showDate()
{
localDate()
setTimeout("showDate()", 1000)
}

function checkEmailValid(emailStr,msg)
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var errMsg="";   
	var matchArray=emailStr.match(emailPat)

	if (matchArray==null) 
	{
	   errMsg=errMsg+"The "+msg+" eMail Address seems incorrect!";
	   return errMsg;
	}
	else
	{
	  var user=matchArray[1]
	  var domain=matchArray[2]
	  if (user.match(userPat)==null) 
	  {
		errMsg=errMsg+"The "+msg+" eMail Address seems incorrect!";
		return errMsg;       
	  }
	  var IPArray=domain.match(ipDomainPat)
	  if (IPArray!=null) 
	  {
		  for (var i=1;i<=4;i++) 
			  {
			if (IPArray[i]>255) 
				{
				errMsg=errMsg+"The "+msg+" eMail Address seems incorrect!";
				return errMsg;
				}//IF
			  }//for
	   }//IP Array
	   var domainArray=domain.match(domainPat)
	   if (domainArray==null) 
	   {
		 errMsg=errMsg+"The "+msg+" eMail Address seems incorrect!";
		 return errMsg;
	   }
	   var atomPat=new RegExp(atom,"g")
	   var domArr=domain.match(atomPat)
	   var len=domArr.length
	   if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
	   {
		 errMsg=errMsg+"The "+msg+" eMail Address seems incorrect!";
		 return errMsg;	
	   } 
	   if (len<2) 
	   {
		 errMsg=errMsg+"The "+msg+" eMail Address seems incorrect!";
		 return errMsg;	 
	   } 
	 }//End  Match
	return "0";
}

function printThis()
{
if (window.print != null) 
{ window.print(); }
 else
 { alert('Unfortunately, your browser does not support this shortcut.  Please select Print from the File menu.'); }
}

function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function checkContactUs()
{
	if (document.frmData.strContactName.value=="" || document.frmData.strContactName.value==" " || document.frmData.strContactName.value=="-" || document.frmData.strContactName.value=="_" || document.frmData.strContactName.value==".")
	{
		alert("Your contact name is required!");
		return false;
	}	
	var e=document.frmData.strEmail.value;
	if(e=="" || e==" ")
	{
		alert("Your eMail address is required!");
		return false;
	}
	if (checkEmailValid(e)!="0") 
	{
		alert(checkEmailValid(e,''));
		return false;	
	}
	if(document.frmData.lngWebEnquiryTypeId.value=="0")
	{
		alert("Please select the Enquiry Type!");
		return false;
	}
	if (document.frmData.strDetail.value=="" || document.frmData.strDetail.value==" " || document.frmData.strDetail.value=="-" || document.frmData.strDetail.value=="_" || document.frmData.strDetail.value==".")
	{
		alert("Your message is required!");
		return false;
	}	
	if (document.frmData.strDetail.value.length > 700)
	{
		alert("The length of message must be lesser than 700 characters!");
		return false;
	}
	return true;
}
function checkEmailFriend()
{
	if (document.frmData.strFriendName.value=="" || document.frmData.strFriendName.value==" " || document.frmData.strFriendName.value=="-" || document.frmData.strFriendName.value=="_" || document.frmData.strFriendName.value==".")
	{
		alert("Your Friend's Name is required!");
		return false;
	}
	var e=document.frmData.strFriendEmail.value;
	if(e.length==""||e.length==" ")
	{
		alert("Your Friend's Email Address is required!");
		return false;
	}
	if(e.length!=0)
	{
		if (checkEmailValid(e)!="0") 
		{
			alert(checkEmailValid(e,'Friend'));
			return false;	
		}
	}	
	if (document.frmData.strYourName.value=="" || document.frmData.strYourName.value==" " || document.frmData.strYourName.value=="-" || document.frmData.strYourName.value=="_" || document.frmData.strYourName.value==".")
	{
		alert("Your Name is required!");
		return false;
	}
	var e=document.frmData.strEmail.value;
	if(e.length==""||e.length==" ")
	{
		alert("Your Email Address is required!");
		return false;
	}
	if(e.length!=0)
	{
		if (checkEmailValid(e)!="0") 
		{
			alert(checkEmailValid(e,'your'));
			return false;	
		}
	}	
	return true;
}
