function overColor(Obj,str)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className=str
		Obj.bgColor="";  // Js for mouse move over
	}
}

function outColor(Obj,str)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className=str;
		Obj.bgColor="";
	}
}    // js for mouse move out

function getDays(){
	var enabled = 0; today = new Date(); 
	var day; var date; 
	if(today.getDay()==0) day = "星期日" 
	if(today.getDay()==1) day = "星期一" 
	if(today.getDay()==2) day = "星期二" 
	if(today.getDay()==3) day = "星期三" 
	if(today.getDay()==4) day = "星期四" 
	if(today.getDay()==5) day = "星期五" 
	if(today.getDay()==6) day = "星期六" 
	document.fgColor = "000000"; 
	date = (today.getMonth() + 1 ) + "月" + today.getDate() + "日&nbsp;" + day +""; 
	document.write(date);	
}

function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
}   // js for select all

function openm(Url,w,h,l,t,mname){
	window.open(Url,mname,'toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+ w +',height='+ h +'+,left='+ l +',top='+ t +'')
}  //  js for pop window

function setTab(m,n){
 var tli=document.getElementById("menu"+m).getElementsByTagName("li");
 var mli=document.getElementById("main"+m).getElementsByTagName("ul");
 for(i=0;i<mli.length;i++){
  tli[i].className=i==n?"hover":"";
  mli[i].style.display=i==n?"block":"none";
 }
}  //menu 选项卡

function getAjax(sUrl)
{
    var s = document.createElement('script');
    s.setAttribute('src', sUrl);
		//document.write(sUrl)
    document.body.appendChild(s);
    return;
}


function getnewajax(url,poststr,content,picid){
$.ajax({
 error:function(){$(content).html("<div style='color:red'>　内部错误,程序中止!</div>");},
 //beforeSend:function(){"$p_4".show();},
 //complete: function(){"$p_4".hide();},
 type: "POST",
 url: url,
 data: poststr,
 cache:false,
 dataType: "html",
 success: function(html){$(content).html(html);
 try{tb_init('#'+ content +' a.thickbox')}catch(err){};}
 });
}



function jump(secs,url)
{
for(i=1;i<=secs;i++) { window.setTimeout("update("+ secs +"," + i + ",'"+ url +"')", i * 1000);} 
}

function hide2show(id){
if($(id).css("display")=="none")   
{$(id).animate({height: 'toggle', opacity: 'toggle'}, "slow"); }else{$(id).animate({height: 'toggle', opacity: 'toggle'}, "slow");return false} 
}

function update(secs,num,url)
{ 
if(num == secs) {self.location.href=url;} 
}


function heartBeat(){ 
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
//alert(diffY);
percent=.1*(diffY-lastScrollY); 
if(percent>0)percent=Math.ceil(percent); 
else percent=Math.floor(percent); 
document.getElementById("lovexin12").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent; 
//alert(lastScrollY);
}

function leftcus(){
lastScrollY=0;
suspendcode12="<DIV id=\"lovexin12\" style='left:1px;POSITION:absolute;TOP:120px;cursor:hand' onclick=openm('http://chat.53kf.com/company.php?arg=xinghaijiaqi&style=1',706,476,100,100,'chat')><img src='/i/onlineim.gif'></div>"
suspendcode14="<DIV id=\"lovexin14\" style='right:0px;POSITION:absolute;TOP:120px;'><a href='/topic/onlinim/' target='_blank'><img src='/i/onlineqq.gif' border=0></a></div>"
document.write(suspendcode12); 
document.write(suspendcode14); 
window.setInterval("heartBeat()",1);
}

function getCookie2(sName) {
  var aCookie = document.cookie.split("; ");
  for (var j=0; j < aCookie.length; j++){
var aCrumb = aCookie[j].split("=");
if (escape(sName) == aCrumb[0])
  return unescape(aCrumb[1]);
  }
  return null;
}

function setCookie2(sName,sValue,expireHours) {
var cookieString = sName + "=" + escape(sValue);
//;判断是否设置过期时间
if (expireHours>0) {
 var date = new Date();
 date.setTime(date.getTime + expireHours * 3600 * 1000);
 cookieString = cookieString + "; expire=" + date.toGMTString();
}
document.cookie = cookieString;
}

var referr=document.referrer;
var now = new Date(); 
var expiredTime = now.setFullYear(now.getFullYear() + 1); // 一年后
  setCookie2('refer',getCookie2('refer')+'\n'+referr,expiredTime); 