﻿/*汇集多js在一个文件，可减少http请求次数，提高效率。gg广告和搜索*/
function g(id,wi,hi,pub)
{ 
document.writeln("<script type=\"text\/javascript\"><!--");    
document.writeln("google_ad_client = \""+ pub +"\";");    
document.writeln("google_ad_slot = \""+ id +"\";");    
document.writeln("google_ad_width = "+ wi +";");    
document.writeln("google_ad_height ="+ hi +";");    
document.writeln("\/\/-->");    
document.writeln("<\/script>");    
document.writeln("<script type=\"text\/javascript\"");    
document.writeln("src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">");    
document.writeln("<\/script>"); 
}
function g_search(um,k_w,k_h,id,q_h,q_w,pub)
{ 
document.writeln("<script type=\"text\/javascript\"><!--"); 
document.writeln("google_ad_client = \""+ pub +"\";"); 
document.writeln("google_ad_format = \"js_sdo\";"); 
document.writeln("google_cts_mode =\"rs\";"); 
document.writeln("google_num_cts = \""+ um +"\";"); 
document.writeln("google_searchbox_width = "+ k_w +";"); 
document.writeln("google_searchbox_height = "+ k_h +";"); 
document.writeln("google_link_target = 2;"); 
document.writeln("google_ad_channel = \""+ id +"\";"); 
document.writeln("google_logo_pos = \"left\";"); 
document.writeln("google_rs_pos = \"below\";"); 
document.writeln("google_ad_height = "+ q_h +";"); 
document.writeln("google_ad_width = "+ q_w +";"); 
document.writeln("\/\/-->"); 
document.writeln("<\/script>"); 
document.writeln("<script type=\"text\/javascript\"");  
document.writeln("src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_sdo.js\">"); 
document.writeln("<\/script>"); 
}
/*统计代码*/
function yh(id)
{ 
document.writeln("<script type=\"text\/javascript\" src=\"http:\/\/js.tongji.linezing.com\/"+ id +"\/tongji.js\"><\/script>");
document.writeln("<noscript><a  rel=\"nofollow\"  href=\"http:\/\/www.linezing.com\"><img src=\"http:\/\/img.tongji.linezing.com\/"+ id +"\/tongji.php\"\/><\/a><\/noscript>");
}
/*问答投票js*/  
function CreateAjax()
 {
    var XMLHttp;
    try
    {
        XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");   
    }
    catch(e)
    {
        try
        {
            XMLHttp = new XMLHttpRequest();     
        }
        catch(e)
        {
            XMLHttp = false;        
        }
    }
    return XMLHttp;     
 } 
function Dig(id,pj,up)
{
	_xmlhttp = CreateAjax();
	var url = '/02ad/toupiao_save.asp?id='+id+'&pj='+pj+'&up='+up+'&n='+Math.random()+'';		
	if(_xmlhttp)    
    {
        var content = document.getElementById("dig"+id);      
		var dig = document.getElementById(id);					
        _xmlhttp.open('GET',url,true);
        _xmlhttp.onreadystatechange=function()
        {
            if(_xmlhttp.readyState == 4)        
            {
                if(_xmlhttp.status == 200)      
                {
                    var ResponseText = unescape(_xmlhttp.responseText);			
					var r=ResponseText.split(",");								
                    if(r[0] == "Dig" )   
                    {
                        //alert("您已对当前问答投过票了,不能重复投票！");
                        content.innerHTML='<font color="#FF0000">OK,Thank you very much!</font>';
                        dig.innerHTML='[' + r[1] +']';
                    }
					
                    else if(ResponseText == "NoData")
					{
						alert("参数错误！");	
					}
		    else
                    {
                                                content.innerHTML='<font color="#FF0000">OK,Thank you very much!</font>';
			                        dig.innerHTML='[' + ResponseText + ']';
						//alert("投票成功");						
						//content.innerHTML='<a href="news.asp?id=' + id + '">查看</a>';

                    }
                }
                else    
                {
                    alert("服务器返回错误！");
                    //top.location.href='../';
                }
            }
            else    
            {
                dig.innerHTML='<img src="/05images/Loading.gif">';
            }
        }
        _xmlhttp.send(null);  
    }
    else    
    {
        alert("您的浏览器不支持或未启用 XMLHttp!");
    }
}
/*问答投票*/ 
function copyToClipBoard(Language)
{ 
  var clipBoardContent=""; 
  clipBoardContent+=document.title; 
  clipBoardContent+="  "; 
  clipBoardContent+=this.location.href; 
  window.clipboardData.setData("Text",clipBoardContent); 
  if(Language == "en")
    {alert(" Copy the URL successfully. \n\n Please paste it into your Facebook / Twitter / Blog / MSN send to friends."); }
  else
    {alert("复制网址成功!\n\n可以直接粘贴到你的博客/QQ/MSN/email/上推荐给好友啦"); }  
} 
