// JavaScript Document
function $(id){
	return document.getElementById(id);
}
//sub link color
var linkColorHandler = null;
function setLinkColor(ee){
	try{
		linkColorHandler.style.color = '#000';
	}catch(e){}
	if(ee == null){
		linkColorHandler = $('linkitem' + ($('text').src).substr(5,1));
	}else{
		//alert(ee.id);
		linkColorHandler = $('linkitem' + (ee.id).substr(8,1));
	}
	try{
		if(linkColorHandler!="linkitem1"&&linkColorHandler!=null){
			linkitem1.style.color = '#000';
		}
		
		linkColorHandler.style.color = '#f30';
	}catch(e){}
}

function setLinkColor_e(ee){
	try{
		linkColorHandler.style.color = '#000';
	}catch(e){}
	if(ee == null){
		linkColorHandler = $('linkitem' + ($('text').src).substr(5,1));
	}else{
		//alert(ee.id);
		linkColorHandler = $('linkitem' + (ee.id).substr(8,1));
	}
	try{
		if(linkColorHandler!="linkitem2"&&linkColorHandler!=null){
			linkitem2.style.color = '#000';
		}
		
		linkColorHandler.style.color = '#f30';
	}catch(e){}
}

i = 215;
function countdown(){ 
	function _fresh(){
	var endtime=new Date("June 1, 2010 00:00:00");
	var nowtime = new Date();
	var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
	if(leftsecond<0){leftsecond=0;}
	__d=parseInt(leftsecond/3600/24);
	__h=parseInt((leftsecond/3600)%24);
	__m=parseInt((leftsecond/60)%24);
	__s=parseInt(leftsecond%60);
	__all = __d+"d "+__h+"h "+__m+"m "+__s+"s";
	try{
		$("_leftTime").innerHTML=__all;
	}catch(e){}
	}
	_fresh();
	marquee();
	setInterval(_fresh,1000);
	setInterval(marquee,50);
	function marquee(){
	//var it = document.getElementById("links").scrollHeight-215;
	var it = 510;
	var marTopArr = document.getElementById("links").style.marginTop.split("px");
	var marTop = marTopArr[0];
	//alert(marTop);
	if(marTop>=-it){
		document.getElementById("links").style.marginTop = i+"px";
		i = i-1;
		//document.getElementById("text").innerHTML = marTop+"px";//document.getElementById("links").scrollTop+i;
		}
	else{
		document.getElementById("links").style.marginTop = 200+"px";
		i = 200;
		}
	}
	setLinkColor();
	//alert(($('text').src).substr(4,2));
	//alert(($('linkitem2').id).substr(8,1));
}
function setIframeHeight(){
	var bobo = $('text'); //iframe id
	if(document.getElementById){
		if(bobo && !window.opera){
			if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){
				bobo.height = bobo.contentDocument.body.offsetHeight;
			}else if(bobo.Document && bobo.Document.body.scrollHeight){
				bobo.height = bobo.Document.body.scrollHeight;
			}
		}
	}
}

function reinitIframe(){
var iframe = document.getElementById("text");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height =  height;
}catch (ex){}
}
//document.getElementById('text').onload=setIframeHeight();
window.setInterval("setIframeHeight()", 200);
