var emails=new Array();
emails[0]="challenge24-2010@challenge24.org";
emails[1]="book@challenge24.org";
emails[2]="webmaster@eestec.hu";
emails[3]="contest2010@challenge24.org";
emails[4]="david.borsos@eestec.hu";
emails[5]="daniel.pozsonyi@eestec.hu";
emails[6]="petercsak.richard@eestec.hu";

var current_sponsor = new Array();
current_sponsor[0]=0;
current_sponsor[1]=0;
current_sponsor[4]=0;
var current_spimg = new Array();
current_spimg[0]=1;
current_spimg[1]=1;
current_spimg[4]=1;

function swapclass(obj, cname)
{
	obj.setAttribute(checkIE6()?'className':'class', cname);
}

function checkIE6()
{
	version=0;
	if (navigator.appVersion.indexOf("MSIE")!=-1)
	{
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}
	return version>5.5;
}

function setEmail(obj, i)
{
	obj.href="mailto:"+emails[i];
}

function setEmail2(obj, name, domain)
{
	obj.href="mailto:"+name+"@"+domain;
}

function clearEmail(obj)
{
	obj.href="#";
}

function gotopage(url)
{
	window.location=url;
}

function bookmark()
{
    var title="Challenge24"
    var url="http://www.challenge24.org"

    if (window.sidebar) window.sidebar.addPanel(title, url,"");

    else if( window.opera && window.print )
    {
    var mbm = document.createElement('a');
    mbm.setAttribute('rel','sidebar');
    mbm.setAttribute('href',url);
    mbm.setAttribute('title',title);
    mbm.click();
    }

    else if( document.all ) window.external.AddFavorite( url, title);

}
function action(url) {
	var oldurl = new String(document.location);
	var len = oldurl.indexOf("2010/") + 5;
	posstr = '';
	if((pos = url.indexOf("#"))>0){
		posstr = url.substr(pos, url.length-pos);
		url = url.substr(0, pos);
	}
	var newurl = url + "&url=" + escape(oldurl.substr(len, oldurl.length-len)) + posstr;
	document.location = newurl;
}
function addOnLoad(func){
	if (window.addEventListener) {
		window.addEventListener("load",func,false);
	} else if (window.attachEvent) {
		window.attachEvent("onload",func);
	} else {
		window.onload = function() {func();}
	}
}

function startsponsors_0(){startsponsors(0);}
function startsponsors_1(){startsponsors(1);}
function startsponsors_4(){startsponsors(4);}
function startsponsors(num)
{
	img1=document.getElementById("spbox"+num+"_1");
	img1.src="../picture.php?id="+sponsors_id[num][current_sponsor[num]]+"&sponsorlogo=1";
	current_sponsor[num]=(current_sponsor[num]+1) % sponsor_cnt[num];
	img2=document.getElementById("spbox"+num+"_2");
	img2.src="../picture.php?id="+sponsors_id[num][current_sponsor[num]]+"&sponsorlogo=1";
	
	rotatesponsors(num);
}

function rotatesponsors(num)
{
	img1=document.getElementById("spbox"+num+"_1");
	img2=document.getElementById("spbox"+num+"_2");
	current_sponsor[num]=(current_sponsor[num]+1) % sponsor_cnt[num];

	if(current_spimg[num]==1)
	{
	 	img1.src="../picture.php?id="+sponsors_id[num][current_sponsor[num]]+"&sponsorlogo=1";
	 	current_spimg[num]=2;
	 	img1.setAttribute(checkIE6()?'className':'class', "spimg_preload");
	 	img2.setAttribute(checkIE6()?'className':'class', "");
	}
	else
	{
		img2.src="../picture.php?id="+sponsors_id[num][current_sponsor[num]]+"&sponsorlogo=1";
		current_spimg[num]=1;
	 	img2.setAttribute(checkIE6()?'className':'class', "spimg_preload");
	 	img1.setAttribute(checkIE6()?'className':'class', "");
	}
	
	setTimeout('rotatesponsors('+num+')', 3000);
}

function map_load() {
	map = window.open("","mapwindow","width=688,height=725,status=no,menubar=no,resizable=yes,scrollbars=no");
	map.document.open();
	map.document.write("<img src='images/bmeterkep.jpg'>");
	map.document.close();
	}

