﻿function readCookie(name){var nameEQ = name + "=";var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}return null;}
function loadPage(sId,wid,skinId,c,isRecord,gId,l){
var referrer = document.referrer; 
if (!referrer){try {if (window.opener){referrer = window.opener.location.href;}}catch (e){}}
var cId = readCookie('cId');
document.write(unescape("%3Cscript src='http://cw.grain365.cn/C.ashx?cId="+cId+"&skinId="+skinId+"&sId="+sId+"&c="+c+"&wid="+wid+"&gId="+gId+"&isRecord="+isRecord+"&rurl="+encodeURI(escape(referrer))+"&cUrl="+encodeURI(window.location.href)+"&l="+l+"' type='text/javascript'%3E%3C/script%3E"));
}
function querystring(){
this.params = new Object();
this.initialize = function(){
    var param=this.paramstring();
    if(param.length == 0) return;
    if(param.substring(0,1)=='?'){param=param.substring(1);}
    param = param.replace(/\+/g, ' ');
    var args = param.split('&');
    for (var i=0;i<args.length;i++){
        var value;
        var pair = args[i].split('=');
        var name = unescape(pair[0]);
        if (pair.length == 2)
            value = unescape(pair[1]);
        else
            value = name;
        this.params[name] = value; 
    }
};
this.get = function(key, defvalue){return this.params[key]==null?defvalue:this.params[key];};
this.paramstring = function(){var col=document.getElementsByTagName("script");var jsrc=col.item(col.length-1).src;var i=jsrc.indexOf("?");var words=jsrc.substr(i+1,jsrc.length);return(words);};
this.initialize();
}
var lastScrollYChat=0;
var timeout
function moveCallWoKF(){divCallWoKF.style.top =  document.documentElement.scrollTop + parseInt((document.documentElement.clientHeight - divCallWoKF.offsetHeight)/2) + "px";divCallWoKF.style.left = document.documentElement.scrollLeft + document.documentElement.clientWidth - divCallWoKF.offsetWidth + "px";}
function initCallWoKF(){moveCallWoKF();setTimeout("moveCallWoKF()", 1000);setTimeout("moveCallWoKF()", 2000);setTimeout("moveCallWoKF()", 4000);    setTimeout("moveCallWoKF()", 6000);setTimeout("moveCallWoKF()", 8000);}
function closeDiv(){msn.style.visibility='hidden';}
var query = new querystring();
loadPage(query.get('sId','0'),query.get('wid','0'),query.get('skinId','0'),query.get('c','1'),query.get('isRecord','0'),query.get('gId','-1'),query.get('l',''));
function openCallWo(sId,gId,wId,cUrl,cId){if(cId-0<=0){cId=readCookie("cId");if(cId==null){cId=Math.random() * 999999999 + 99999;}}var s_left=screen.availWidth;var s_top=screen.availHeight;s_left = (s_left - 700)/2;s_top = (s_top - 500)/2-100;objWin__ = window.open("http://cw.grain365.cn/Client.aspx?cId="+cId+"&gId="+gId+"&sId=" + sId + "&wId="+wId+"&cUrl=" + cUrl,"woocall", "scrollbars=no,status=yes,resizable=no,top="+s_top+",left="+s_left+",width=700,height=500, toolbar=no, menubar=no, scrollbars=no, resizable=yes, status=no");objWin__ .focus();window.opener=null;window.open('','_self');return true;}
