/**
 * @author Adam Yardley
 */

/**
 * Gets an node by id, changed its source attribute from XXXa.jpg to XXXi.jpg
 * @param {Object} id
 */
function menuOver(id){
	var el = document.getElementById(id);
	var src = el.getAttribute('src');
	var src2 = src.replace('i.jpg', 'a.jpg');
	el.setAttribute('src', src2);
}
/**
 * Gets an node by id, changed its source attribute from XXXa.jpg to XXXi.jpg
 * @param {Object} id
 */
function menuOut(id){
	var el = document.getElementById(id);
	var src = el.getAttribute('src');
	var src2 = src.replace('a.jpg', 'i.jpg');
	el.setAttribute('src', src2);
}

/**
 * Blender
 */
var curopcacity = 100;
var curpic = 0;
var ratio = -2;
var pics = new Array();
pics['0'] = 'images/home_mainimage1.gif';
pics['1'] = 'images/home_mainimage2.gif';
pics['2'] = 'images/home_mainimage3.gif';
pics['3'] = 'images/home_mainimage4.gif';

function fadedown(id) {
	var objToFade = document.getElementById(id);
	curopcacity+= ratio;
	//alert(curopcacity);
	if(curopcacity < 0){
		curpic++;
		ratio=2;
		if(curpic ==4){
			curpic = 0;
		}
		objToFade.src= pics[curpic];
	}
	else if(curopcacity >100){
		ratio= -ratio;
	}
	if(typeof objToFade.style.opacity == "string") {
		objToFade.style.opacity = curopcacity/100;
	} 
	else {

	document.getElementById(id).style.filter = 'alpha(opacity='+curopcacity+')';
	}
	window.setTimeout("fadedown('blend')", 150)
}
 
function link(id) { 

	var sel = document.getElementById(id);
	var num = sel.selectedIndex;
	
	window.location = sel.options[num].value;
}

 