/* hourglasss.js
version: 1.1, 2004-12-06
description: provides all the javascript for TUEV DataServices
author: mw@arsnavigandi
*/


function fadeIn(wd) {
	var elementId ='img_logo_big';
	if (wd.document.getElementById(elementId)) {
		wd.document.getElementById(elementId).src="/extras/styles/tuev/images/waitingLogo_big00.gif";
	}
	elementId ='img_logo'
	if (wd.document.getElementById(elementId)) {
		wd.document.getElementById(elementId).src="/extras/styles/tuev/images/waitingLogo.gif";
	}
	elementId ='img_logo2'
	if (wd.document.getElementById(elementId)) {
		wd.document.getElementById(elementId).src="/extras/styles/tuev/images/waitingLogo.gif";
	}

/*
		setTimeout(function() {document.getElementById(elementId).className="transition1";}, 1);
		setTimeout(function() {document.getElementById(elementId).className="transition2";}, 20);
		setTimeout(function() {document.getElementById(elementId).className="transition3";}, 80);
		setTimeout(function() {document.getElementById(elementId).className="transition4";}, 140);
		setTimeout(function() {document.getElementById(elementId).className="transition5";}, 200);
		setTimeout(function() {document.getElementById(elementId).className="transition6";}, 260);
		setTimeout(function() {document.getElementById(elementId).className="transition7";}, 320);
		setTimeout(function() {document.getElementById(elementId).className="transition8";}, 380);
		setTimeout(function() {document.getElementById(elementId).className="transition9";}, 440);
		setTimeout(function() {document.getElementById(elementId).className="over";}, 500);
*/
}

function fadeOut(wd) {
	//alert(wd.location.href);
	var elementId ='img_logo_big';
	if (wd.document.getElementById(elementId)) {
		wd.document.getElementById(elementId).src="/extras/styles/tuev/images/logo.gif";
	}
	elementId ='img_logo'
	if (wd.document.getElementById(elementId)) {
		wd.document.getElementById(elementId).src="/extras/styles/tuev/images/leer.gif";
	}
	elementId ='img_logo2'
	if (wd.document.getElementById(elementId)) {
		wd.document.getElementById(elementId).src="/extras/styles/tuev/images/leer.gif";
	}

	/*
	setTimeout(function() {document.getElementById(elementId).className="transition9";}, 1);
	//setTimeout(function() {document.getElementById(elementId).className="transition8";}, 120);
	setTimeout(function() {document.getElementById(elementId).className="transition7";}, 180);
	//setTimeout(function() {document.getElementById(elementId).className="transition6";}, 240);
	//setTimeout(function() {document.getElementById(elementId).className="transition5";}, 300);
	setTimeout(function() {document.getElementById(elementId).className="transition4";}, 360);
	//setTimeout(function() {document.getElementById(elementId).className="transition3";}, 420);
	//setTimeout(function() {document.getElementById(elementId).className="transition2";}, 480);
	//setTimeout(function() {document.getElementById(elementId).className="transition1";}, 540);
	setTimeout(function() {document.getElementById(elementId).className="out";}, 600);
*/
}

function startLoading(clickWindow) {
	//alert(clickWindow);
	fadeIn(clickWindow);
	if (opener && opener.top.opener && opener.top.opener.top) {
		holdWin=opener.top.opener.top;
	} else if (opener && opener.top) {
		holdWin=opener.top;
	} else {
		holdWin=top;
	}
	try {
		holdWin._recurseDocSetCursor(clickWindow,'wait');
	} catch (ex) {}
	//holdWin.setTimeout(function() {
	//	holdWin._recurseDocSetCursor(clickWindow,'');
	//} , 8000);	
}

function stopLoading(clickWindow) {
	fadeOut(clickWindow);
	if (opener && opener.top.opener && opener.top.opener.top) {
		holdWin=opener.top.opener.top;
	} else if (opener && opener.top) {
		holdWin=opener.top;
	} else {
		holdWin=top;
	}
	try {
		holdWin._recurseDocSetCursor(clickWindow,'');
	} catch (ex) {}
}


function _recurseDocSetCursor(clickWindow,cursor) {
	try {_recurseFramesSetCursor(clickWindow,cursor);} catch (ex) {}
	try {_recurseFramesSetCursor(top,cursor);} catch (ex) {}
	try {_recurseFramesSetCursor(opener,cursor);} catch (ex) {}
}

function _setCursor(doc,cursor) {
	var bodyAll = doc.getElementsByTagName('*');
	if (bodyAll) {
		for (var i = 0; i < bodyAll.length; i++) {
			bodyAll[i].style.cursor = cursor;
		}
	}
}

function _setCursor2(doc,cursor) {
	doc.getElementsByTagName('body')[0].className=cursor;
}

function _recurseFramesSetCursor(wd,cursor) {
	_setCursor2(wd.document,cursor)
	for (var i = 0; i < wd.frames.length; i++) {
		//try {alert("start: "+wd.frames[i].location.href);} catch (ex) {	}
		fadeOut(wd.frames[i]);
		_recurseFramesSetCursor(wd.frames[i],cursor);
	}
}