// JavaScript Document
function readCookie(name) {
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0) 	{ 
		offset = document.cookie.indexOf(search);
		if (offset != -1) { 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
		else if(name=='usrname'){
              		return readCookie('usernewno');
        	}
        	return cookieValue;
	}
	return cookieValue;
}// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours) {
	var expire = "";
	if(hours != null) {
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString() + "; path=/";
	}
	document.cookie = name + "=" + escape(value) + expire;
}



if (!$) {
	var $ = function (tagId){
		return document.getElementById(tagId);
	}
}

function Ajax(url,pars,method,obj,asynchronous)  {
	var xmlHttp;  
	if(window.ActiveXObject){  
		try {  
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");  
		}  
		catch(e) {  
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  
		} 
	} else if(window.XMLHttpRequest) {  
		xmlHttp = new XMLHttpRequest();  
	}    
	
	if(method.toLowerCase() == "get") {  
		url = url+"?"+pars;  
		xmlHttp.open("GET",url,asynchronous);  
		xmlHttp.send(null);  
	}  else  {  
		xmlHttp.open("POST",url,asynchronous);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");  
		xmlHttp.send(pars);  
	}
	
	xmlHttp.onreadystatechange = function()  {  
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200)  {   
			obj.innerHTML = xmlHttp.responseText;
		}  
	}
}

