// Common JS

function togglediv(divid){ 
if(document.getElementById(divid).style.display == 'none'){ 
document.getElementById(divid).style.display = 'block'; 
}else{ 
document.getElementById(divid).style.display = 'none'; 
} 
}


function changeContent(divid, folder) {
 
img = "http://www.holdsworthfabrics.com/samplecentre-uk/html/images2/"+folder+"/large_thumbnail/"+divid+".jpg"



document.getElementById("mediumSwatchcontent").innerHTML = "<img src='"+img+"' alt='tooltip' width='138' height='134'/>"

}

function changeBack() {
document.getElementById("mediumSwatch").innerHTML = "<img src='http://www.holdsworthfabrics.com/samplecentre-uk/html/images2/sample/large_thumbnail/default.jpg' alt='tooltip' width='138' height='134'/>"
}

function changeLargeSwatch(largeImage, folder) {
	document.getElementById("largeSwatchContent").innerHTML = "<img src='http://www.holdsworthfabrics.com/samplecentre-uk/html/images2/"+folder+"/large/"+largeImage+".jpg' alt='tooltip' width='360' height='304'/>"
}

function changeLargeSwatch3D(str1,str2) {
	document.getElementById("largeSwatchContent").innerHTML = '<div class="div3d" id="div'+str2+'" style="background-image:url(http://www.holdsworthfabrics.com/samplecentre-uk/html/images2/sample/large/'+str1+'_'+str2+'.jpg)"></div>'
}

function changeLargeInsitu(str1,str2) {
	document.getElementById("largeSwatchContent").innerHTML = '<div class="div3d" id="div'+str2+'" style="background-image:url(http://www.holdsworthfabrics.com/samplecentre-uk/html/images2/insitu/large/'+str1+'_'+str2+'.jpg)"></div>'
}

// Show Div
function showdiv(divid){
	document.getElementById(divid).style.display = (document.getElementById(divid).style.display == "none") ? "" : "none";
}
function showdiv_perm(divid){
	document.getElementById(divid).style.display = "";
}

function hidediv(divid){
	document.getElementById(divid).style.display = "none";
}










navHover = function() {
	var lis = document.getElementById("navmenu").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);


// Check SignIn
function CheckSignIn()
{    
	var msg,submitFlag, f;
	msg = "";
	submitFlag = 0;
	f = document.logIn;
	                 
	if(f.uname.value ==  "" || f.uname.value.toUpperCase() == "EMAIL ADDRESS")
	{
		msg= msg + "Please enter your Email Address\n";
		submitFlag = 1;
	}

	if(f.pword.value ==  "" || f.pword.value.toUpperCase() == "PASSWORD")
	{
		msg= msg + "Please enter your Password\n";
		submitFlag = 1;
	}
	
			
	if(submitFlag == "1")
	{
		alert(msg);
		return (false);
	}
}

function clearfield(thisfield){ 
	thisfield.value = "";
}


function addqty(str1){
	
	document.getElementById(str1 + '_qty_n').value = document.getElementById(str1 + '_qty').value
	
}


// Check Upload Image
function checkimg()
{    
	var msg,submitFlag, f;
	msg = "";
	submitFlag = 0;
	f = document.uploadimg;
	                 
	if(f.img_3d.value ==  "" )
	{
		msg= msg + "Please select an image to upload\n";
		submitFlag = 1;
	}
			
	if(submitFlag == "1")
	{
		alert(msg);
		return (false);
	}
	
}





