// JavaScript Document
// Common JS for All International Sites & ADZ

// Pop-up Window with No Scrolling
function spawn_window(location, height, width) {
	window.open(location, "thisWindow", "width=" + width + ",height=" + height + ",location=no,menubar=no,resizable=yes");
}

// Scrollable Pop-up Window
function spawn_window_scrollable(location, height, width) {
	window.open(location, "thisWindow", "width=" + width + ",height=" + height + ",location=no,menubar=no,resizable=yes,scrollbars=yes");
}

// Hide Div Layers
function hideLayer(whichLayer) {
	if (document.getElementById) {
		document.getElementById(whichLayer).style.visibility = "hidden";
	}
	else if (document.all) {
		document.all[whichlayer].style.visibility = "hidden";
	}
	else if (document.layers) {
		document.layers[whichLayer].visibility = "hidden";
	}
}

// Show DIV layers
function showLayer(whichLayer) {
	if (document.getElementById) {
		//Standards-compliant.
		document.getElementById(whichLayer).style.visibility = "visible";
	}
	else if (document.all) {
		//Old versions of IE.
		document.all[whichlayer].style.visibility = "visible";
	}
	else if (document.layers) {
		//Netscape 4.
		document.layers[whichLayer].visibility = "visible";
	}
}

//-->


//SITE SPECIFIC at Root level
//<!--
/*if (document.images) {
	root = "/wcsstore/Diesel/images/en_US"
	shellpath = root + "/shell/"
	var FSSCWomens_active_on = new Image()
	FSSCWomens_active_on.src = shellpath + "womens_active_on.gif"
	var FSSCMens_active_on = new Image()
	FSSCMens_active_on.src = shellpath + "mens_active_on.gif"
	var FSSCWomens_active_off = new Image()
	FSSCWomens_active_off.src = shellpath + "womens_active_off.gif"
	var FSSCMens_active_off = new Image()
	FSSCMens_active_off.src = shellpath + "mens_active_off.gif"
	var user_in_womens_dept = false;
	var user_in_mens_dept = false;
	if (user_in_womens_dept != true && user_in_mens_dept != true) {
		FSSCWomens_active_off.src = shellpath + "womens_active_off.gif"
		FSSCMens_active_off.src = shellpath + "mens_active_off.gif"
	}

	else if (user_in_womens_dept == true) {
		FSSCWomens_active_off.src = shellpath + "womens_active_on.gif"
		FSSCMens_active_off.src = shellpath + "mens_active_off.gif"
	}

	else if (user_in_mens_dept == true) {
		FSSCWomens_active_off.src = shellpath + "womens_active_off.gif"
		FSSCMens_active_off.src = shellpath + "mens_active_on.gif"
	}
}*/


//Search Box Functions
function validateSearch() {
	var searchtxt=document.search.searchTerm.value;
    if (searchtxt == "") {
		alert("Please enter a search term or item number.");
		return false;
	}
	else if (searchtxt == unescape('Enter Keyword or Item #')) {
		alert("Please enter a search term or item number.");
		return false;
    }
    else if (searchtxt == unescape('Search')) {
		alert("Please enter a search term or item number.");
		return false;
    }
    else if (searchtxt.length <= 2) {
		alert("Please enter at least three characters.");
		return false;
    }
    else {
		return true;
	}
}

function containsNumber(sText)
{
	var numbers = "0123456789";
	var isNumber = false;
	var char;

	for (i = 0; i < sText.length && isNumber==false; i++) 
	{ 
		char = sText.charAt(i); 
		if (numbers.indexOf(char) != -1) 
		{isNumber = true;}   
	}
	return isNumber;
}

function submitSearch() {
	if (validateSearch()) {
		document.search.submit();
	}
}



//-->


