
function getHeight() {
	var myWidth = 0, myHeight = 0;
	if(document.documentElement.clientWidth){
		var sh = document.documentElement.scrollHeight;
		var ch = document.documentElement.clientHeight;

	} else {
		var sh = document.body.scrollHeight;
		var ch = document.body.clientHeight;
	}

	//alert( 'sh: '+sh  +' ch:' +ch + " window.innerHeight: "+window.innerHeight + " document.body.clientHeight" +document.body.clientHeight);

	myHeight = sh > ch ? sh : ch;

	/*if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		alert("non-ie");
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}*/
	
	//alert(myHeight);
	return myHeight;
}


function setPictureStrip(){
	var current_height = getHeight();
	var home = new SWFObject("/themes/swpf/swf/picturestrip.swf", "mymovie", "102", current_height, "8", "#333");
	home.addParam("scale", "noscale");
	home.addParam("wmode", "transparent");
	home.addVariable("movieheight", current_height );
	home.write("picturestrip");
}


//<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">

// Reload from cache on browser resize (to help reposition footer in IE).
window.onresize=function(){
	setPictureStrip();
	//Detect IE5.5+
	version=0 ;
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp=navigator.appVersion.split("MSIE");
		version=parseFloat(temp[1]);
	}

	if (version>=5.5){//NON IE browser will return 0
	//alert("You're using IE5.5+")
		window.location.reload( true );
	}

	

	//home.setAttribute('height', getHeight());
	//home.write("picturestrip");
}

// Fade Out

function setOpacity(obj, opacity) {

	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}



function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}

function fadeOut(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
		} else {
			obj.style.visibility = 'hidden';
		}
	}
}

function initFade(elementId) {
	
	element = document.getElementById(elementId);

	if(readCookie("visit") != "true"){
		//alert("do fade = "+readCookie("visit"));
		element.style.visibility = 'visible';
		setOpacity(element, 100);
		
		window.setTimeout("fadeOut('"+elementId+"',"+100+")", 2000);
		//window.setTimeout("fadeOut('"+elementId+"',"+100+")", 10);
	} else {
		
		//alert(" don't fade "+readCookie("visit"));
		element.style.visibility = 'hidden';
	}
}



function JSFX_FloatTopLeft(){
	var startX = 596, startY = 0;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	var px = document.layers ? "" : "px";
	
	function ml(id) {
		//alert(id);
		var el = d.getElementById ? d.getElementById(id) : d.all ? d.all[id] : d.layers[id];
		if(d.layers) {
			el.style=el;
		}
		
		el.sP=function(x,y){
			this.style.left=x+px;this.style.top=y+px;
		}
		el.x = startX; el.y = startY;
		return el;
	}
	window.stayTopLeft=function() {
		var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y);
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 1);
	}
	ftlObj = ml("picturestrip");
	stayTopLeft();
}

function setVisit(){
	//alert("contents = "+readCookie("visit"));
	
	if(readCookie("visit") == null){
		//createCookie("visit","true",3600000);

		createCookie("visit","true",3000);
	}
}


function createCookie(name,value,time) {
	if (time) {
		var date = new Date();
		//date.setTime(date.getTime()+(days*24*60*60*1000));
		date.setTime(date.getTime()+time);
		var expires = "; expires="+date.toGMTString();
		
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	//alert( readCookie(name));
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


//createCookie("visit","true",10000);