/******************************************************************************************************
WINDOW FUNCTIONALITY
******************************************************************************************************/
function OpenWindow(url) {
	window.open(url, 
		"GeneralWindow", 
		"fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no," +
		"width=520,height=500,left=10,top=10"
	);
}

/******************************************************************************************************
FORM FUNCTIONALITY
******************************************************************************************************/
function isValidEmail(address) {
	if (address != '' && address.search) {
		if (address.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true;
		else return false;
	}
	else return true;
}

function isValidEmailStrict(address) {
	if (isValidEmail(address) == false) return false;
	var domain = address.substring(address.indexOf('@') + 1);
	if (domain.indexOf('.') == -1) return false;
	if (domain.indexOf('.') == 0 || domain.indexOf('.') == domain.length - 1) return false;
	return true;
}

function getRadioValue(radios) {
	var SelectedRadio = '';
	for (i=0; i<radios.length; i++) {
		if (radios[i].checked) { SelectedRadio = i; }
	}
	return SelectedRadio;
}

/******************************************************************************************************
PRODUCT FUNCTIONALITY
******************************************************************************************************/
function GetLayerHandler(name) {
	return document.getElementById(name);
}

function WriteToLayer(layer,text) {
	layer.innerHTML = text;
}

function ChangeCollectionText(name,price) {
	var _name = GetLayerHandler("ProductName");
	var _price = GetLayerHandler("ProductPrice");
	WriteToLayer(_name,name);
	WriteToLayer(_price,price);
}

var IsZoom = false;
function Zoom(zoomin,zoomout) {
	var _image = GetLayerHandler("ProductImage");
	var _button = GetLayerHandler("ZoomButton");
	if (!IsZoom) {
		WriteToLayer(_image,unescape(zoomin));
		WriteToLayer(_button,"Zoom Out");
		IsZoom = true;
	}
	else {
		WriteToLayer(_image,unescape(zoomout));
		WriteToLayer(_button,"Zoom In");
		IsZoom = false;
	}
	
}

/******************************************************************************************************
MENU FUNCTIONALITY
******************************************************************************************************/
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("HomeNavigation")||document.getElementById("FullNavigation");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {
					this.className += " over";
				}
				node.onmouseout=function() {
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}

window.onload = startList;