// JavaScript Document

var c=0;
function ImgLoop() {

	var thedivclose=document.getElementById('advert'+c);
		thedivclose.style.display = "none";
		
	if(c >= maxC){
		c=0;
	}else{
		c=c+1;
	}
		
	var thedivopen=document.getElementById('advert'+c);
		thedivopen.style.display = "";


	t=setTimeout("ImgLoop()",5000);

}

function RunLoop(thediv, maxCnt) {
	
	divname=thediv;
	maxC=maxCnt;
	ImgLoop();
	
}

function StopLoop() {
	clearTimeout(t);
}

function hideBox(box1, box2){
	var thediv1=document.getElementById(box1);
	var thediv2=document.getElementById(box2);
	if(thediv2.style.display == "none"){
		thediv1.style.display = "";
		thediv2.style.display = "";
	}else{
		thediv1.style.display = "none";
		thediv2.style.display = "none";
	}
	return false;
}

function SwapBox(box){
	var thediv1=document.getElementById(box);
	if(oldbox != "undefined"){
		var thediv2=document.getElementById(oldbox);
		if(thediv2.style.display != "none"){
			thediv2.style.display = "none";
			thediv1.style.display = "";
		}else{
			thediv1.style.display = "";
		}
	}else{
		if(thediv1.style.display == "none"){
			thediv1.style.display = "";
		}else{
			thediv1.style.display = "none";
		}
	}
	
	oldbox=box;
	
}

function OpenClose(box){
	var thediv1=document.getElementById(box);
	if(thediv1.style.display == "none"){
		thediv1.style.display = "";
	}else{
		thediv1.style.display = "none";
	}
	
}

function ArtworkBox(box, newimg, imgsrc, bodysrc){
	var thediv1=document.getElementById(box);
	var artdiv=document.getElementById('artbody');
	if(thediv1.style.display == "none"){
		thediv1.style.display = "";
	}else{
		thediv1.style.display = "none";
	}
	
	document.getElementById(newimg).src=imgsrc;
	artdiv.innerHTML=document.getElementById(bodysrc).innerHTML;
	
}

function PicViewer(picimg) {

	var picdiv=document.getElementById("picviewer");
		picdiv.style.display = "block";

	document.getElementById("picviewimg").src=picimg;	
	
}

function showBox(boxno, noBoxs){
	
	var i=0;
	for (i=0;i<=noBoxs;i++)
	{
	var closediv=document.getElementById("box"+i);
		closediv.style.display == "none";
	}
	
	var thediv=document.getElementById("box"+boxno);
		thediv.style.display = "";

	return false;
}

function TweetSwap(swap){
	document.getElementById('twtsearch').style.display = "none";
	document.getElementById('twtfeed').style.display = "none";
	document.getElementById('twtfeedbut').className = "twtmenuitem";
	document.getElementById('twtsearchbut').className = "twtmenuitem";
	
	document.getElementById(swap).style.display = "block";
	document.getElementById(swap+'but').className = "twtslctmenuitem";
}

function selectDiv(thisSel) {
		document.getElementById('res').style.display = "none";
		document.getElementById('emp').style.display = "none";
		document.getElementById('gen').style.display = "none";
		document.getElementById('pic').style.display = "none";
		document.getElementById('sel').style.display = "none";
	selVal=document.getElementById(thisSel).value;
	thediv=document.getElementById(selVal);
		thediv.style.display = "";
}

function checkBox(checkedBox, thisDiv){
	thebox=document.getElementById(checkedBox);
	thediv=document.getElementById(thisDiv);
	if (thebox.checked) {
		thediv.style.display = "";
	} else {
		thediv.style.display = "none";
	}
}

function SwapBox(box1, box2){
	var closebox=document.getElementById(box1);
	var openbox=document.getElementById(box2);
		openbox.style.display = "";
		closebox.style.display = "none";
	return false;
}


