function init() {

document.location='http://www.77lovesearch.com/cgi/index.cgi';

//var i = Math.round(Math.random() * 2);
//if (i == 0) {document.logo.src='logo0.jpg';}
//else if (i == 1) {document.logo.src='logo1.jpg';}
//else if (i == 2) {document.logo.src='logo2.jpg';}
//else {document.logo.src='logo.jpg';}


}



function init2() {
var i = Math.round(Math.random() * 2);
if (i == 0) {document.logo.src='http://www.77lovesearch.com/logo0.jpg';}
else if (i == 1) {document.logo.src='http://www.77lovesearch.com/logo1.jpg';}
else if (i == 2) {document.logo.src='http://www.77lovesearch.com/logo2.jpg';}
else {document.logo.src='http://www.77lovesearch.com/logo.jpg';}
}






function checkSearch(){
	var t = document.getElementById('sv');

	if((t.value == "Enter Keywords...") || (t.value.length < 3 )){ 
		alert ("Please Enter Search Keywords...          ");
		return false;		
	} else {return true;}
}

function checkGame(){
	var t = document.getElementById('gm');

if((t.value == "Enter Keyword") || (t.value.length < 1 ) || (t.value.indexOf(' ') > 0) ){ 
alert ("You Must Use Only 1 Search Keyword To Play       ");
return false;		
} else {return true;}

}




function get_cookie()
{
if (document.cookie.length>0)
  {
		document.getElementById("lgd").value = document.cookie.match ( '(^|;) ?' + "USER" + '=([^;]*)(;|$)' );
		alert (document.getElementById("lgd").value);		
  }

}






function checkForm(){
	var titl = document.getElementById('title');
	var fullname = document.getElementById('fullname');
	var email = document.getElementById('email');
	var pas = document.getElementById('pas');
	var pass = document.getElementById('pass');
	var loc = document.getElementById('country');

	if(checkAlpha(titl, "Please complete all sections")){
	if(checkAlpha(fullname, "Please complete all sections")){
	if(emailValidator(email, "Invalid email")){ 
	if(checkPass(pas, pass, "Passwords must match and contain 4-12 characters. ")){ 
	if(!isEmpty(loc, "Please complete all sections")){
	return true; }}}}}
	
	return false;		
}


function checkEM(){
	var email = document.getElementById('email');
	if(emailValidator(email, "Invalid email.")){ return true; }
	return false;		
}



function checkPass(elem, elems, helperMsg){
	
	if((elem.value == elems.value) && (elem.value.length > 3 ) && (elem.value.length < 13 ) ){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
	}

return false;
}


function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); 
		return true;
	}
	return false;
}

function checkNum(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function checkAlpha(elem, helperMsg){
	var alphaExp = /^[a-zA-Z \s]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function checkAlphaNum(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z_-]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("PIN must be between " +min+ " and " +max+ " characters.");
		elem.focus();
		return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Please Choose"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}





function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function checkAC(elem, helperMsg){

	var acExp = /^[a-zA-Z]{5}\-[0-9]{6}$/;
	if(elem.value.match(acExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}

}

function checkPhone(elem, helperMsg){

	var phoneExp = /^[0123456789\-\(\)\s]+$/;
	if(elem.value.match(phoneExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}

}









function showImage (name, x, y, offset) {
  var c = document.getElementById(name);
  var leftoffset=0;
  var topoffset=0;

if (document.documentElement && document.documentElement.scrollTop) {
	topoffset = document.documentElement.scrollTop;}
	else if (document.body) {
		topoffset = document.body.scrollTop;}
else{ topoffset=window.pageYOffset;}


if (document.documentElement && document.documentElement.scrollLeft) {
	leftoffset = document.documentElement.scrollLeft;}
	else if (document.body) {
		leftoffset = document.body.scrollLeft;}
else{leftoffset=window.pageXOffset;}


if (offset == 0) {topoffset=0; leftoffset=0;}

  c.style.top =  topoffset + y + "px";
  c.style.left = leftoffset + x + "px";

}


function hideImage (name) {
  var c = document.getElementById(name);
  c.style.left        = -5000+"px";
}










function checkPhoto() {
var testImage = document.getElementById("imagedata");
var pathLength = testImage.length;
var lastDot = testImage.lastIndexOf(".");
var fileType = testImage.substring(lastDot,pathLength);
 
  if((fileType == ".gif") || (fileType == ".jpg") || (fileType == ".png") || (fileType == ".GIF") || (fileType == ".JPG") || (fileType == ".PNG")) {
		return true;
	 } else {
		alert("Sorry Image File Not Recognized.");
		return false;
	 }
}
 
