var url=location.search;
var Request = new Object();
if(url.indexOf("?")!=-1) { 
	var str = url.substr(1);
	strs = str.split("&");
	for(var i=0;i<strs.length;i++) {
		Request[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
	} 
}
var uID = Request['uid'];
var sID = Request['sid'];
var adID = Request['adid'];
var adType = Request['adtype'];
var zzID = null;
if (uID == undefined){
	uID = '';
}
if (adID == undefined){
	adID = '';
}
if (adType == undefined){
	adType = '';
}
if(sID == undefined || sID == '' || sID == 0){
	sID = '';
	zzID = uID;
}else{
	zzID = uID+'*'+sID;
}

function rand(num) {
	return Math.floor(Math.random()*num)+1;
}


function KsuWriteCookie(name, value, hours) { 
	var expire = ""; 
	if(hours == null) hours = 24;
	expire = new Date((new Date()).getTime() + hours * 3600000); 
	document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString();  
	//document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString() + "; path=/";  
	return true;
}

function KsuReadCookie(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)) 
		}
	}
	return cookieValue; 
}

/*
if (KsuReadCookie('klock') != 'true') {
	var klockopen = 'true';
	KsuWriteCookie('klock', 'true', 0.003);
}
*/