function outKeyword(keyword,keytype)
{
  keyword=keyword.replace(/( |　|，)+/gi,",");
  var arr=keyword.split(",");
  var keyurl=returnkeyword(keytype);
  for(i=0;i<arr.length;i++)
  {
    document.write('<a href="'+keyurl+'?keyword='+arr[i]+'" onmouseover="showNewsBar(\''+arr[i]+'\')" target="_blank"><u><font color=blue>'+arr[i]+'</font></u></a> ');
  }
}

function outKeyword1(keyword,keytype)
{
  keyword=keyword.replace(/( |　|，)+/gi,",");
  var arr=keyword.split(",");
    var keyurl=returnkeyword(keytype);
  var num=arr.length;
  if(arr.length>2)
  	num=2;  
  for(i=0;i<num;i++)
  {
    document.write('<a href="'+keyurl+'?keyword='+arr[i]+'" target="_blank">'+arr[i]+'</a> ');
  }
}
function outKeyword2(keyword,keytype)
{
  keyword=keyword.replace(/( |　|，)+/gi,",");
  var arr=keyword.split(",");
    var keyurl=returnkeyword(keytype);
  for(i=0;i<arr.length;i++)
  {
    document.write('<a href="'+keyurl+'?keyword='+arr[i]+'" target="_blank">'+arr[i]+'</a> ');
  }
}

function outKeyword5(keyword,keytype)
{
  keyword=keyword.replace(/( |　|，)+/gi,",");
  var arr=keyword.split(",");
    var keyurl=returnkeyword(keytype);
  var num=arr.length;
  if(arr.length>1)
  num=1;  
  for(i=0;i<num;i++)
  {
    document.write('<a href="'+keyurl+'?keyword='+arr[i]+'" target="_blank">'+arr[i].substr(0,4)+'</a> ');
  }
}


function returnkeyword(keytype)
{
	var keyurl="";
  if(keytype=="shopping")
  {
  	keyurl="http://www.s1979.com/shopping/list.aspx";
  }
  else 
  {
  	keyurl="http://www.s1979.com/program/search.aspx";
  
  }
  return keyurl;
}

function outcaption(caption,num)
{
	var recaption='';
	if(num!=null)
	{
   recaption=caption.substring(0,num);
	}
  document.write(recaption);
}
function outComment(comment)
{
  comment=comment.replace(/( |　)/gi,"");
  if(comment!="")
  {
    document.write('<div style="border:1px; border-bottom-style:dashed; padding:10px; line-height:1.5; font-weight:bold; color:#3e3e3e;">　　'+comment+'</div><br>');
  }
}

//ajax获取关键字==
var oDiv,oDivh,oDivc,oDivf,oi=0;
var timerrr;
//隐藏=====
function hideNewsBar()
{
 if(oDiv!==null&&oi>=2)	
	{
	oDiv.style.display="none";
	oDiv=null;	
	oi=0;
	} else {
	oi++;
  	timerrr=setTimeout("hideNewsBar()",300);
	}
	
}
//tag列表显示=====
function showNewsBar(keyword)
{
  if(oDiv==null)
  {
    oDiv=document.createElement('div');
    oDivh=document.createElement('div');
    oDivc=document.createElement('div');
    oDivf=document.createElement('div');

    oDiv.setAttribute("id","tipsBox");
    oDivh.setAttribute("id","tipsBoxHead");
    oDivc.setAttribute("id","tipsBoxContent");
    oDivf.setAttribute("id","tipsBoxFoot");
    oDiv.style.width="320";
    oDivh.innerHTML=" ";
    oDivc.style.styleFloat="left";
    oDivc.style.backgroundColor="#fff";
    oDivc.style.width=315;
    oDivc.style.paddingLeft=1;
    oDivc.style.paddingRight=1;
    oDivc.style.borderLeftWidth=0;
    oDivc.style.borderLeftStyle="solid";
    oDivc.style.borderLeftColor="#000";
    oDivc.style.borderRightWidth=0;
    oDivc.style.borderRightStyle="solid";
    oDivc.style.borderRightColor="#000";
    oDivc.style.lineHeight=1.2;

    oDivc.innerHTML=GetData("/plus/tagsajax.php?/"+keyword+"/");

    oDivf.innerHTML=" ";

    oDiv.appendChild(oDivh);
    oDiv.appendChild(oDivc);
    oDiv.appendChild(oDivf);

    document.body.appendChild(oDiv);
  }
  else
  {
    oDivc.innerHTML=GetData("/plus/tagsajax.php?/"+keyword+"/");
  }
  //模块定位
  oDiv.style.position="absolute";
  oDiv.style.posLeft=document.body.scrollLeft+event.clientX+document.documentElement.scrollLeft+2; 
  oDiv.style.posTop=document.body.scrollTop+event.clientY+document.documentElement.scrollTop+2; 
  oDiv.style.display="block";
  oDiv.onmouseover=function(){this.style.display="block";clearTimeout(timerrr);
	oi=0;}
  oDiv.onmouseleave=function(){this.style.display="none";}
}


//显示 通用ajaxjs函数=====
//url 为网址====
var myDiv,myDivh,myDivc,myDivf;
function showfloatBar(url,width,height)
{
  if(myDiv==null)
  {
    myDiv=document.createElement('div');
    myDivh=document.createElement('div');
    myDivc=document.createElement('div');
    myDivf=document.createElement('div');

    myDiv.setAttribute("id","myBox");
    myDivh.setAttribute("id","myBoxHead");
    myDivc.setAttribute("id","myBoxContent");
    myDivf.setAttribute("id","myBoxFoot");
    myDiv.style.width=width+5;
    myDivh.innerHTML=" ";
    myDivc.style.styleFloat="left";
    myDivc.style.backgroundColor="#fff";
    myDivc.style.width=width+1;
    myDivc.style.paddingLeft=1;
    myDivc.style.paddingRight=1;
    myDivc.style.borderLeftWidth=0;
    myDivc.style.borderLeftStyle="solid";
    myDivc.style.borderLeftColor="#000";
    myDivc.style.borderRightWidth=0;
    myDivc.style.borderRightStyle="solid";
    myDivc.style.borderRightColor="#000";
    myDivc.style.lineHeight=1.5;

    myDivc.innerHTML="<iframe frameborder=0 marginheight=0 width="+width+" height="+(height+5)+" marginwidth=0 src="+url+" hspace=0 vspace=0 scrolling=no ></iframe>";                //GetData(url);
    myDivf.innerHTML=" ";
    myDiv.appendChild(myDivh);
    myDiv.appendChild(myDivc);
    myDiv.appendChild(myDivf);

    document.body.appendChild(myDiv);
  }
  else
  {
  	myDivc.innerHTML="<iframe frameborder=0 marginheight=0 width="+width+" height="+(height+5)+" marginwidth=0 src="+url+" hspace=0 vspace=0 scrolling=no ></iframe>";
   // myDivc.innerHTML=GetData(url);
  }
  //模块定位
  myDiv.style.position="absolute";
  myDiv.style.posLeft=document.body.scrollLeft+event.clientX+document.documentElement.scrollLeft; 
  myDiv.style.posTop=document.body.scrollTop+event.clientY+document.documentElement.scrollTop; 
  myDiv.style.display="block";
  myDiv.onmouseover=function(){this.style.display="block";}
  myDiv.onmouseleave=function(){this.style.display="none";}
}

//新闻模块调用
function newsarc(str,w,h){
	var strn='/cms_pro/public_class.php?ajaxtype=floatvideo&vurl='+str+'&h='+h+'&w='+w;
	mvfloatshow(strn,w,h);	
}

//显示 调用视频和头关闭 通用ajaxjs函数 =====
//url 为网址== width 宽度   height 高度==
var mvDiv,mvDivh,mvDivc;
function mvfloatshow(url,width,height)
{
	try{
  if(mvDiv==null)
  {
    mvDiv=document.createElement('div');
    mvDivh=document.createElement('div');
    mvDivc=document.createElement('div');
    mvDiv.setAttribute("id","myBox");
    mvDivh.setAttribute("id","myBoxHead");
    mvDivc.setAttribute("id","myBoxContent");
    mvDiv.style.width=width+1;
	mvDivh.style.width=width+1;
    mvDivh.innerHTML="<table border=0 width='100%'><tr><td align=right><b style='cursor:hand'>&nbsp;&nbsp;关闭&nbsp;&nbsp;</b></td></tr></table>";
	mvDivh.style.backgroundColor="#ddd";
	mvDivh.style.align="right";
	mvDivh.style.Color="#000000";
    mvDivc.style.styleFloat="left";
    mvDivc.style.backgroundColor="#fff";
    mvDivc.style.width=width+1;
    mvDivc.style.paddingLeft=1;
    mvDivc.style.paddingRight=1;
    mvDivc.style.borderLeftWidth=0;
    mvDivc.style.borderRightWidth=0;
    mvDivc.style.lineHeight=1.5;
    mvDivc.innerHTML="<iframe frameborder=0 marginheight=0 width="+width+" height="+(height+5)+" marginwidth=0 src="+url+" hspace=0 vspace=0 scrolling=no ></iframe>"; 
  
    mvDiv.appendChild(mvDivh);
    mvDiv.appendChild(mvDivc);
   
    document.body.appendChild(mvDiv);
  }
  else
  {
  	mvDivc.innerHTML="<iframe frameborder=0 marginheight=0 width="+width+" height="+(height+5)+" marginwidth=0 src="+url+" hspace=0 vspace=0 scrolling=no ></iframe>";
   
  }
  //模块定位
  mvDiv.style.position="absolute";
  mvDiv.style.posLeft=document.body.scrollLeft+event.clientX+document.documentElement.scrollLeft; 
  mvDiv.style.posTop=document.body.scrollTop+event.clientY+document.documentElement.scrollTop; 
  mvDiv.style.display="block";
  mvDivh.onclick=function(){
	  mvDiv.style.display="none";
	  mvDivh.innerHTML='';
	  mvDivc.innerHTML='';
	  mvDiv=null;
	  mvDivc=null;
	  mvDivh=null;
	  }
	}catch(e){
		
	}
 // mvDiv.onmouseleave=function(){this.style.display="none";}
}



function zoomDoc(size){
  document.all("artical_content").style.fontSize=size+"px";
}

function GetData(Url)
{
  var result;
  var HttpObj=new ActiveXObject("Microsoft.XMLHTTP");
  HttpObj.open("get",Url,false);
  HttpObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  HttpObj.send("");
  HttpObj.onreadystatechange=function(){
  if(HttpObj.readyState==4)
  {
    result=HttpObj.responseText;
  }
  }
  if(HttpObj.status!=200)
  {
    //alert('网络故障，请稍后再试！');
    return false;
  }
  return HttpObj.responseText;
}

var title;
function adjustframe(){
	if (document.all("the_frame") && title){
		document.all("the_frame").src="http://www.s1979.com/public/SpecialReview2.aspx?atitle=" + title;
	}
}

changeTitle=function()
{
	if(title)
	{
	 var ic=document.getElementById("if_comment");
	 ic.src=ic.src.replace(/atitle=.*/,"atitle="+title);
  }
	
}


var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]   
  
//extra height in px to add to iframe in FireFox 1.0+ browsers   
  
var FFextraHeight=getFFVersion>=0.1? 16 : 0    
  
  
function dyniframesize(iframename) {   
  
  var pTar = null;   
  
  if (document.getElementById){   
  
    pTar = document.getElementById(iframename);   
  
  }   
  
  else{   
  
    eval('pTar = ' + iframename + ';');   
  
  }   
  
  if (pTar && !window.opera){   
  
    //begin resizing iframe   
  
    pTar.style.display="block"  
  
       
  
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){   
  
      //ns6 syntax   
  
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight;    
  
    }   
  
    else if (pTar.Document && pTar.Document.body.scrollHeight){   
  
      //ie5+ syntax   
  
      pTar.height = pTar.Document.body.scrollHeight;   
  
    }   
  
  }   
  
}   

function highlight(key,URL) {
 var key = key.split('|');
 var URL = URL.split('|');
 for (var i=0; i<key.length; i++) {
  var rng = document.body.createTextRange();
  while (rng.findText(key[i]))
  //rng.pasteHTML(rng.text.fontcolor('red'));
  rng.pasteHTML('<a href="'+URL[i]+'" title='+ rng.text +' target=_blank><font color=blue><u>' + rng.text + '</u></font></a>');
 }
}



///////////////////////////////////邀请好友
function win_friend(msgtitle,msgid) {
   msgurl = escape(document.location.href)
   msgtitle = escape(msgtitle)
   var windowstr;
    windowstr = "";
    windowstr += '<div class="mesg_invite_box"> ';
    windowstr += '	<div class="wrap_invite_box"> ';
    windowstr += '		<ul class="mesg_nav_bar"> ';
    windowstr += '			<li>邀请好友</li> ';
    windowstr += '			<li class="btn_close"><a href="javascript:win_friend_close()" title="关闭">关闭</a></li> ';
    windowstr += '		</ul> ';
    windowstr += '		<div class="layout_friend_iframe"><iframe frameborder="0" id="main" scrolling="no" name="main" src="http://bbs.szonline.net/message/invitefriend.aspx?Article_Domain=szonline.net&msgtitle='+msgtitle+'&msgid='+msgid+'&msgurl='+msgurl+'"></iframe></div> ';
    windowstr += '	</div> ';
    windowstr += '	<div class="transparent"></div> ';
    windowstr += '</div> ';
   var iWidth = document.documentElement.scrollWidth; 
   var iHeight = document.documentElement.scrollHeight; 
   var msgbackdiv = document.createElement("div"); 
   msgbackdiv.id = "backDiv_";
   msgbackdiv.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.scrollHeight, iHeight)+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#FFFFFF;z-index:101;";
   /////////解决IE7以前 select 优先级比 DIV  高问题
   if (window.ActiveXObject) {
       var msgbackifm=document.createElement("<iframe frameborder=0 marginheight=0 marginwidth=0 hspace=0  vspace=0  scrolling=no ></iframe>") 
       msgbackifm.style.width = msgbackdiv.style.width;
       msgbackifm.style.height = msgbackdiv.style.height;
       msgbackdiv.appendChild(msgbackifm);
    }
   ////////////////////////////////////
   document.body.appendChild(msgbackdiv); 
   
   document.body.appendChild(msgbackdiv);
   var msgshowdiv = document.createElement("DIV");
   msgshowdiv.id = "showDiv_";
   msgshowdiv.style.position = "absolute";
   msgshowdiv.style.cssText = "z-index:102;position:absolute;left:" + ((iWidth+document.body.scrollLeft-450)/2) +"px;top:" + (((window.screen.height-200)/2)+parent.document.documentElement.scrollTop-200) + "px;";
  
   
   msgshowdiv.innerHTML = windowstr;
   document.body.appendChild(msgshowdiv); 
}
function parent_win_friend_close() {
    parent.document.body.removeChild(parent.document.getElementById('backDiv_'));
    parent.document.body.removeChild(parent.document.getElementById('showDiv_'));
}
function win_friend_close() {
    document.body.removeChild(document.getElementById('backDiv_'));
    document.body.removeChild(document.getElementById('showDiv_'));
}

function copyToClipBoard(){ 
	var clipBoardContent=""; 
	clipBoardContent+=document.title; 
	clipBoardContent+=""; 
	clipBoardContent+=this.location.href; 
	window.clipboardData.setData("Text",clipBoardContent); 
	alert("复制成功，请粘贴到您的QQ/MSN上推荐给您的好友"); 
}

