var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
function getElement(aID)
{
  return (document.getElementById) ? document.getElementById(aID): document.all[aID];
}
var http_request=false;
function makeRequest(url){
 http_request=false;
 if(window.XMLHttpRequest){//Mozilla,Safari,...
 http_request=new XMLHttpRequest();
 if(http_request.overrideMimeType){
 http_request.overrideMimeType('text/xml');
 }
 }else if(window.ActiveXObject){//IE
 try{
 http_request=new ActiveXObject("Msxml2.XMLHTTP");
 }catch(e){
 try{
 http_request=new ActiveXObject("Microsoft.XMLHTTP");
 }catch(e){}
 }
 }
 if(!http_request){
 alert('Giving up:(Cannot create an XMLHTTP instance)');
 return false;
 }
return http_request;
 }
 var ajccache=new Object();
 
function splitStr(str,i){
var restr = str.split("_");
return restr[i];
}
 
 function getvote(id){ 
	alert("活动结束,谢谢参与!");
/*
 var spanid = "vote_"+id;
 var url = "http://tech.163.com/itvote1/"+id+"/"+timenow.getTime();
 var contentele = getElement(spanid);
 var num = parseInt(contentele.innerHTML)+1;
 var xhttp=makeRequest();
			xhttp.onreadystatechange=function(){
				if(xhttp.readyState == 4 && (xhttp.status==200 || window.location.href.indexOf("http")==-1))
				{				
					   var str = splitStr(xhttp.responseText,0);
					   if(str==0)
					   {
					     alert("今天您已经投过票！");
					   }else{
					     alert("投票成功！");		
						 contentele.innerHTML=num;		
					   }
					   				  
				}
			}
		xhttp.open("GET",url,true);
		xhttp.send(null);	
*/	
}
function getvote1(id){ 
 var spanid = "vote_"+id;
 var url = "http://tech.163.com/itvote2/"+id;
 var contentele = getElement(spanid);
 var xhttp=makeRequest();
			xhttp.onreadystatechange=function(){
				if(xhttp.readyState == 4 && (xhttp.status==200 || window.location.href.indexOf("http")==-1))
				{				
						 contentele.innerHTML=xhttp.responseText; 									   				  
				}
			}
		xhttp.open("GET",url,true);
		xhttp.send(null);		
}
 
 
 
function copyto() {   
   var url=document.location.href;   
   var clipBoardContent=''; 
   clipBoardContent+=url;
    
     if(window.clipboardData) {    
             window.clipboardData.clearData();    
             window.clipboardData.setData("Text", clipBoardContent);    
     } else if(navigator.userAgent.indexOf("Opera") != -1) {    
          window.location = clipBoardContent;    
     } else if (window.netscape) {    
          try {    
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
          } catch (e) {    
               alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");    
          }    
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);    
          if (!clip)    
               return;    
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);    
          if (!trans)    
               return;    
          trans.addDataFlavor('text/unicode');    
          var str = new Object();    
          var len = new Object();    
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);    
          var copytext = clipBoardContent;    
          str.data = copytext;    
          trans.setTransferData("text/unicode",str,copytext.length*2);    
          var clipid = Components.interfaces.nsIClipboard;    
          if (!clip)    
               return false;    
          clip.setData(trans,null,clipid.kGlobalClipboard);    
         
     }  
	   alert("你已复制链接，请粘贴到泡泡/MSN等发给好友!");     
}