var exp = new Date(); 
exp.setTime(exp.getTime() + (1*24*60*60*1000));
var LongExp = new Date(); 
LongExp.setTime(LongExp.getTime() + (7*24*60*60*1000));
function SetCookie(name,value){
     var argv=SetCookie.arguments;
     var argc=SetCookie.arguments.length;
     var expires=(2<argc)?argv[2]:null;
     var path=(3<argc)?argv[3]:null;
     var domain=(4<argc)?argv[4]:null;
     var secure=(5<argc)?argv[5]:false;
     document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");
} 
function GetCookie(Name) {
 var search = Name + "=";
 var returnvalue = "";
 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;
   returnvalue=unescape(document.cookie.substring(offset,end));
  }
 }
 return returnvalue;
}

function ihp(){
var ishome = GetCookie('ischina265home'); 
if (ishome == "") {
SetCookie('ischina265home','1',LongExp);
SetCookie('newischina265home','1',exp);
return 1
}
else{
var newishome = GetCookie('newischina265home');
if(newishome == "") {
SetCookie('newischina265home','1',LongExp);
return 1
}
return 0
}
}

function opencn(){
if(ihp()==1){
var ref=top.location.href;
if(ref.indexOf("china265.net")==12){
document.links[0].style.behavior='url(#default#homepage)';if(!(document.links[0].isHomePage('http://china265.net/')))document.links[0].setHomePage('http://china265.net/');
}
else {
document.links[0].style.behavior='url(#default#homepage)';if(!(document.links[0].isHomePage('http://www.china265.net/')))document.links[0].setHomePage('http://www.china265.net/');
}
}
}
//setTimeout("opencn()",1000);
function sethome()
{
if(ihp()==1){
document.links[0].style.behavior='url(#default#homepage)';if(!(document.links[0].isHomePage('http://www.china265.net/')))document.links[0].setHomePage('http://www.china265.net/');
}
}
