//
// Variables
//

var days = 5;
var screenW = 800
var screenH = 600;
var maxScreenH = 1600;

//
// Cookie Functions
//

function setCookie(cookieName,cookieValue,nDays,cookiePath) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)+ "; expires="+expire.toGMTString()+ "; path="+cookiePath; }

function getCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

//
//	check screen dimensions function
//

function getScreenDimensions() {
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == "Netscape" 
	    && parseInt(navigator.appVersion)==3
	    && navigator.javaEnabled()
	   ) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}
	if (screenH <=maxScreenH) {
		result = true;
	} else {
		result = false;
	}
	
	return result;
}

//
// Banner Object
//
 
function bannerObj () {
	this.titles = '';
	this.links = '';
	this.frames = '';

	this.languageTitles = '';
	this.languageLinks = '';
	this.languageFrame = '';
}
 
function displayBanner() {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="485" HEIGHT="19" id="banner" ALIGN="">');
	document.write(' <PARAM NAME=movie VALUE="scroll.swf?scrollTitles='+this.titles+'&scrollLinks='+this.links+'&scrollFrames='+this.frames+'&languageTitles='+this.languageTitles+'&languageLinks='+this.languageLinks+'&languageFrame='+this.languageFrame+'">');
	document.write(' <PARAM NAME=menu VALUE=false>');
	document.write(' <PARAM NAME=quality VALUE=high>');
	document.write(' <PARAM NAME=wmode VALUE=transparent>');
	document.write(' <PARAM NAME=bgcolor VALUE=#000066>');
	document.write(' <EMBED src="scroll.swf?scrollTitles='+this.titles+'&scrollLinks='+this.links+'&scrollFrames='+this.frames+'&languageTitles='+this.languageTitles+'&languageLinks='+this.languageLinks+'&languageFrame='+this.languageFrame+'" menu=false quality=high wmode=transparent bgcolor=#000066  WIDTH="485" HEIGHT="19" NAME="banner" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </EMBED>');
	document.write('</OBJECT>');
}


//
// Popup Window
//

function openWindow(page,width,height) {
	window.open(page,'popup','left=20,top=20,width='+width+',height='+height+',toolbar=0,resizable=1');
}

//
// Stylesheet Picker
//

function selectStyleSheet() {
	var n=getCookie('stylesheet');
	if (n=='') { n=11 }
	document.write('<link rel="STYLESHEET" type="text/css" href="../../style/style_'+n+'.css">');
}

//
//
//

bannerObj.prototype.display = displayBanner;
banner = new bannerObj();

//
// Set banner
//

function updateBannerLeft(bImg) {
	bImgTag = bImg.substring(bImg.indexOf('(')+1,bImg.indexOf(')'));
	bImgTag = bImgTag.replace(/@/g," ");
	top.image_left.document.getElementById("imageLeft").innerHTML = "<img src='../../upload/pics/panorama/" + bImg + "_left.jpg' width='235' height='150' alt='" + bImgTag + "' border='0'>";
}

function updateBannerRight(bImg) {
	bImgTag = bImg.substring(bImg.indexOf('(')+1,bImg.indexOf(')'));
	bImgTag = bImgTag.replace(/@/g," ");
	top.content_area_frames.image_right.document.getElementById("imageRight").innerHTML = "<img src='../../upload/pics/panorama/" + bImg + "_right.jpg' width='485' height='130' alt='" + bImgTag + "' border='0'>";
}

function updateBanners(bImg) {
	updateBannerLeft(bImg);
	window.setTimeout("updateBannerRight('"+bImg+"');",100);
}
