var lastCase = 'case_0';
var imgPath = "http://www.udtonline.com/img/";
var last_over;

cache("n1", imgPath + "navi/navi_home_a.gif",  imgPath + "navi/navi_home_b.gif");
cache("n2", imgPath + "navi/navi_about_a.gif", imgPath + "navi/navi_about_b.gif");
cache("n3", imgPath + "navi/navi_press_a.gif", imgPath + "navi/navi_press_b.gif");
cache("n4", imgPath + "navi/navi_careers_a.gif", imgPath + "navi/navi_careers_b.gif");
cache("n5", imgPath + "navi/navi_contact_a.gif", imgPath + "navi/navi_contact_b.gif");

function over_pic(id, flag) {

	var elm;
	var file;

	if ( (elm = document.getElementById(id) ) == false) {
		return false;
	}

	file = elm.src;


	if (flag == true && file.match('_b.gif')) {
		last_over = file;
		return false;
	}

	if (file == last_over) {
		return false;
	}

	if (flag) {

		file = file.replace(/_a.gif/, '_b.gif');

	} else {

		file = file.replace(/_b.gif/, '_a.gif');
	}

	elm.src = file;
}





function switchCase(flag) {
			
	var prevCase;
	var nextCase;
	var caseNum;

	if ( (prevCase = document.getElementById(lastCase)) == false) {
		return false;
	}

	caseNum = lastCase.substr(lastCase.length - 1, 1);
	caseNum = String(caseNum);

	if (flag) {
		caseNum++;
	} else {
		caseNum--;
	}


	if ( !(nextCase = document.getElementById('case_'+caseNum)) ) {
		return false;
	}

	if (!(prevCase.style.display = 'none')) {
		return false;
	}

	if (!(nextCase.style.display = 'block')) {
		return false;
	}			

	lastCase = 'case_'+caseNum;
}
