function DrawImage(ImgD,width_s,height_s)
{ 
  var image=new Image(); 
  image.src=ImgD.src; 
 	 if(image.width>0 && image.height>0)
	 { 
		  flag=true; 
 		  if(image.width/image.height>=width_s/height_s)
		  { 

			  	ImgD.width=width_s; 
				ImgD.height=(image.height*width_s)/image.width; 

 		  } 
 		  else
		  { 
			  	ImgD.height=height_s; 
  				ImgD.width=(image.width*height_s)/image.height; 
          } 
	 } 

 }
 //scroll
 function startScroll(lh,speed,delay,myobject){
 var t3; //t3 = Interva ID
 var isMouseOver=false;
 var scrollFrame=document.getElementById(myobject);
 scrollFrame.innerHTML+=scrollFrame.innerHTML;
 scrollFrame.onmouseover=function(){isMouseOver=true}
 scrollFrame.onmouseout=function(){isMouseOver=false}
 scrollFrame.scrollTop = 0;
 
 function start3(){
      t3=setInterval(scrolling3,speed);
      if(!isMouseOver) scrollFrame.scrollTop +=1;
  }// start3()
  
  function initial(){
    scrollFrame.scrollTop = 1;
  }
  
 function scrolling3(){
      if(scrollFrame.scrollTop%lh!=0){
          scrollFrame.scrollTop +=1;
          if(scrollFrame.scrollTop>=scrollFrame.scrollHeight/2){ setTimeout(initial,delay); }
      }
      else
      {
          clearInterval(t3);
          setTimeout(start3,delay);
      }//if
  }//scrolling3
  
setTimeout(start3,delay);
}

//SBC-DBC case

function DBC2SBC(str) {
var i;
var result='';
if (str.length<=0) {alert('String parameter error');return false;}
    for(i=0;i<str.length;i++)
    { str1=str.charCodeAt(i);
      if(str1<125)
      result+=String.fromCharCode(str.charCodeAt(i)+65248);
	  else
	  result+=str.charAt(i);
    }
return result;
}

function CreatDiv(name,left,top,width,height,isVisible,zIndex,content)
{
	var NewDiv=document.createElement("div");
	NewDiv.unselectable="on";
	NewDiv.id=name;
	NewDiv.style.position="absolute";
	NewDiv.style.top=top;
	NewDiv.style.left=left;
	NewDiv.style.zIndex=zIndex;
	NewDiv.style.width=width;
	NewDiv.style.height=height;
	NewDiv.onmouseover="javascript:MouseOver=true;";
	NewDiv.onmouseout="javascript:MouseOver=false;";
	NewDiv.style.visibility=(isVisible)?'visible':'hidden';
	NewDiv.style.border="#999999 1px solid";
	NewDiv.innerHTML=content;
	return NewDiv
};
function ShowLargePic(ImgD)
{
  
  var image=new Image();
  var name,left,top,width,height,isVisble,zIndex,content;
  if(document.getElementById("largeImg")!=null)
  {
   var div_del=document.getElementById("largeImg")
   div_del.parentNode.removeChild(div_del);
  }
  var divP=ImgD.parentElement.parentElement;
  name="largeImg";
  left=0;
  top=0;
  while(divP=divP.offsetParent)
  {
   left+=divP.offsetLeft;
   top+=divP.offsetTop;
  }
  image.src=ImgD.src;
  width=image.width;
  height=image.height;
  isVisible=false;
  zIndex=100;
  content="<img id='bigImg' src="+image.src+" height="+height+" width="+width+" onmouseout='this.parentElement.style.visibility=\"hidden\"' \/>";
  var largeImgDiv=CreatDiv(name,left,top,width,height,isVisible,zIndex,content);
  ImgD.parentElement.parentElement.appendChild(largeImgDiv);
  
  document.getElementById("largeImg").style.visibility="visible";
}

  function   GetCookie   (name)   {   
      var   arg   =   name   +   "=";   
      var   alen   =   arg.length;   
      var   clen   =   document.cookie.length;   
      var   i   =   0;   
      while   (i   <   clen)   {   
          var   j   =   i   +   alen;   
          if   (document.cookie.substring(i,   j)   ==   arg)   
              return   getCookieVal   (j);   
          i   =   document.cookie.indexOf("   ",   i)   +   1;   
          if   (i   ==   0)   break;     
      }   
      return   null;   
  }   
    
  function   getCookieVal   (offset)   {   
      var   endstr   =   document.cookie.indexOf   (";",   offset);   
      if   (endstr   ==   -1)   
          endstr   =   document.cookie.length;   
      return   unescape(document.cookie.substring(offset,   endstr));   
  }   
  function   SetCookie   (name,   value)   {   
      document.cookie   =   name   +   "="   +   escape   (value)   
  }   
    
  function   getScroll()   
  {   
  document.body.scrollTop=GetCookie("scrollTop");   
  document.body.scrollLeft=GetCookie("scrollLeft");   
    
  }     
  function   setScroll(){   
  SetCookie("scrollTop",document.body.scrollTop);   
  SetCookie("scrollLeft",document.body.scrollLeft);   
  }   
