// Shrink Img

function Img(im)
{
	ImgCls.Obj = ( im && typeof im == 'object' ) ? im : document.getElementById(im) ;
	return ImgCls ;
	}
	var ImgCls =
	{
	Obj : null ,

	Resize : function ( nWidth , nHeight )
	{
		var w , h , p1 , p2 ;
		p1 = nWidth / nHeight ;
		p2 = ImgCls.Obj.width / ImgCls.Obj.height ;

		w = 0 ; h = 0 ;
		if( p1 < p2 )
		{
			w = nWidth ;
			h = nWidth * ( 1 / p2 ) ;
		}
		else
		{
			h = nHeight ;
			w = nHeight * p2 ;
		}
		ImgCls.Obj.width  = w ;
		ImgCls.Obj.height = h ;
	}
	// Html <img  src="url" onload="Img(this).Resize(width,height);" />
}

// callFlash

function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
document.write('<param name="quality" value="high"> ');
document.write('<param name="wmode" value="transparent"> ');
document.write('<param name="menu" value="false"> ');
document.write('<embed src="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}

function CallSWF(strURL,nWidth,nHeight,strBkColor,strID,strAlignMode,strQuality,strFlashVars)
{
	var embedTxt;
	embedTxt = "<embed";
	if (strURL==null)
	{
	return;
	}
	embedTxt += ' src="'+strURL+'"';
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
	if (nHeight)
	{
	document.write(' height="'+nHeight+'"');
	embedTxt += ' height="'+nHeight+'"';
	}
	if (nWidth)
	{
	document.write(' width="'+nWidth+'"');
	embedTxt += ' width="'+nWidth+'"';
	}
	if (strID)
	{ 
	document.write(' id="'+strID+'"');
	embedTxt += ' name="'+strID+'"';
	}
	if (strAlignMode)
	{
	document.write(' align="'+strAlignMode+'"');
	embedTxt += ' align="'+strAlignMode+'"';
	} 
	document.write('>');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name="WMode" value="Transparent">');
	document.writeln('<param name="WMode" value="opaque">'); 
	embedTxt += ' menu="false"';
	document.writeln('<param name="allowScriptAccess" value="always" />');
	embedTxt += ' allowScriptAccess="always"';
	if (strFlashVars)
	{
	document.writeln('<PARAM NAME=FlashVars VALUE="'+strFlashVars+'">');
	embedTxt += ' FlashVars="'+strFlashVars+'"';
	} 
	document.writeln('<param name="movie" value="'+strURL+'" />');
	if (strQuality)
	{
	document.writeln('<param name="quality" value="'+strQuality+'" />');
	embedTxt += ' quality="'+strQuality+'"';
	}
	else
	{
	document.writeln('<param name="quality" value="High" />');
	embedTxt += ' quality="High"';
	}
	if (strBkColor)
	{
	document.writeln('<param name="bgcolor" value="'+strBkColor+'" />');
	embedTxt += ' bgcolor="'+strBkColor+'"';
	}
	embedTxt += ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true" quality="High" wmode="transparent"></embed>';
	document.writeln(embedTxt);
	document.writeln('</object>');
	// Htmel <SCRIPT language=javascript type=text/javascript>flash('url','width','height');</SCRIPT>
	}

// callObject

function obj(id)
{
	return document.getElementById(id);
	}

//show&hide Area

function sAe(id)
{
	obj(id).className="Show";
	}
function hAe(id)
{
	obj(id).className="Hide";
	}

// slideTag

function sTag(n)
{
	for(var i=1;i<=2;i++)
	{
		obj('tag'+i).className="outTag";
		obj('tagAe'+i).className='Hide';
		}
		obj('tag'+n).className="overTag";
		obj('tagAe'+n).className='Show';
		}

// PNG FOR IE6.0

if(navigator.userAgent.indexOf("MSIE 6.0")>0)
{
	var clear="i/clear.gif"

	pngfix=function(){	var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
	window.attachEvent('onload',pngfix);
	}

// Scroll  Product
function scrollImg()
{
	var speed=100//速度数值越大速度越慢
	demo2.innerHTML=demo1.innerHTML
	function Marquee(){
	if(demo2.offsetWidth-demo.scrollLeft<=0)
	demo.scrollLeft-=demo1.offsetWidth
	else{
	demo.scrollLeft++
	}
	}
	var MyMar=setInterval(Marquee,speed)
	demo.onmouseover=function() {clearInterval(MyMar)}
	demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}
//可控制方左右方向滚动
function scroll(n)
{
	temp=n;
	obj("demo").scrollLeft=obj("demo").scrollLeft+temp;
	if (temp==0) return;
	setTimeout("scroll(temp)",20);
}
//left:onmousedown="scroll(-8)" onmouseover="scroll(-4)"  onmouseout="scroll(0)"
//right:onmousedown="scroll(8)" onmouseover="scroll(4)"  onmouseout="scroll(0)"
