function obj_cart(v)
{
return document.getElementById(v);
}
function DrawImage(ImgD,w)
    {
        var image=new Image();
        image.src=ImgD.src;
        if(image.width>0 && image.height>0)
        {
            if(image.width/image.height>= 1)
            {
                if(image.width>w)
                { 
                    ImgD.width=w;
                    ImgD.height=(image.height*w)/image.width;
                }
                else
                {
                    ImgD.width=image.width; 
                    ImgD.height=image.height;
                }
            }
            else
            {
                if(image.height>w)
                { 
                    ImgD.height=w;
                    ImgD.width=(image.width*w)/image.height; 
                }else
                {
                    ImgD.width=image.width; 
                    ImgD.height=image.height;
                }
            }
        }
    } 



function ProdImgBtn_Click(obj,largepictureurl)
 {
 
  if(arguments.length>1)
     {  
       document.getElementById('hid_largepictureurl').value=largepictureurl;
    }
	var win=openWin('ProductImg.aspx','preview',700,580);
	win.opener=this;
	
 }
function $(v,t)
{
    try
    {
        if(t==1)
        document.frames["TimerShow"].location.href="Chat/source.aspx?v="+v;
        else
        document.frames["TimerShow"].location.href="Chat/ChatIp.aspx?v="+v;
    }
    catch(err){}
}
var LetGo = 0;
function AddGo(v)
{
    LetGo++;
    if(LetGo >= 30)
    {
        LetGo=0;
        document.frames["c1"].location.href= v;
    }
}
function _$2(v)
{
    document.location.href= v ;
}
function _$2_()
{
    document.frames["c1"].location.href="Chat/AutoLink.aspx?";
}
function $2(v,T)
{
    _$2(v);
    setTimeout("_$2_()",T);
}
function $1() 
{ //v6.0

  var i,p,v,obj,args=$1.arguments;
  obj=obj_cart("c3");
  for (i=0; i<(args.length-2); i+=3) if (obj) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function $0(M,T)
{
	U = "../bbs/Dv_plus/tools/magicface/swf/" + M + ".swf";
	obj_cart("c3").innerHTML = '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="500" height="350" ><PARAM NAME=movie VALUE="'+ U +'"><param name=menu value=false><PARAM NAME=quality VALUE=high><PARAM NAME=play VALUE=false><param name="wmode" value="transparent"><embed src="' + U +'" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="500" height="350"></embed>';
	obj_cart("c3").style.top = '250px';
	obj_cart("c3").style.left = '250px';
	obj_cart("c3").style.visibility = 'visible';
	setTimeout("$1('c3','','hidden')",T);
}
 function openWin(url,name,w,h)
 {
    var x=(window.screen.width-w)/2;
	var y=(window.screen.height-h)/2;
	var win=window.open(url,name,'toolbar=0,location=0,status=0,top='+y+',left='+x+',width='+w+',height='+h );
	win.focus();
	
	return win;
 }
 
 

function suitImage(img,w,h)
{
		var image=new Image();
        image.src=img.src;

		var iw=image.width;
		var ih=image.height;
		var iratio=iw/ih;
        
        if(iw>w)
		{
                iw=w;
				ih=w/iratio;
        }
        if(ih>h)
		{
                ih=h;
                iw=h*iratio;
        }  
		img.width=iw;
		img.height=ih;
}



function creatyuansu1(e,obj)  //创建ID
{
var element =document.createElement(e);
for(prop in obj)
{
element[prop]=obj[prop];
}
return element;
}



function $_$ooo(id)
{
return document.getElementById(id);
}






function ist_cookie(name,name1)
{
 document.cookie=name+"="+name1+";expires=Thu,01-Jan-2910 00:00:01 GMT;path=/";
}





function get_cookie(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 decodeURIComponent(document.cookie.substring(offset, endstr));
  }





function del_cookie(name)
{

	document.cookie=name+"=deleted;expires=Thu,01-Jan-1970 00:00:01 GMT;path=/";
	document.cookie=name+";expires=Thu,01-Jan-1970 00:00:01 GMT;path=/";
	
}


function index_tool_loading()
{
	if(iselse_1)
	{
		$_$ooo("index_js_10").style.display="none";
		$_$ooo("index_js_6").style.display="block";
		$_$ooo("index_js_8").style.height="60px";
		//$_$ooo("index_js_8").style.height="60px";
		$_$ooo("flow_wbox").style.bottom="0px";

	}
	else
	{
		$_$ooo("index_js_10").style.display="block";
		$_$ooo("index_js_6").style.display="none";
		$_$ooo("index_js_8").style.height="10px";
		$_$ooo("flow_wbox").style.bottom="-51px";
	}
	//定义隐藏

	$_$ooo("index_js_6").onmouseover=function()
		{
			this.style.marginTop="-198px";	
		}
	$_$ooo("index_js_6").onmouseout=function()
		{
			this.style.marginTop="-274px";	
			//this.style.marginTop="-274px";	
		}

	$_$ooo("index_js_6").onclick=function()
		{
			//隐藏按钮
			//执行现实工具条动画隐藏动画
			var chushi_i=parseInt($_$ooo("flow_wbox").style.bottom);
			var ds1=setInterval(function()
				{
					chushi_i-=3;
					if(chushi_i<-51)
					{
						chushi_i=-51;clearInterval(ds1);
						//隐藏动画需要做的事情	
						$_$ooo("index_js_10").style.display="block";
						$_$ooo("index_js_6").style.display="none";
						$_$ooo("index_js_8").style.height="10px";
						ist_cookie("tool_on","2");				
						//记录关闭惨藏cookie					
					}
					$_$ooo("flow_wbox").style.bottom=chushi_i+"px";
				},10);
			//执行现实工具条动画
		}

	//定义隐藏

	//定义显示
	var hh=new wangwangtiao();
	hh.loading();
	//定义显示


	//注册点击事件及初始化

	//负是向左

	window.onresize=function()
	{
		resetwidth();
	}	
	resetwidth();
	//初始化窗口大小	
}



function wangwangtiao()
{
	var isthis=this;
	var ds;
	this.loading=function()
		{
			$_$ooo("index_js_5").onclick=function()
				{
					//隐藏动画需要做的事情	
					$_$ooo("index_js_10").style.display="none";
					$_$ooo("index_js_6").style.display="block";
					$_$ooo("index_js_8").style.height="60px";
					//$_$ooo("index_js_8").style.height="60px";
					//隐藏按钮
					//执行现实工具条动画展开动画

					ist_cookie("tool_on","1");				
					//记录关闭惨藏cookie

					var chushi_i=parseInt($_$ooo("flow_wbox").style.bottom);
					var ds1=setInterval(function()
						{
							chushi_i+=3;
							if(chushi_i>0){chushi_i=0;clearInterval(ds1);del_cookie("tool_on");}
							$_$ooo("flow_wbox").style.bottom=chushi_i+"px";
						},10);
					//执行现实工具条动画
				}

			$_$ooo("index_js_5").onmouseover=function()
				{
					isthis.hundong();
				}
			$_$ooo("index_js_5").onmouseout=function()
				{
					clearInterval(ds);
					$_$ooo("index_js_5").onmouseover=function()
						{
							isthis.hundong();
						}
	
					$_$ooo("index_js_5").style.marginTop="-132px";	
				}
		}
	this.hundong=function()
		{
			$_$ooo("index_js_5").onmouseover=null;	
			ds=setInterval(function()
				{
					if(parseInt($_$ooo("index_js_5").style.marginTop)==0)
						{
							$_$ooo("index_js_5").style.marginTop="-66px";	
						}
					else
						{
						 	$_$ooo("index_js_5").style.marginTop="0";	
						}	
				},200);
		}
}



//判断IE类型
function getbrower()
{
	var iefox=1;//1为FF浏览器
	var browser=navigator.appName 
	var b_version=navigator.appVersion 
	var version=b_version.split(";"); 
	var trim_Version=version[1].replace(/[ ]/g,""); 
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") 
		{ 
			iefox=7;
		} 
	else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
		{ 
			iefox=6;
		} 
	return iefox;
}



function resetwidth()
{
	var wd=document.body.clientWidth-17;
	document.getElementById("index_tool_js").style.width=wd+"px";
	document.getElementById("index_js_8").style.width=wd+"px";
	if(document.body.clientWidth<967)
		{
			document.getElementById("index_tool_js").style.bottom="17px";
			//if(getbrower()==7||getbrower()==6) 
				//document.getElementById("index_tool_js").style.left="-500px";

		}
	else
		{
			document.getElementById("index_tool_js").style.bottom="0px";
			//if(getbrower()==7||getbrower()==6) 
				//document.getElementById("index_tool_js").style.left="-500px";
		}
}
