function yoFrame() {
	self.resizeTo(document.body.scrollWidth, document.body.scrollHeight + 20); 
}

if (window.name == 'yesframe') {
	window.setTimeout(yoFrame, 1000);
	window.setTimeout(yoFrame, 5000);
	window.setTimeout(yoFrame, 10000);	
	window.setTimeout(yoFrame, 20000);
	window.setTimeout(yoFrame, 30000);
}/*for test purpose*/
/*
function btnClick(flag) {
	if(flag) {
		document.testform.result.value = getInfo();
	}
	else {
		document.testform.result.value = "";		
	}
}
*/
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"1\" height=\"1\" id=\"proxy\" align=\"middle\"> <param name=\"allowScriptAccess\" value=\"always\" /> <param name=\"movie\" value=\"http://www.yescall.com/js/proxy.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#666666\" /><embed src=\"http://www.yescall.com/js/proxy.swf\" quality=\"high\" bgcolor=\"#666666\" width=\"1\" height=\"1\" name=\"proxy\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> </object>");

function getCookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length)))	{
		return null;
	}
	if (start == -1) {
		return null;
	}
	var end = document.cookie.indexOf(";",len);
	if (end == -1) {
		end = document.cookie.length;
	}
	return unescape(document.cookie.substring(len,end));
}

function setCookie(name,value,expires,path,domain,secure) {
	var cookieString = name + "=" + escape(value) +
		( (expires) ? ";expires=" + expires : "") +
		( (path) ? ";path=" + path : "") +
		( (domain) ? ";domain=" + domain : "") +
		( (secure) ? ";secure" : "");
	document.cookie = cookieString;
}

function deleteCookie(name,path,domain) {
	if (getCookie(name)) { 
		document.cookie = name + "=" +
			( (path) ? ";path=" + path : "") +
			( (domain) ? ";domain=" + domain : "") +
			";expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function getExpDate(days, hours, minutes) {
	var expDate = new Date( );
	if (typeof days == "number" && typeof hours == "number" && typeof hours == "number") {
		expDate.setDate(expDate.getDate( ) + parseInt(days));
		expDate.setHours(expDate.getHours( ) + parseInt(hours));
		expDate.setMinutes(expDate.getMinutes( ) + parseInt(minutes));
		return expDate.toGMTString( );
	}
}
function supportCookies() {
	return navigator.cookieEnabled;
}

function getVId() {
	if(!supportCookies()) {
		return -1;
	}
	var vId = getCookie('lavid');
	if(!vId) {
		//set the expiration period for the cookies (visitor)
		var expireDate = getExpDate(7,0,0);
		var value = Math.random();
		setCookie('lavid',value,expireDate);
		return value;
	}
	else {
		return vId;	
	}
}

function getSId() {
	if(!supportCookies()) {	
		return -1;
	}
	var sId = getCookie('lasid');
	if(!sId) {				
		var value = Math.random();
		setCookie('lasid',value);
		return value;
	}
	else {
		return sId;	
	}
}

function getRefUrl() {
	if(top.document.URL == self.document.referrer) {
		//alert('top ref:' + top.document.referrer);
		return top.document.referrer;
	}
	else {
		return document.referrer;
	}	
}

function getPageUrl() {	
	return document.URL;		
}
/*
function getDomainName() {
	var domain = document.domain;
	if(!domain)
		return "";
	else
		return domain;
}
*/
function getInfo() {
	var resultVal 	= "";
		
	var visitorId 	= getVId();
	var sessionId 	= getSId();	
	var osId 		= navigator.platform;
	var browserId 	= navigator.appName;
	var displayId 	= screen.width + "x" + screen.height;
	var langId 		= "";
	if (navigator.appName == 'Netscape') {
		langId = navigator.language;
	}
	else {
		langId = navigator.browserLanguage;
	}
	
	resultVal = visitorId + "," + 
				sessionId + "," + 
				osId 	  + "," + 
				browserId + "," + 
				displayId + "," + 
				langId;			
	return resultVal;	
}

var key;
function setKey(value) {
	key = value;
}

function getCusId() {
	if(key == null) {
		return "12345601";  // for test
	}	
	else {
		return key;
	}
}
