function logincheck()
 {
   loginobj = document.login;
   if(loginobj.uname.value=="")
   { 
     alert('Please enter your email');
     loginobj.uname.focus();
     return false;
   }
  if(loginobj.password.value=="")
   { 
     alert('Please enter Password.');
     loginobj.password.focus();
	 return false;
	}
  else
   {
    loginobj.submit(); 
  }	
} 

function logincheck22()
 {
   loginobj = document.login22;
   if(loginobj.uname.value=="")
   { 
     alert('Please enter your email');
     loginobj.uname.focus();
     return false;
   }
  if(loginobj.password.value=="")
   { 
     alert('Please enter Password.');
     loginobj.password.focus();
	 return false;
	}
  else
   {
    loginobj.submit(); 
  }	
} 
//function submitform()
//{
//	var obj = document.register_form;
//	str = obj.email.value;
//	var busername = obj.username.value.replace(/>\s+|\s+$/g,'');
// 
//if((obj.usertype[0].checked==false) && (obj.usertype[1].checked==false)) 
//   { 
//     alert('Please check Usertype');
//     obj.usertype[0].focus();
//	 return false;
//	}
//
//if((obj.gender[0].checked==false) && (obj.gender[1].checked==false))
//   { 
//     alert('Please check gender');
//	 obj.gender[0].focus();
//     return false;
//	}
// 
//	if(obj.Day.value=="")
//	{ 
//	 alert('Please select day.');
//	 obj.Day.focus();
//	 return false;
//	}
//	if(obj.Month.value=="")
//	{ 
//	 alert('Please select month.');
//	 obj.Month.focus();
//	 return false;
//	}
//	if(obj.Year.value=="")
//	{ 
//	 alert('Please select year.');
//	 obj.Year.focus();
//	 return false;
//	}
//   
//	if(obj.fname.value=="") 
//	{ 
//	 alert('Please enter first name.');
//	 obj.fname.focus();
//	 return false;
//	}
//	
//	if(obj.fname.value=="First Name") 
//	{ 
//	 alert('Please enter first name.');
//	 obj.fname.focus();
//	 return false;
//	}
//   
//if(obj.username.value=="") 
//   { 
//     alert('Please enter User Name.');
//     obj.username.focus();
//     return false;
//   }
//   if(obj.userc.value=="") 
//   { 
//     alert('Please enter User Name.');
//     obj.userc.focus();
//     return false;
//   }
//   
//   if(obj.username.value=="User Name") 
//   { 
//     alert('Please enter User Name.');
//     obj.username.focus();
//     return false;
//   }
//   
//  if(busername=="")
//   { 
//     alert('Please enter valid User Name.');
//     obj.username.focus();
//     return false;
//   } 
//  if(obj.email.value=="") 
//   { 
//     alert('Please enter Email Address.');
//     obj.email.focus();
//     return false;
//   }
//   
//    if(obj.email.value=="Email Address") 
//   { 
//     alert('Please enter Email Address.');
//     obj.email.focus();
//     return false;
//   }
//   
//  if(!(str.match(emailRegEx)))
//	  {
//	  alert('Please enter a valid email address.');
//	  obj.email.focus();
//	  return false;
//   }
//    if(obj.emailc.value=="") 
//   { 
//     alert('Please enter Email Address.');
//     obj.emailc.focus();
//     return false;
//   }
//  if(obj.email.value != obj.cemail.value)
//   { 
//     alert('email does not match');
//     obj.cemail.focus();
//	 return false;
//	}
//	
//	
//	
//  if(obj.password.value=="")
//   { 
//     alert('Please enter Password.');
//     obj.password.focus();
//	 return false;
//	}
//	if(obj.password.value=="Password")
//   { 
//     alert('Please enter Password.');
//     obj.password.focus();
//	 return false;
//	}
//  if(obj.password.value != obj.cpassword.value)
//   { 
//     alert('Password does not match');
//     obj.cpassword.focus();
//	 return false;
//	}
//   			
//  if(obj.country.value=="")
//   { 
//     alert('Please select Country');
//     obj.country.focus();
//	 return false;
//	}
//	
//	 if(obj.state.value=="")
//   { 
//     alert('Please select state/county');
//     obj.state.focus();
//	 return false;
//	}
//	
//	 if(obj.city.value=="")
//   { 
//     alert('Please select City');
//     obj.city.focus();
//	 return false;
//	}
//	
//   if(obj.city.value=="City")
//   { 
//     alert('Please select City');
//     obj.city.focus();
//	 return false;
//	}
//	
//  if(obj.zip.value=="")
//   { 
//     alert('Please Enter zip');
//     obj.zip.focus();
//	 return false;
//	}
//	
//	if(obj.zip.value=="Zip")
//   { 
//     alert('Please Enter zip');
//     obj.zip.focus();
//	 return false;
//	}
//	if(!IsNumeric(obj.zip.value))
//	{
//	alert ("Please enter a valid Zip");
//	obj.zip.focus();
//	return false;			
//	}
//	if(obj.zip.value.length>6)
//	{
//	alert ("Please enter a valid Zip, upto 6 digits can be used");
//	obj.zip.focus();
//	return false;	
//	}	
//	
//  var found_it;
//	for (i=0; i< obj.intrest.length; i++)  
//	{
//
//		if (obj.intrest[i].checked===true)  {
//	
//		found_it = obj.intrest[i].value ;//set found_it equal to checked button's value
//	
//		} 
//
//	}
//	if(found_it == null){ //if found_it is NOT equal to null, a button HAS been checked
//
//		alert("Sorry! we can't complete your request, please check atleast one treatment.");
//		return false;
//	}
//	if(obj.terms.checked!=true)
//    { 
//     alert("Sorry! we can't complete your request, please accept terms and conditions.");
//     obj.terms.focus();
//	 return false;
//	}
// else
// {
//    obj.submit(); 
//  } 
//}
//
//
//function hideintrest()
// {
//   document.getElementById('part').style.display='none';
//   document.getElementById('part2').style.display='block';
// }
//function showintrest()
// {
//   document.getElementById('part').style.display='block';
//   document.getElementById('part2').style.display='none';
// } 
// 
//function hidestates()
// {
//   if((document.getElementById('country').value)!='UK'){
//   document.getElementById('states').style.display='none';
//   document.getElementById('states1').style.display='block';
//   }
//   else
//    {
//	  document.getElementById('states').style.display='block';
//      document.getElementById('states1').style.display='none'; 
//	 }
// } 
// 
// 

// 
//function submitedit()
//{
//  var obj = document.edit_form;
//  str = obj.email.value;
//   
// if((obj.gender[0].checked==false) && (obj.gender[1].checked==false))
//   { 
//     alert('Please check gender');
//	 obj.gender[0].focus();
//     return false;
//	}
// if((obj.usertype[0].checked==false) && (obj.usertype[1].checked==false)) 
//   { 
//     alert('Please check Usertype');
//     obj.usertype[0].focus();
//	 return false;
//	}
// if(obj.age.value=="")
//   { 
//     alert('Please select age-group.');
//     obj.age.focus();
//     return false;
//   }
//if(obj.fname.value=="") 
//   { 
//     alert('Please enter first name.');
//     obj.fname.focus();
//     return false;
//   }
// if(obj.email.value=="") 
//   { 
//     alert('Please enter Email Address.');
//     obj.email.focus();
//     return false;
//   }
//  if(!(str.match(emailRegEx)))
//	  {
//	  alert('Please enter a valid email address.');
//	  obj.email.focus();
//	  return false;
//   }
//  if(obj.email.value != obj.cemail.value)
//   { 
//     alert('email does not match');
//     obj.cemail.focus();
//	 return false;
//	}
// if(obj.country.value=="")
//   { 
//     alert('Please select Country');
//     obj.country.focus();
//	 return false;
//	}
//  if(obj.zip.value=="")
//   { 
//     alert('Please Enter zip');
//     obj.zip.focus();
//	 return false;
//	}
// else
// {
//    obj.submit(); 
//  } 
//}
// 
//function focususername()
// {
//   if(document.login.uname.value=="UserName")
//    {
//	  document.login.uname.value="";
//	 }
//  }
// 
//function blurusername()
// {
//   if(document.login.uname.value=="")
//    {
//	  document.login.uname.value="UserName";
//	 }
//  } 
// 
//function focuspassword()
// {
//   if(document.login.password.value=="Password")
//    {
//	  document.login.password.value="";
//	 }
//  }
//  
//function blurpassword()
// {
//   if(document.login.password.value=="")
//    {
//	  document.login.password.value="Password";
//	 }
//  }   
// 
// 
// 
//function fieldblur(fieldid,fieldvalue)
// {
//	 if(document.getElementById(fieldid).value=="") 
//	  {
//	    document.getElementById(fieldid).value=fieldvalue;
//	   }
//   }
// 
// 
//function fieldfocus(fieldid,fieldvalue)
// {
//	 if(document.getElementById(fieldid).value==fieldvalue) 
//	  {
//	    document.getElementById(fieldid).value="";
//	   }
//   } 
//   
//   
//   
//function uploadimage()
// {
//    var obj = document.detailform;
//	var imagetype = obj.image.value;
//	var extension = imagetype.split('.');
//	
//	if((obj.image.value!="") && (extension[1]!='jpeg') && (extension[1]!='jpg'))
//    {
//	  alert("Sorry! we cannot complete your request, please enter jpeg or jpg image");
//	  obj.image.focus();
//	  return false;
//	}
//   else
//    {
//	  return true;
//	 }
// } 
 

function checkuser(uname)
{
		var strURL="ajax/check_user.php?user_name="+uname;
		//alert(strURL);
			var req = getXMLHTTP();
			if (req)
			 {
				req.onreadystatechange = function() {
				
				if (req.readyState == 4) {
						// only if "OK"
						if (req.status == 200) {						
						document.getElementById('alreadyuser_error').innerHTML=req.responseText;						
						} else {
							alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}				
				}			
				req.open("GET", strURL, true);
				req.send(null);
			}
	
}	

function checkemail(uemail)
{
		var strURL="ajax/check_user.php?email="+uemail;
		
			var req = getXMLHTTP();
			if (req)
			 {
				req.onreadystatechange = function() {
				
				if (req.readyState == 4) {
						// only if "OK"
						if (req.status == 200) {						
						
						document.getElementById('alreadyemail_error').innerHTML=req.responseText;						
						} else {
							alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}				
				}			
				req.open("GET", strURL, true);
				req.send(null);
			}
}	


function getXMLHTTP()
 { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
 }

function IsNumeric(sText)
{
   var ValidChars = "0123456789-";
   var IsNumber=true;
   var Char;
   for (j = 0; j < sText.length && IsNumber == true; j++) 
      { 
      Char = sText.charAt(j); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}


