// *** Hover fuctions

function hoverOn(el) {
	elSource = el.src.substring(el.src.indexOf("images/") + "images/".length);
	if (elSource.charAt(0) != "a") {
		newSource = "h" + elSource;
		el.src = "images/" + newSource;
	}
}
	
function hoverOff(el) {
	cs = el.src.substring(el.src.indexOf("images/") + "images/".length);
	ccs = cs.charAt(0);
	if (ccs == "h") {
		newSource = el.src.substring(el.src.indexOf("images/h") + "images/h".length);
		el.src = "images/" + newSource;
	}
}


// *** Thumbnail functions

function setThumb(no) {
	document.getElementById("cthumb").src = "images/en-cthumb-"+ no +".gif";
}

function resetThumb() {
	document.getElementById("cthumb").src = "images/en-cthumb-0.gif";
}

function setThumbDD(no) {
	document.getElementById("ddthumb").src = "images/dd-cthumb-"+ no +".gif";
}

function resetThumbDD() {
	document.getElementById("ddthumb").src = "images/dd-cthumb-0.gif";
}


// *** Drop-down functions

function showDropdown(el) {
	document.getElementById(el).style.visibility = "visible";
}

function hideDropdown(el) {
	document.getElementById(el).style.visibility = "hidden";
}


// *** Preview functions

function showPreview(el) {
	this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth;
	this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight;
	this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft;
	this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;
	this.pageX = (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth;
	this.pageY = (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
	
	elSource = el.src.substring(el.src.indexOf("images/products/t-") + "images/products/t-".length);
	document.getElementById("previewImage").src = "images/products/" + elSource;

	document.getElementById("imagePreview").style.top = scrollY + 50;
	document.getElementById("imagePreview").style.visibility = "visible";
	document.getElementById("page").className = "transparent";
}


function showPreviewIL(el) {
	this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth;
	this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight;
	this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft;
	this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;
	this.pageX = (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth;
	this.pageY = (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
	
	elSource = el.src.substring(el.src.indexOf("images/imagelibrary/t-") + "images/imagelibrary/t-".length);
	document.getElementById("previewImage").src = "images/imagelibrary/" + elSource;
	
	document.getElementById("imagePreview").style.top = scrollY + 50;
	document.getElementById("imagePreview").style.visibility = "visible";
	document.getElementById("page").className = "transparent";
}

function hidePreview() {
	document.getElementById("imagePreview").style.visibility = "hidden";
	document.getElementById("previewImage").src = "images/loading.gif";
	document.getElementById("page").className = "opaque";
}
