﻿function getURL(url,target){
  if(target){
	  target=target.toLowerCase();
	  if      (target == '_blank') window.open(url);
	  else if (target == '_top'   ) top.location.href=url;
	  else if (target == '_parent') parent.location.href=url;
	  else{
		 try{eval("top.$('"+target+"')").src=url;}catch(e){document.location.href=url;}
	  }
  }else{
     document.location.href=url;
  }
}

function getXml(url,postData,method){
  var xmlHttp;
  if(window.ActiveXObject)         xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else if (window.XMLHttpRequest)  xmlHttp = new XMLHttpRequest();
  
  method = method ? method : 'Get';
  
  if(method.toUpperCase()=="GET") url=url+"?"+postData; 
  xmlHttp.open(method,url,false);
  xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
  xmlHttp.send(postData);
  rtn=xmlHttp.responseXML;
  xmlHttp=null;
  return rtn;
}

function popup(src,w,h){
  return window.open(src,'','width='+w+',height='+h+',scrollbars=yes');
}

function SC_Favorite(title,url,desc){ 
  if((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){ 
    window.sidebar.addPanel(title,url,desc); 
  }else{ 
    window.external.AddFavorite(url,title); 
  } 
}

//调用方法：<img onload="showPng(this"...
function showPng(img){ 
   var str=String(navigator.appVersion);
	if(str.indexOf("MSIE 6")==-1) return;
   var SC_w = img.width ;
   var SC_h = img.height;
   var imgName = img.src.toUpperCase() 
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){  
      img.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+img.src+", sizingmethod=scale);"  
      img.src="js/watermark.gif"//为1px*1px的透明gif图片 
      img.width=SC_w; 
      img.height=SC_h;
	  
   }
}