/**
*  
* Accents Project
* File: accents-functions.js
* Purpose: Common functions
* @author Rich Simms
* @version 8.0 12/09/2007
*/

var imgOver = new Array();
for (i=0;i<15;i++) {
	imgOver[i] = new Image();
}	

imgOver[5].src = "images/footer-html_on.jpg";	
imgOver[6].src = "images/footer-listen_on.jpg";
imgOver[7].src = "images/footer-help_on.jpg";
imgOver[8].src = "images/footer-translate_on.jpg";
imgOver[9].src = "images/footer-css_on.jpg";

var imgOut = new Array();
for (i=0;i<15;i++) {
	imgOut[i] = new Image();
}	

imgOut[5].src = "images/footer-html.jpg";	
imgOut[6].src = "images/footer-listen.jpg";
imgOut[7].src = "images/footer-help.jpg";
imgOut[8].src = "images/footer-translate.jpg";
imgOut[9].src = "images/footer-css.jpg";

function imgRollOver(i) {
	if (document.images) document.images[i].src = imgOver[i].src;
}

function imgRollOut(i) {
	if (document.images) document.images[i].src = imgOut[i].src;
}
	
function PopHint(text) {
	var height = 150; var width = 250; var x = 300; var y = 300;
	var top = "<html><head><title>Hint</title><style type='text/css'> * {font-family: sans-serif } </style></head><body onblur='window.close()'><p>";
	var bottom = "</p></body></html>"
	
	winRef = open("", "Hint"," height=" + height + ", width=" + width + 
		", scrollbars=no, screenX=" + x + ", screenY=" + y );
	winRef.document.writeln(top+text+bottom);
	winRef.document.close();
	//alert(text);
}

function makeCookie(name,val) {
	document.cookie = name + " = " + val;
}	

function findCookie(val) {
	var cookie = null;
	var findVal = val + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		var start = dc.indexOf(findVal);
		if (start >= 0) {
			start += findVal.length;
			lastVal = dc.indexOf(";", start);
			if (lastVal == -1) {
				lastVal = dc.length;
			}
			cookie = (dc.substring(start, lastVal));
		} else {
			return cookie;
		}
	}
	return cookie;	
}


function xCoord(id) {
	object=document.getElementById(id);
	xc=parseInt(object.style.left);
	return xc;
}	

function yCoord(id) {
	object=document.getElementById(id);
	yc=parseInt(object.style.top);
	return yc;
}	

function placeIt(id,x,y) {
	object=document.getElementById(id);
	object.style.left=x+"px";
	object.style.top=y+"px";
}

function shiftIt(id,dx,dy) {
	object=document.getElementById(id);
	object.style.left=xCoord(id)+dx+"px";
	object.style.top=yCoord(id)+dy+"px";
}

function hideIt(id) {
	object=document.getElementById(id);
	object.style.visibility="hidden";
}

function showIt(id) {
	object=document.getElementById(id);
	object.style.visibility="visible";
}

function winWidth() {
	if (window.innerWidth) return window.innerWidth;
	else if (document.documentElement) return document.documentElement.offsetWidth;
	else if (document.body.clientWidth) return document.body.clientWidth;
}

function winHeight() {
	if (window.innerHeight) return window.innerHeight;
	else if (document.documentElement) return document.documentElement.offsetHeight;
	else if (document.body.clientHeight) return document.body.clientHeight;
}

function fontSizeIt(id,dsize) {
	var object=document.getElementById(id);
	var size = parseInt(object.style.fontSize);
	var newSize = size + dsize;
	object.style.fontSize=newSize+"%";		
}

