var varRef = new Array();
var spIsIE;
var spLeft;
var spTop;
var sollLeft=0;
var sollTop=0;
var sollLeftClose=0;
var sollTopClose=0;
var ua = navigator.userAgent.toLowerCase();
spIsIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));

function getReferenz(xid)
{
	if (varRef[xid])
	{
		return varRef[xid]
	}
	if (document.getElementById){
		varRef[xid] = document.getElementById(xid)
	}else if (document.all){
		varRef[xid] = document.all[xid]
	}else if (document.layers){
		varRef[xid] = document.layers[xid]
	}
	return varRef[xid]
}

function switchon(img){
	var id = getReferenz(img);
	id.src = '/images/voting06/rhino-votebutton_over.gif';
}

function switchoff(img){
	var id = getReferenz(img);
	id.src = '/images/voting06/rhino-votebutton.gif';
}

function switchon2(img,nr){
	var id = getReferenz(img);
	id.src = '/images/voting06/button_'+nr+'punkte_over.gif';
}

function switchoff2(img,nr){
	var id = getReferenz(img);
	id.src = '/images/voting06/button_'+nr+'punkte.gif';
}

function switchon3(img){
	var id = getReferenz(img);
	id.src = '/images/voting06/'+img+'_over.gif';
}

function switchoff3(img){
	var id = getReferenz(img);
	id.src = '/images/voting06/'+img+'.gif';
}


function show_layer(outp, width,height){		

	spLeft=(screen.width-width)/2;
	spTop=(screen.height-height)/2-150;
	if (spTop<0) spTop=0;

	sollLeft=spLeft;
	sollTop=spTop;

	sollLeftClose=spLeft+width-41;
	sollTopClose=spTop+22;

	inhalt_rand = getReferenz('hauptteil2');
	inhalt_rand.innerHTML = outp;

	layer_rand = getReferenz('layerdiv');
	layer_rand.style.display = 'block';
	layer_rand.style.left = spLeft+"px";
	layer_rand.style.top = spTop+"px";
	layer_rand.style.pixelWidth= width+"px";
	layer_rand.style.pixelHeight= height+"px";
	layer_rand.style.width= width+"px";
	layer_rand.style.height= height+"px";

	layer_rand = getReferenz('closediv');
	layer_rand.style.display = 'block';
	layer_rand.style.left = sollLeftClose+"px";
	layer_rand.style.top = sollTopClose+"px";
	
}

function closeLayer(){
	layer_rand = getReferenz('layerdiv');
	layer_rand.style.display = 'none';
	layer_rand.style.left = '-2000px';
	layer_rand.style.top = '-2000px';

	layer_rand = getReferenz('closediv');
	layer_rand.style.display = 'none';
	layer_rand.style.left = '-2000px';
	layer_rand.style.top = '-2000px';
	return false;
}

function show_userinfo(){

	inhalt_rand = getReferenz('userlogin1');
	inhalt_rand.style.display = 'block';
	inhalt_rand = getReferenz('userlogin2');
	inhalt_rand.style.display = 'block';
	
	if($('scroll')){
		document.location.hash="vote";
	}
}

function update_userinfo(){
		var myAjax = new Ajax.Updater(
					'userlogin_content', 
					'/voting2006/userinfo.php', 
					{
						method: 'get', 
						evalScripts: true
					});
}

function ieLayerMitScrollen(){
	if(spIsIE){
		layer_rand = getReferenz('layerdiv');
		if (document.documentElement && document.documentElement.scrollTop){
			spTop = document.documentElement.scrollTop
		}else if (document.body){
			spTop = document.body.scrollTop
		}
		layer_rand.style.top = (spTop + sollTop) + 'px';
		
		layer_rand = getReferenz('closediv');
		layer_rand.style.top = (spTop + sollTopClose) + 'px';
		setTimeout("ieLayerMitScrollen()", 1);
	}
}

function showdetails(id){
	show_layer('<iframe src="/voting2006/details.php?show='+id+'" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,560);
}

function showdetails2(id){
	show_layer('<iframe src="/voting2006/details2.php?show='+id+'" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,560);
}

function showdetails_jury(id){
	show_layer('<iframe src="/voting2006/details_jury.php?show='+id+'" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,530);
}

function changepw(){
	show_layer('<iframe src="/voting2006/changepw.php" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,370);
}

function showregister(){
	show_layer('<iframe src="/voting2006/createaccount_input.php" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,410);
}

function showlogin(){
	show_layer('<iframe src="/voting2006/error_login.php" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,410);
}

function showhelp(){
	show_layer('<iframe src="/voting2006/help.php" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',588,280);
}

function addpoints(rcid){

		var myAjax = new Ajax.Updater(
					'jsdummy', 
					'/voting2006/vote.php', 
					{
						method: 'get', 
						parameters: 'rcid='+rcid, 
						evalScripts: true
					});

}

function addpoints_neu(rcid){

		var myAjax = new Ajax.Updater(
					'jsdummy', 
					'/voting2006/vote_go.php', 
					{
						method: 'get', 
						parameters: 'rcid='+rcid, 
						evalScripts: true
					});

}

