/**
 * functions for submitbutton mouseover and out
 */
function submitbutton_over (obj) {
	if(obj.style) {
		obj.style.color='#000000';
	}
}
function submitbutton_out (obj) {
	if(obj.style) {
		obj.style.color='#ffffff';
	}
}



/**
 * functions for swapping images at mouseover and out
 */

var swapme_outimg = new Image();
swapme_outimg.src = "";
var swapme_namerestore = null;
var swapme_objrestore = null;

function swapover(newsrc,name,imgObj) {
	if (version == "n3" && document[name]) {
		swapme_namerestore = name;
		swapme_outimg.src = document[name].src;
		tempImg = new Image();
		tempImg.src = newsrc;
		document[name].src = tempImg.src;
	} else if (imgObj) {
		swapme_objrestore = imgObj;
		swapme_outimg.src = imgObj.src;
		imgObj = new Image();
		imgObj.src = newsrc;
	}
}
function swaprestore() {
	if (version == "n3" && document[swapme_namerestore]) {
		document[swapme_namerestore].src = swapme_outimg.src;
		swapme_namerestore = null;
	} else if (swapme_objrestore) {
		swapme_objrestore.src = swapme_outimg.src;
		swapme_objrestore = null;
	}
}



/**
 * tt_news list script functions 
 *
 * Notice:
 * thanks to Internet Explorer: to prevent flickering, we wait some time before turning
 * back to mouseout-state. and we only turn back if no new mouseover has taken place.
 * if a new mouseover took place (newover==1), then this mouseover will have turned
 * the previous mouseover-state back to mouseout-state.
 */

var newover=0;
var lastover=null;

function prog_latest_mover (id) {
	if (lastover) {
		do_latest_off(lastover);
	}
	lastover=id;
	newover=1;
	if (document.getElementById) {
		target = document.getElementById( "box_"+id );
		target.className = "afw-latest-container_over";
		target = document.getElementById( "title_"+id );
		target.className = "afw-latest-title_over";
	}
}
function prog_latest_mout (id) {
	newover=0;
	if(lastover) {
		setTimeout('prog_latest_off_recheck(lastover)',300);
	}
}
function prog_latest_off_recheck (id) {
	if (newover==0) {
		do_latest_off(id);
	}
}
function do_latest_off (id) {
	if (document.getElementById){
		target = document.getElementById( "box_"+id );
		target.className = "afw-latest-container";
		target = document.getElementById( "title_"+id );
		target.className = "afw-latest-title";
	}
}
function prog_list_mover (id) {
	if (lastover) {
		do_list_off(lastover);
	}
	lastover=id;
	newover=1;
	if (document.getElementById) {
		target = document.getElementById( "date_"+id );
		target.className = "afw-list-date_over";
		target = document.getElementById( "titles_"+id );
		target.className = "afw-list-titles_over";
		target = document.getElementById( "title_"+id );
		target.className = "afw-list-title_over";
	}
}
function prog_list_mout (id) {
	newover=0;
	if(lastover) {
		setTimeout('prog_list_off_recheck(lastover)',100);
	}
}
function prog_list_off_recheck (id) {
	if (newover==0) {
		do_list_off(id);
	}
}
function do_list_off (id) {
	if (document.getElementById) {
		target = document.getElementById( "date_"+id );
		target.className = "afw-list-date";
		target = document.getElementById( "titles_"+id );
		target.className = "afw-list-titles";
		target = document.getElementById( "title_"+id );
		target.className = "afw-list-title";
	}
}
function prog_click (thehref) {
	location.href=thehref;
}





/*** not in use yet :( */

/**
 * function for resizing iframe to their needed height
 *
 * IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
 * Visit DynamicDrive.com for hundreds of original DHTML scripts
 * This notice must stay intact for legal use
 */

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["reservix-frame"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]

//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 

function resizeCaller() {
	var dyniframe=new Array()
	for (i=0; i<iframeids.length; i++){
		if (document.getElementById) {
			resizeIframe(iframeids[i])
		}
		//reveal iframe for lower end browsers? (see var above):
		if ((document.all || document.getElementById) && iframehide=="no"){
			var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
			tempobj.style.display="block"
		}
	}
}
function resizeIframe(frameid){
	var currentfr=document.getElementById(frameid)
	if (currentfr && !window.opera){
		currentfr.style.display="block"
		if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
			currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
		else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
			currentfr.height = currentfr.Document.body.scrollHeight;
		if (currentfr.addEventListener)
			currentfr.addEventListener("load", readjustIframe, false)
		else if (currentfr.attachEvent){
			currentfr.detachEvent("onload", readjustIframe) // Bug fix line
			currentfr.attachEvent("onload", readjustIframe)
		}
	}
}
function readjustIframe(loadevt) {
	var crossevt=(window.event)? event : loadevt
	var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
	if (iframeroot)
		resizeIframe(iframeroot.id);
}
function loadintoIframe(iframeid, url){
	if (document.getElementById)
	document.getElementById(iframeid).src=url
}

/*
if (window.addEventListener)
	window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
	window.attachEvent("onload", resizeCaller)
else
	window.onload=resizeCaller
*/



var $lastActiveLink = null;
function morphBg(backgroundImg, imgID, aID) {
	var $imgObj = $(imgID);
	var $linkObj = $(aID);
	$imgObj.style.backgroundImage = "url(/" + backgroundImg + ")";
	if ($lastActiveLink) {
		$lastActiveLink.removeClassName('overlink');
	}
	$linkObj.addClassName('overlink');
	$lastActiveLink = $linkObj;
}