// JavaScript Document

/*	page functions	*/
function sendToFriend() {
	var pageURL, pageTitle;
	pageURL = location.href;
	pageTitle = document.title;
	var windowVar;
	var winWidth = 410;
	var winHeight = 360;
	var xPos = (screen.availWidth/2) - winWidth/2;
	var yPos = (screen.availHeight/2) - winHeight/2;
	var windowAttributes = "width=" + winWidth + ",height=" + winHeight + ",left=" + xPos + ",top=" + yPos + ",toolbar=0,menubar=0,scrollbars=0,resizable=0,status=0,location=0,directories=0,copyhistory=0,alwaysRaised=yes";
	var handle = "ShowboothWindow";
	window.open("search783a.html?pageURL=" + escape(pageURL) + "&pageTitle=" + escape(pageTitle) + "", handle, windowAttributes);
}



var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printerFriendly() {
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		html += '<img src=/Images/display-booth-company-images/Showbooth_logo_slogan.gif><BR><BR>';
		html += '<B>Page Title:</B> ' + document.title + '<BR>';
		html += '<B>Direct URL:</B> ' + location.href + '<BR><BR>';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printerFriendly");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		var detect = navigator.userAgent.toLowerCase();
		if (gAutoPrint && (detect.indexOf("netscape") == -1) )
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

function AddToFavorites() {
	window.external.AddFavorite(location.href, document.title);
}


/* shopping cart	*/
function evalCartBtn() {
	action = document.cartForm.action.value;
	
	if (action == 'viewcart') {
		document.cartForm.ViewCart.value = "621862";
		document.cartForm.UserLogin.value = "";
		document.cartForm.CartID.value = "";
		document.cartForm.CheckOut.value = "";
	} else if (action == 'checkout') {
		document.cartForm.ViewCart.value = "621862";
		document.cartForm.UserLogin.value = "";
		document.cartForm.CartID.value = "";
		document.cartForm.CheckOut.value = "";
	} else if (action == 'CustLogin') {
		document.cartForm.ViewCart.value = "";
		document.cartForm.UserLogin.value = "621862";
		document.cartForm.CartID.value = "621862";
		document.cartForm.CheckOut.value = "Online";
	}

	return true;
}

function viewFabric(pathLg, fabName, PMScolor) {
	var enlargedImg = document.getElementById('enlargedImg');  
	enlargedImg.innerHTML = "<img src='" + pathLg + "'>";

	var enlargedFabName = document.getElementById('enlargedFabName');  
	enlargedFabName.innerHTML = fabName;

	var enlargedPMScolor = document.getElementById('enlargedPMScolor');  
	enlargedPMScolor.innerHTML = PMScolor;
	showDiv('chaserWindow');
}


function toggleDisplay(divId) {
	divStyle = document.getElementById(divId).style;
	if ( (divStyle.display == "block") || (divStyle.display == "") ) {
		divStyle.display = "none";
	} else {
		divStyle.display = "block";
	}
}


function showDiv(divId) {
	divStyle = document.getElementById(divId).style;
	divStyle.display = "block";
}

function hideDiv(divId) {
	divStyle = document.getElementById(divId).style;
	divStyle.display = "none";
}

function swapImage(imgName, newImage) {
	document [imgName].src = newImage;
}

function setContents(cID, cHTML) {
	var container = document.getElementById(cID);  
	container.innerHTML = cHTML;

}


	function act(imgName) {
		if (document.images) {
			document [imgName].src = eval(imgName + "_on.src");
		}
	}
	
	function deact(imgName) {
		if (document.images) {
			document [imgName].src = eval(imgName + "_off.src");
		}
	}

	function mOvr(src) { if (!src.contains(event.fromElement)){src.bgColor = '#d3d3d3';src.children(0).style.color='#FFFFFF'}}
	function mOut(src) { if (!src.contains(event.toElement))  {src.bgColor = '#343434';src.children(0).style.color='#FFFFFF'}}

	function openWindow(theURL, thePARAMS) {
		// usage  openWindow("filename.html" , "width=640,height=480,scrollbars=0,")
		var windowVar;
		//var windowAttributes = "width=640,height=480,scrollbars=0,toolbar=0,menubar=0,resizable=0,status=0,location=0,directories=0,copyhistory=0,alwaysRaised=yes";
		var windowAttributes = "" + thePARAMS + "toolbar=0,menubar=0,resizable=0,status=0,location=0,directories=0,copyhistory=0,alwaysRaised=yes";
		handle = "TradeShowDisplayBoothsRW";
		window.open(theURL, handle, windowAttributes);
	}

	function openWindow2(theURL, thePARAMS) {
		// usage  openWindow("filename.html" , "width=640,height=480,scrollbars=0,")
		var windowVar;
		//var windowAttributes = "width=640,height=480,scrollbars=0,toolbar=0,menubar=0,resizable=0,status=0,location=0,directories=0,copyhistory=0,alwaysRaised=yes";
		var windowAttributes = "" + thePARAMS + "toolbar=0,menubar=0,resizable=1,status=0,location=0,directories=0,copyhistory=0,alwaysRaised=yes";
		handle = "TradeShowDisplayBoothsRW";
		window.open(theURL, handle, windowAttributes);
	}

