var strHref=window.location.href;
var intPos = strHref.indexOf("?");
var paraArr=new Array;
var time,uin,username;
var minute,second;
var timer;

function $(id){
	return document.getElementById(id);
}

function reLoad(){
var tempString="";
var j=0;
	if (intPos!=-1){
		result=strHref.substr(intPos+1,strHref.length);
		for (var i=0; i<result.length; i++){
			drawChar=result.substr(i,1);
			if (drawChar!="&"){
				tempString=tempString+drawChar;
			}else{
				paraArr[j]=tempString;
				tempString="";
				j++;
			}
		}
		paraArr[j]=tempString;
		//#time#uin#username
		time=paraArr[0];
		uin=decodeURIComponent(paraArr[1]);
		username=decodeURIComponent(paraArr[2]);
		if (username!=-1){
			var tempUsername=username;
			tempString="";
			drawChar="";
			for (var i=0; i<tempUsername.length; i++){
				drawChar=tempUsername.substr(i,1);
				if (drawChar=="&"){
					drawChar="&amp;";	
				}
				if (drawChar=="<"){
					drawChar="&lt;";	
				}
				if (drawChar=="<"){
					drawChar="&gt;";	
				}
				if (drawChar=="\""){
					drawChar="&quot;";	
				}
				tempString=tempString+drawChar;
			}
			username=tempString;
		}
		if (uin!=-1){
			try{
				document.getElementById("uin").innerHTML=uin;
				}catch(e){
				
				}
		}
		if (username!=-1){
			try{
				document.getElementById("username").innerHTML=username;
			}catch(e){
			
			}
		}
		if (time>0){
			try{
				timer=setInterval("countTime()",1000);
				countTime();
			}catch(e){
			
			}
		}else if(time==0){
			try{
				timeOut();
			}catch(e){	}	
		}
	}else{
		return;
	}
}

function countTime(){
	minute=Math.floor(time/60);
	second=time%60;
	if (minute>=10){
		$("minute").innerHTML=minute;
	}else{
		$("minute").innerHTML="0"+minute;
	}
	if (second>=10){
		$("second").innerHTML=second;
	}else{
		$("second").innerHTML="0"+second;
	}
	if (time<=0){
		clearInterval(timer);
		try{
			timeOut();
		}catch(e){
			
		}
	}
	time--;
}