// JavaScript Document

function showObj(objname){
	document.getElementById(objname).style.display="block";
	return;
}

function hideObj(objname){
	document.getElementById(objname).style.display="none";
	return;
}


function showPic(picture,link){
		document.getElementById("picture").src=picture;
		document.getElementById("link").href=link;
	}

function showPicOnPlace(picture,link,place){
		showObj(place);
		document.getElementById(place).src=picture;
		document.getElementById(place).href=link;
	}


var ifCN = 'focused';
function focusableInput() {
	for(var i=0, j=arguments.length; i<j; i++) {
		var obj = document.getElementById(arguments[i]);
		obj.onfocus = inputFocus;
		obj.onblur = inputBlur;
	}
}
function inputFocus() {
	if (this.value == this.defaultValue) this.value = '';
	if (this.className.length > 0) this.className += ' ' + ifCN;
	else this.className = ifCN;
}
function inputBlur() {
	if (this.value == '') this.value = this.defaultValue;
	var reCN = this.className.match(new RegExp(' ?' + ifCN + ' ?'));
	if (reCN) this.className = this.className.replace(reCN, '');
}


function registerFocus(objId) {
	var theLinks = document.getElementById(objId).getElementsByTagName('a');
	for (var i=0; i<theLinks.length; i++) {
		theLinks[i].onclick = function() {
			var linkHref;
			if (linkHref = this.getAttribute('href').match(uriRE)) {
				document.getElementById(linkHref[1]).scrollIntoView();
				document.getElementById(linkHref[1]).focus();
				return false;
			}
		}
	}
}

function showPromo(promo){
clearTimeout(wait);

if(!promo){
	var i = 1+ Math.round((totalpromos-1) * Math.random());
	promo=i;
	promoname="promo"+i;
	promonavname="promonav"+promo;
} else {
	promoname="promo"+promo;
	promonavname="promonav"+promo;
}
currentpromoname='promo'+currentpromo;
document.getElementById(currentpromoname).style.top=-500+'px';
if(totalpromos > 1){
	currentpromonavname='promonav'+currentpromo;
	document.getElementById(currentpromonavname).className="";
}
document.getElementById(promoname).style.top=0+'px';
if(totalpromos > 1) { document.getElementById(promonavname).className='selected'; }

currentpromo=promo;
wait=setTimeout("nextPromo()",4000);
}

currentpromoname="promo1";
currentpromonavname="promonav1";
currentpromo=1;
totalpromos=1;
wait=0;


function nextPromo(){
if(currentpromo < totalpromos) {
		showPromo(currentpromo+1);
} else {
		showPromo(1);
}
}

slideshow=0;
wait2=0;
nexturl="";

function showSubBanners(){
document.getElementById("hotbox").style.display="block";
}

function toggleSlideshow(){
	if(slideshow == 1){
//			alert("stop show");
			clearTimeout(wait);
			document.getElementById("slideInfo").style.display="none";
			slideshow=0;
	} else {
//			alert("start show");
			slideshow=1;
			wait=setTimeout("nextSlideshow()",4000);
			document.getElementById("slideInfo").style.display="block";
	}
}


function nextSlideshow(){
clearTimeout(wait);
clearTimeout(wait2);
nexturl=nexturl.replace(/&amp;/g,"&");
//alert("nextPic:"+nexturl);
location.href=nexturl;
}


var savedClass='';

function doRollOver(objectname){
	savedClass=document.getElementById(objectname).className;
	document.getElementById(objectname).className= document.getElementById(objectname).className + ' rollOver';
	return;
}
function doRollOut(objectname){
	document.getElementById(objectname).className=savedClass;
	return;
}

