function jump(){
	var x = document.getElementById( 'gallery' ).value;
	if (x == -1){
		var path ='';
	}
	else if (x == 0){
		var path = 'gallery.php?left=0';
		window.location = path;
	}
	else{
		var path = 'statement.php?gallery=' + x;
		window.location = path;
	}
}

function visit(newURL) {
  var site = window.open(newURL, 'website','scrollbars=1, location=1, menubar=1, status=1, toolbar=1, height=768, width=1024');
  site.window.focus();
  }
  
function confirmation(url,msg) {
	var answer = confirm(msg)
	if (answer){
		window.location = url;
	}
}

// checking if mouse has rolled off the thumbnails so they dont popup immediatly
var sRoll = 0;
var sRt = setTimeout(showOriginalFloatOut,3000);

function showOriginalFloatOver(event,sOriginalUrl){
	
	if ( sRoll == 1){
		var mouseX,mouseY,wWidth; 
		var can=0 

		mouseX = event.pageX ? event.pageX : event.clientX; 
		mouseY = event.pageY ? event.pageY : event.clientY; 
	
		if (self.innerHeight) // all except Explorer
		{
			wWidth = self.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			wWidth = document.documentElement.clientWidth;
		}
		else if (document.body) // other Explorers
		{
			wWidth = document.body.clientWidth;
		}

		var divElement = document.getElementById("popUp");	
		var largeImg = divElement.getElementsByTagName("img")[0];	
		largeImg.src = sOriginalUrl;	
		largeImg.style.border = "2px solid #000000";
		divElement.style.visibility ="visible";
	
		if ( mouseX < wWidth/2 ){
			divElement.style.left = (mouseX + 40) + "px"; 
			divElement.style.top = (mouseY + 40) + "px";
		}
		else{
			divElement.style.left = (mouseX - 300) + "px"; 
			divElement.style.top = (mouseY + 40) + "px";
		}
	} // end if
	

};

function showOriginalFloatOut(){
	clearTimeout(sRt);	
	sRoll = 1;
	var divElement = document.getElementById("popUp");	
	divElement.style.visibility ="hidden";
};

function CheckForm() { 

  var email = document.form2.email;

  if(email.value == "") { 
	alert("Please enter your email"); 
	email.focus(); 
	return false;
  }else{
	if(!isMail(email.value)) {	
		alert("Your email is invalid, please try again"); 
		email.focus(); 
		return false; 
	}
  }
  
document.form2.method="post";
document.form2.action="mailsend.php";
document.form2.submit();

return true; 

} 

function isMail(str)
{
    //
    if(str == "")
        return false;
    if (str.charAt(0) == "." || str.charAt(0) == "@" || str.indexOf('@', 0) == -1
        || str.indexOf('.', 0) == -1 || str.lastIndexOf("@") == str.length-1 || str.lastIndexOf(".") == str.length-1){
        return false;
    }else{
        return true;
	}
}
