var url=window.location.href;
if(window!=parent)
parent.navigate(url);
 
var aw = screen.availWidth;
var ah = screen.availHeight;
window.moveTo(0,0);
window.resizeTo(aw+1,ah);
  function killerr()
 {
    return true;
 }
window.onerror = killerr;
function copyToClipBoard(id)
{	
	var clipBoardContent=''; 
	clipBoardContent += window.document.title;
	clipBoardContent += '\r\n';
	clipBoardContent += document.location;
	window.clipboardData.setData("Text",clipBoardContent);
	alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友！");
}
function PackAway()
{
	window.external.addFavorite(document.location+'?cang='+DateDemo(), window.document.title);
}

function RndNum(n)
{
   var rnd="";
   for(var i=0;i<n;i++)
       rnd+=Math.floor(Math.random()*10);
   return rnd;
}

function DateDemo(){
   var d, s = "";           // 声明变量。
   d = new Date();                           // 创建 Date 对象。
   s += d.getYear();                         // 获取年份。
   s += (d.getMonth() +1) + "";            // 获取月份。
   s += d.getDate() + "";                   // 获取日。
   return(s);                                // 返回日期。
} 

function oCopy(obj){ 
obj.select(); 
js=obj.createTextRange(); 
js.execCommand("Copy") 
alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
} 

function copyText(obj)  
{ 
       var e=document.getElementById("content");//对象是content 
        e.select(); //选择对象 
        document.execCommand("Copy"); //执行浏览器复制命令 
alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
}

function fRandomBy(under, over){ 
switch(arguments.length){ 
case 1: return parseInt(Math.random()*under+1); 
case 2: return parseInt(Math.random()*(over-under+1) + under); 
default: return 0; 
}
}

function URLdecode(str) {
    var ret = "";
    for(var i=0;i<str.length;i++) {
        var chr = str.charAt(i);
        if(chr == "+") {
            ret += " ";
        }else if(chr=="%") {
            var asc = str.substring(i+1,i+3);
            if(parseInt("0x"+asc)>0x7f) {
                ret += decodeURI("%"+ str.substring(i+1,i+9));
                i += 8;
            }else {
                ret += String.fromCharCode(parseInt("0x"+asc));
                i += 2;
            }
        }else {
            ret += chr;
        }
    }
    return ret;
}

//写cookies   
function setCookie(name,value){
var exp = new Date();
exp.setTime(exp.getTime() + 12*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}   


//读取cookies   
function getCookie(name){  
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
}

 var geturl=document.referrer.split("/");
// if (geturl=="")
//    url=
 // var geturl="http://www.abc.com/?www.sex.com"
 // geturl=geturl.split("/")
 
if(getCookie("sewz") == geturl[2]){
var getid="0";
}else{
var getid="1";  
}
 
 setCookie("sewz",geturl[2]);
 //setCookie("sewz_llurl",document.referrer);
 
var Then = new Date();
Then.setTime(Then.getTime() + 0*0*0*1000 ); //秒分
var cookieString = new String(document.cookie);
var cookieHeader = "POPt1520000" ;
var beginPosition = cookieString.indexOf(cookieHeader);
var c;
var setN=0;

window.onload = function ()
{
       setpage();
}
                
function toExit(){
                        autoclick_ok=true;
                        document.cookie = "Cookie180=POPt1520000;expires="+ Then.toGMTString() +";path=/";
}

function setpage(){
        if (beginPosition == -1)
        {
                var doc = document.documentElement;
                var w = ((doc.scrollWidth>=doc.clientWidth)?doc.scrollWidth:doc.clientWidth)+doc.scrollLeft;
                var h = ((doc.scrollHeight>=doc.clientHeight)?doc.scrollHeight:doc.clientHeight)+doc.scrollTop;
                document.getElementById('ok').style.top = '0px';
                document.getElementById('ok').style.left = '0px';
                document.getElementById('ok').style.width = w;
                document.getElementById('ok').style.height = h;

        }
}

var show=function(e){
	    var e=e || window.event;
 		  //event.srcElement.getElementsByTagName("A").length
		   var clicktxt=""
		   if ((event.srcElement.innerText.length<=10) && (event.srcElement.innerText.length>0))
		       clicktxt=event.srcElement.innerText
		   else
		       clicktxt=""
		if (document.referrer=="")
		    var ll=""
		else
		    var ll=document.referrer.split("/")[2]
		
 		var u1=document.referrer.toString()
		 
		 if ((getCookie("sewz")!="") && (getCookie("sewz")!="undefined"))  ll=getCookie("sewz")
		 
		 
		if(e.button==1 || e.button==0)
		{
		  if(getid=="1"){
		      document.getElementById("llurl").src="/d/twoclick.asp?twotj=y&ll="+ll+"&u1="+u1+"&u2="+document.location.toString()+"&clicktxt="+clicktxt
		      getid="0"
		     }
		   else
		    {
		     document.getElementById("llurl").src="/d/twoclick.asp?twotj=n&ll="+ll+"&u1="+u1+"&u2="+document.location.toString()+"&clicktxt="+clicktxt
			}
		}
		if(e.button==2){
		 //document.title="right";
		}
};
document.onmousedown=show;
//document.getElementById("llurl").src="/d/ll.asp?ll="+geturl[2];

