// JavaScript Document
function flash(name,w,h){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,29,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="movie" value="'+name+'">');
	document.write('<param name="quality" value="best">');
	document.write('<param name="wmode" value="Transparent">');
	document.write('<embed src="'+name+'" quality="best" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="Transparent" width="'+w+'" height="'+h+'"></embed>');
	document.write('</object>');
}

function showfocus(){
	var focus_width=350	//宽度（flash源文件不用修改，把要显示的图片设置同样大小）
	var focus_height=177 //高度
	var text_height=0
	var swf_height = focus_height+text_height
	
	var pics= 'images/focus/focus_01.jpg|images/focus/focus_03.jpg|images/focus/focus_04.jpg'//图片地址
	var links='promotion.asp|promotion.asp|promotion.asp'//相对于图片的链接地址
	var texts='|||'
	document.write('<object ID="focus_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="flash/playswf.swf"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('<embed ID="focus_flash" src="flash/playswf.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#C5C5C5" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		
	document.write('</object>');
	}

function changeCigar(pic,name){
	document.getElementById('star_cigar').src = pic;
	document.getElementById('starciger_txt').innerText = name;
}
function changePipe(pipepic,pipename){
	document.getElementById('star_pipe').src = pipepic;
	document.getElementById('starpipe_txt').innerText = pipename;
}

function changeTools(pic,name){
	document.getElementById('starToolsImg').src = pic;
	document.getElementById('starToolsName').innerText = name;
}

function iframeAutoFit()
    {
        var ex;
        try
        {
            if(window!=parent)
            {
                var a = parent.document.getElementsByTagName("IFRAME");
                for(var i=0; i<a.length; i++) //author:meizz
                {
                    if(a[i].contentWindow==window)
                    {
                        var h1=0, h2=0;
                        if(document.documentElement&&document.documentElement.scrollHeight)
                        {
                            h1=document.documentElement.scrollHeight;
                        }
                        if(document.body) h2=document.body.scrollHeight;
                        var h=Math.max(h1, h2);
                        if(document.all) {h += 4;}
                        if(window.opera) {h += 1;}
                        a[i].style.height = h +"px";
                    }
                    if(i > 3){
                        alert("ssss");
                        break;
                    }
                }
            }
        }
        catch (e){}
    }
    if(document.attachEvent)
    {
        window.attachEvent("onload",  iframeAutoFit);
        //window.attachEvent("onresize",  iframeAutoFit);
    }
    else
    {
        window.addEventListener('load',  iframeAutoFit,  false);
        //window.addEventListener('resize',  iframeAutoFit,  false);
    }

