// Show Div
function showdiv(divid){
	document.getElementById(divid).style.display = (document.getElementById(divid).style.display == "none") ? "" : "none";
}
function hidediv(divid){
	document.getElementById(divid).style.display = "none";
}

// Determine Browser Height and Width definition
function GetHeightDef()
{
	if (self.innerHeight){ // FF and Safari
		HeightDef = self.innerHeight;
		WidthDef = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientHeight) { // IE 6 
		HeightDef = document.documentElement.clientHeight;
		WidthDef = document.documentElement.clientWidth;
	}
	else if (document.body){ // IE
		HeightDef = document.body.clientHeight;
		WidthDef = document.body.clientWidth;
	}
	
}


// Open Div
function openDiv(str1)
{
	GetHeightDef();

	// Set the height of the opaque div to the height of the entire page
	document.getElementById('opaquediv').style.height = (HeightDef - 0) + "px";
	document.getElementById('opaquediv').style.width = document.body.clientWidth + "px";
	
	// Show opaque div
	document.getElementById('opaquediv').className = "block";
	document.getElementById(str1).className = "block";
	
	positionDiv(str1);
}


// Position Inner Div and set new width/height on resize/scroll
function positionDiv(str1){
	var divtop;
	var divleft;
	var box;
	
	box = document.getElementById(str1);
	
	GetHeightDef();
	
	// Set position of div
	if (box.className != "hide"){
	
		// Calculate top and left position depending on browser window and scroll
		if (self.innerHeight){ // FF and Safari
			divtop = ((HeightDef/2) - (box.offsetHeight/2)) + self.pageYOffset ;
			divleft = (self.innerWidth/2) - (box.offsetWidth/2);
		}
		else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 
			divtop = ((HeightDef/2) - (box.offsetHeight/2)) + document.documentElement.scrollTop;
			divleft = (WidthDef/2) - (box.offsetWidth/2);
	    }
		else if (document.body){ // IE
			divtop = ((HeightDef/5) - (box.offsetHeight/2)) + document.body.scrollTop;
			divleft = (WidthDef/3) - (box.offsetWidth/2);
		}
		
		// set minimum top position
		if (divtop < 50){
			divtop = 50;
	    }
		
		
		// Set top and left
		box.style.top = divtop + "px";
		box.style.left = divleft + "px";
		

		// Set the height of the opaque div to the new height of the entire page
		document.getElementById('opaquediv').style.height = (HeightDef - 0) + "px";
		document.getElementById('opaquediv').style.width = document.body.clientWidth + "px";

	}
}


function closeDivs(str1){
	document.getElementById(str1).className = "hide";
	document.getElementById('opaquediv').className = "hide";
}


//Create AJAX function
function createXMLHttp(){
	if (window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
	}
}

// Open form
function getForm(str1,str2,str3){

	createXMLHttp();
		
	xmlhttp.open("GET", "forms/" + str1 + ".asp?week_number=" + str2 + "&jid=" + str3, true);
	xmlhttp.onreadystatechange = writeForm;
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlhttp.send(null);

	function writeForm(){
		if (xmlhttp.readyState == 4){
			if (xmlhttp.status == 200){
				document.getElementById('formedit').innerHTML = xmlhttp.responseText;
				document.getElementById('formedit').className = 'loaded';
			}
		}
	}
	
}

// Get Element by Class
function getElementsByClassName(clsName) 
{ 
	var arr = new Array(); 
	var elems = document.getElementsByTagName("*");
	for ( var cls, i = 0; ( elem = elems[i] ); i++ )
	{
		if ( elem.className == clsName )
		{
			arr[arr.length] = elem;
		}
	}
	return arr;
}


function ToolTipie(){
if (document.all&&document.getElementById) {

litags = document.getElementById('projectdiv').getElementsByTagName('li');

	    for (i=0;i<litags.length;i++){

		    litags[i].onmouseover=function() {
					this.className+=" over";
				}
				
			litags[i].onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}	
		    
		} 
		
		}  

}

window.onload = function(){
    ToolTipie();
}
// Check Forms


// Product Details
function check_item_detail()
{
if(document.item_detail.product_size.value=="#")
{
	alert("Please select a product size");
	return false;
}

//if(document.item_detail.product_variation_hidden.value!="0")
//{

	if(document.item_detail.product_variation.value=="#")
	{
				alert("Please select a product variation");
		return false;
	}

//}	

document.item_detail.submit();
}  


function ADxiSKHsdka(){
	
	msg= "Click ok to send your enquiry to ShopUkDirect\n";
	
	if(confirm(msg)){
		return true;
	}else{
		return false;
	}
	
}

