﻿function createFm(id,src)
{
   var obj = document.getElementById(id);
   var fm = document.createElement("iframe");
   fm.setAttribute("allowtransparency",true);
   fm.setAttribute("frameBorder",0);
   fm.setAttribute("scrolling","no");
   fm.setAttribute("id",myFrame);
   fm.setAttribute("src",src);
   obj.appendChild(fm);
}


function ShowDiv1(id,num,sid,class1,class2,j1,j2)
{
   var obj = document.getElementById(j2+id);
   var sidobj = document.getElementById(j1+sid);
   for(i=1;i<=num;i++)
   {
       var hidobj=document.getElementById(j2+i);
	   var Mobj = document.getElementById(j1+i);
       hidobj.style.display='none';
	   Mobj.className=class1;
	   
    }
    obj.style.display='';
	sidobj.className=class2;
}


function ShowDiv(num,sid,class1,class2,j1)
{

   var sidobj = document.getElementById(j1+sid);
   for(i=1;i<=num;i++)
   {
	   var Mobj = document.getElementById(j1+i);
	   Mobj.className=class1;
	   
    }
	sidobj.className=class2;
}


function GetRefreshBg(id,s,count)
{
    var obj = document.getElementById(s+id);
    for(i=1;i<=count;i++)
    {
       document.getElementById(s+i).className='Hide';
    }
    obj.className='Show';
}

   
function DrawImage(ImgD,FitWidth,FitHeight) 
{ 
var image=new Image(); 
image.src=ImgD.src; 
if(image.width>0 && image.height>0) 
{ 
if(image.width/image.height>= FitWidth/FitHeight) 
{ 
if(image.width>FitWidth) 
{ 
ImgD.width=FitWidth; 
ImgD.height=(image.height*FitWidth)/image.width; 
} 
else 
{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
else 
{ 
if(image.height>FitHeight) 
{ 
ImgD.height=FitHeight; 
ImgD.width=(image.width*FitHeight)/image.height; 
} 
else 
{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
} 
} 
} 



//让iframe自动适应高度
function SetWinHeight(obj)
{
 var win=obj;
 if (document.getElementById)
 {
  if (win && !window.opera)
  {
   if (win.contentDocument && win.contentDocument.body.offsetHeight)
    win.height = win.contentDocument.body.offsetHeight;
   else if(win.Document && win.Document.body.scrollHeight)
    win.height = win.Document.body.scrollHeight;
  }
 }
}


function SubmitSearch()
{
   var title = escape(document.getElementById("SearchInput").value);
   window.location="http://shop.topyoo.net/News/NewsSearch.aspx?SearcTitle=" + title;
}


function copyToClipBoard(values) 
{ 
window.clipboardData.setData("Text",values); 
alert("你已复制链接，请粘贴到POPO/MSN/QQ等发给好友!"); 
} 



