

var BIT=2;
var oldData=0;

String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.ltrim = function(){return this.replace(/(^\s*)/g, "");}
String.prototype.rtrim = function(){return this.replace(/(\s*$)/g, "");}


function trim(str) {
  var i;
  for (i=str.length-1; i>=0 && (str.charAt(i)==' ' || str.charAt(i)=='　'); i--);
  if (i != str.length-1) str=str.slice(0,i+1);
  for (i=0; i<str.length && (str.charAt(i)==' ' || str.charAt(i)=='　'); i++);
  if (i != 0) str = str.slice(i,str.length);
  return str;
}

function Round(Num , Bit) 
{ 
   digit = Math.round(Num * Math.pow (10 , Bit)) / Math.pow(10 , Bit);
	 if(String(digit).indexOf(".")==-1){
		 strZero = "0";
		 for(i=1;i<Bit;i++){
			 strZero = strZero +"0";
		 }
		 digit =digit+"."+strZero;
	 } else {
		 inde = String(digit).indexOf(".");
		 strDigit = String(digit).substring(inde,String(digit).length);
		 len = strDigit.length-1;
		 if(len<Bit){
		   strZero= "0";
		   for(i=1;i<Bit-len;i++){
				 strZero = strZero + "0";
			 }
			 digit = digit + strZero;
		 }
	 }
	 return digit;
}      
// WinOpen
    function adListOnClick(strTargetId)
    {
      var strTargetId, obj_targetElement;
      obj_targetElement = document.all(strTargetId);
      if (obj_targetElement.style.display == "none")
      { 
         obj_targetElement.style.display = "";
         event.srcElement.title='Hide summary information';
      }
      else
      { 
         obj_targetElement.style.display = "none";
         event.srcElement .title='Toggle summary information';
      }
    }
function winOpen(url,sWidth,sHeight,sName) {
  if (sWidth == null ) sWidth  = screen.availWidth;
  if (sHeight == null) sHeight = screen.availHeight;
  if (sName  ==  null || sName=='undefined') sName   = "_blank";
  t = (screen.availHeight-sHeight-27) / 2 ;
  l = (screen.availWidth-sWidth) / 2 ;

  if (parseInt(sWidth) > screen.availWidth || sWidth == "full") {
    sWidth = screen.availWidth;
    l = 0
  }
  if (parseInt(sHeight) > screen.availHeight || sHeight == "full") {
    sHeight = screen.availHeight;
    t = 0;
  }
   return window.open(url,sName,"status=yes,width=" + sWidth + ",height=" + sHeight + ",top=" + t + ",left=" + l +",titlebar=no,status=no,scrollbars =yes,toolbar=no,menuar=no,location=no,resizable=yes,z-lock=yes");
   //window.showModalDialog
   //return window.showModalDialog(url,sName,"status=yes,width=" + sWidth + ",height=" + sHeight + ",top=" + t + ",left=" + l +",titlebar=no,status=no,scrollbars =yes,toolbar=no,menuar=no,location=no,resizable=yes,z-lock=yes");
   //return window.showModalDialog(url,sName,"status=yes,width=" + sWidth + ",height=" + sHeight + ",top=" + t + ",left=" + l +",titlebar=no,status=no,scrollbars =yes,toolbar=no,menuar=no,location=no,resizable=yes");
}

function nextFocus(next){
    var key=window.event.keyCode;
	if(key==13){
       var obj=document.all.item(next);
	   if(isNaN(obj.length)){
	     obj.focus();
	   }else{
         obj[0].focus();
       }
    }
}

function DrawImage(ImgD,iwidth,iheight){
	var flag=false;
    var image=new Image();
    image.src=ImgD.src;
    if(image.width<=iwidth && image.height<=iheight)return;

    flag=true;
    if(image.width/image.height>= iwidth/iheight){
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
    }else{
    	ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        
    }
   
} 

function DrawImage2(ImgD,iwidth,iheight){
	var flag=false;
    var image=new Image();
    image.src=ImgD.src;
    if(image.width<=iwidth && image.height<=iheight)return;

    flag=true;
    if(image.width/image.height>= iwidth/iheight){
    	ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;    
        
    }else{
    	 ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        
    }
   
} 

/**
* 取出静态网页的参数值
*/
function getParameter(pName){
	var url = window.location.search.substr(1);
	if(url.length > 0) {
		var ar = url.split(/[&=]/);
		for(i=0;i<ar.length;i+=2) {
			if(ar[i]==pName) return ar[i+1];
		}
	}
}

/*
function DrawImage(ImgD,iwidth,iheight){
	var flag=false;
    //??(??,?????,?????)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"?"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"?"+image.height;
        }
    }
} */


function loadBrandAD(){
	var content2="<h1></h1>";  
  content2+="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"192\" height=\"198\">";
	content2+="<param name=\"movie\" value=\"flash/pinpai-ind.swf\" />";
	content2+="<param name=\"quality\" value=\"high\" />";
	content2+="<embed src=\"flash/pinpai-ind.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"192\" height=\"198\"></embed>";
	content2+="</object>";
	var obj=document.getElementById("rightBrand");
	if(obj!=null)obj.innerHTML=content2;
}
 


