<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function openWin(pagename,w,h){
	sw=screen.availWidth;
	sh=screen.availHeight;
	tp=(sh-(h+50))/2;
	lf=(sw-w)/2;
	microsite_window=window.open(pagename,'microsite_window','toolbar=no,location=no,borders=no,directories=no,status=no,menubar=no,scrollbars=no,top='+tp+',left='+lf+',resizable=no,width='+w+',height='+h)
}
function getCalendarDate(){
	var months  = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
	var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
	var now         = new Date();
	var monthnumber = now.getMonth();
	var monthname   = months[monthnumber];
	var monthday    = now.getDate();
	var day		   = now.getDay();
	var year        = now.getYear();
	if(year < 2000) { year = year + 1900; }

	var nhours=now.getHours();
	var nmins=now.getMinutes();
	var nsecn=now.getSeconds();
	var AorP=" ";
	if (nhours>=12)AorP="PM"; else AorP="AM";
	if (nhours>=13)nhours-=12;
	if (nhours==0)nhours=12;
	if (nsecn<10)nsecn="0"+nsecn;
	if (nmins<10)nmins="0"+nmins;
	var dateString = nhours+':'+nmins+' '+AorP+' : '+monthname+' '+monthday+' '+year;
	return dateString;
}
//-->
////////////////////////////
function test(obj,msg){
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	if (regex.test(obj.value)){
		return true;
	}else{
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkint(obj,msg){
	if(isNaN(obj.value)){
		alert(msg);
		obj.focus();
		return false;
	}
}
function confirmPassword(obj,obj1,msg){
	if(obj.value!=obj1.value){
		alert(msg);
		obj1.focus();
		return false;
	}
}
function checkempty(obj,msg){
	if(obj.value==""){
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkzero(obj,msg){
	if(obj.value==0){
		alert(msg);
		obj.focus();
		return false;
	}
}
function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
////////////////////////////
function CheckAlready(ctlname,req){
	$.ajax({
	  url: 'chklogin.php?1=1'+req,
	  success: function(data){
		$('#'+ctlname).html(data);
	  }
	});
}
function GetPollResult(req){
	$.ajax({
	  url: 'pollresult.php?1=1'+req+'&sid='+Math.random(),
	  success: function(data){
		$('#poll').html(data);
	  }
	});
}
function ChkCaptcha(){
	$.ajax({
	  url: 'check.php?captcha='+$("#txtvcode").val()+'&sid='+Math.random(),
	  success: function(data){
		if(data=="false"){
			$("#chkcaptcha").html('<img src="images/modules/no.png" title="" alt="">');
			//$("#txtvcode").focus();
//			$("#submit").attr('disabled', 'disabled');
		}else{
			$("#chkcaptcha").html('<img src="images/modules/yes.png" alt="" title="">');
//			$("#submit").attr('disabled', '');
		}
	  }
	});
}
$(document).ready(function(){
	
});
function validateSearch(){
	if (checkempty(document.searchfrm.txtSearch,"Information - Please enter the key words to start the search")==false) return false;
	return true;
}
function chklogin(){
	if (test(document.frmlogin.username,"Information - Please enter your username")==false) return false;
	if (checkempty(document.frmlogin.password,"Information - Please enter your password")==false) return false;
	return true;
}
function chkFP(){
	if (test(document.frmfp.usname,"Information - Enter Valid Email Address")==false) return false;
	return true;
}
function chkregform(){
	if (test(document.frmregister.email,"Information - Please enter username")==false) return false;
	if (checkempty(document.frmregister.password,"Information - Please enter password")==false) return false;
	if (checkempty(document.frmregister.repassword,"Information - Please enter confirm password")==false) return false;
	if (confirmPassword(document.frmregister.password,document.frmregister.repassword,"Information - Password and Confirm Password must be same")==false) return false;
	if (checkempty(document.frmregister.fname,"Information - Please enter your first name")==false) return false;
	if (checkempty(document.frmregister.lname,"Information - Please enter your last name")==false) return false;
	if (checkempty(document.frmregister.dob,"Information - Please enter date of birth")==false) return false;
	if (checkempty(document.frmregister.nationality,"Information - Please select your nationality")==false) return false;
	if (checkempty(document.frmregister.residency,"Information - Please select your country of residence")==false) return false;
	if (checkempty(document.frmregister.mobile,"Information - Please enter your mobile number")==false) return false;
	if (checkempty(document.frmregister.refferer,"Information - Please select referrer")==false) return false;
	return true;
}
function chkupdprofl(){
	if (checkempty(document.frmupdate.fullname,"Information - Please enter full name")==false) return false;
	if (checkempty(document.frmupdate.dob,"Information - Please enter date of birth")==false) return false;
	if (checkempty(document.frmupdate.mobile,"Information - Please enter mobile number")==false) return false;
	if (test(document.frmupdate.email,"Information - Please enter valid email address")==false) return false;
}
function chkcp(){
	if (checkempty(document.frmupdate.oldpass,"Information - Please enter old password")==false) return false;
	if (checkempty(document.frmupdate.newpass,"Information - Please enter new password")==false) return false;
	if (checkempty(document.frmupdate.newcpass,"Information - Please enter new password again")==false) return false;
	if (confirmPassword(document.frmupdate.newpass,document.frmupdate.newcpass,"Information - Password and Confirm Password must be same")==false) return false;
}
function chkcomfrm(){
	if (checkempty(document.frmcom.uname,"Information - Please enter your name")==false) return false;
	if (test(document.frmcom.email,"Information - Please enter enter your valid email")==false) return false;
	if (checkempty(document.frmcom.descp,"Information - Please enter comments")==false) return false;
	if (checkempty(document.frmcom.txtvcode,"Information - Please enter security code")==false) return false;
}
function ChkLimit(myObject){
	if (myObject.value.length>500) myObject.value=myObject.value.substring(0,500);
	$("myCounter").html(500-myObject.value.length);	
}
function chknl(){
	if (test(document.frmnewsletter.email,"Information - Please enter your valid email address")==false) return false;
	return true;
}
