// JavaScript Document

function getCookie(c_name)
{
if (document.cookie.length>0){
	c_start=document.cookie.indexOf(c_name + "=");
	if (c_start!=-1){
		c_start=c_start + c_name.length+1;
		//find the next ";" after c_start
		c_end=document.cookie.indexOf(";",c_start);
		//if ";" is not found then cookievar goes till the end of cookie (shouldn't be the case)
		if (c_end==-1) {
			c_end=document.cookie.length;
		}
    	return document.cookie.substring(c_start,c_end);//unescape()
	} else {
		return "";	
	} 
}
return "";
}

function checkCookie() {
	
	var Uname = getCookie("Uname");
	var Thumb = getCookie("Thumb");
	var UID = getCookie("UID");
	var UUD = getCookie("UUD");

	if (UUD != "" && UID != "" && Thumb != "" && Uname != "") {
	
		$('LogResult').style.display="block";
		$('logging-in-box').style.display='none';
		$('login-box').style.display='none';
		$("Loginmsg").style.display="none";
		$("Loginmsg").innerHTML="";
		$("welcomeU").innerHTML='<a href="http://aether3d.com/index.php?u='+Uname+'">'+Uname+'</a>';/*"Welcome "+*/
		$("Uthumbsrc").src=unescape(Thumb);
		$("Uthumbsrc").alt=Uname;
		if (appstate == 'content') {
			$('commentdiv').style.display='inline-block';
			$('subcomment').style.display='inline-block';
			$('comments').style.height = '80px';
		}
	} else { 
		$('login-box').style.display='block';
	}

}