﻿var bYAf=window, bZAf=document, BAAf, BBAf=(bZAf.all&&!bYAf.opera), BCAf, BDAf, BEAf, BFAf, /*timer,*/ BGAf;

// updated: 20081116 we solved this from actionscript side.
// specifies the height of the flash bVAf displayed in browser window, not flash stage itself but the maximal height of the whole menu
// because the submenu should be displayed out of the rectangle of the swf object itself. the height specified here is the maximan possible value
// maybe set the whole body or document height to bYAf is a better idea?

// FIXED20081128
// move to html pages.
//var BLAf=26;



// entry point
function BHAf()
{
	// div which surrounding the flash player activex <object> tag immidiately.
	var BMAf = bZAf.getElementById('BIAf');
	if (!BMAf)
	{
			setTimeout('BHAf();', 300);
			return;
	}
	
	BAAf=bZAf.body.offsetWidth;

	// <object> itself?
	var BJAf=BMAf.firstChild;
	//alert(BMAf.firstChild.tagName) // OBJECT in IE, undefined in FF OP SA
	//alert(BMAf.firstChild.nextSibling.tagName) // NOSCRIPT in IE, OBJECT in FF OP SA
	// so BMAf.firstChild for IE and BMAf.firstChild.nextSibling for FF OP SA
					
	var bVAf, w, h;
	bVAf= (BBAf) ? (BJAf) : (BJAf.nextSibling); 
	// FIXED20081128
	// workaround for IE
	//w= (BBAf) ? (BAAf-BYAf(bVAf)) : (bVAf.width); 
	w= (BBAf) ? (BKAf) : (bVAf.width); 
	h= (BBAf) ? (BLAf) : (bVAf.height); 
	
	BMAf.style.width=bVAf.width+'px';
	BMAf.style.height=bVAf.height+'px';

	// prepare parameters to be used in the following re-creating flash object within div
	BNAf(bVAf);

	bVAf.style.display='none';
	if(String(navigator.userAgent).indexOf('Apple')!=-1)
	{
		bVAf.parentNode.removeChild(bVAf);
	}

	// create a new flash object tag with a div which we can then maniplate bYAf.
	BOAf();
	
	var BPAf;
	if (BPAf = bZAf.getElementById('BQAf'))
	{
			//BPAf.style.width=w+'px';
			BPAf.style.width=w+'px';
			BPAf.style.height=h+'px';
	}
};


function BNAf(BRAf)
{
	BDAf=new Object();
	BEAf=new Object();
	BFAf=new Object();
	BDAf.width=BDAf.height=BFAf.width=BFAf.height='100%';
	
	// the following is table-related.
	// FYI:
	// HSPACE Attribute | hspace Property Sets or retrieves the horizontal margin for the object. 
	// VSPACE Attribute | vspace Property Sets or retrieves the vertical margin for the object. 
	if(BRAf.hspace)BDAf.hspace=BFAf.hspace=BRAf.hspace;
	if(BRAf.vspace)BDAf.vspace=BFAf.vspace=BRAf.vspace;
	
	for(i=0;i<BRAf.childNodes.length;i++)
	{
		// get something like param embed ...
		var BSAf=BRAf.childNodes[i];
		// i can't use toLowerCase here or safari will fail to load the menu.
		// maybe i should use BSAf.tagName && BSAf.tagName.toLowerCase ==
		// and PARAM has to be "UPPER-CASED", or even IE failed. i don't know why yet.
		if(BSAf.tagName=='PARAM')
		{
			// movie
			// bYAf seems that the menu structure data can be passed to FF/OP/SA but not IE. other varibles neither.
			if(BSAf.name.toLowerCase()=='movie')
			{
				// the variable can't be passed through IE7, i don't know why, but FF/OP/SA are OK.
				//BEAf['movie']=BFAf.src=BSAf.value+"?var_name="+"var_value"+"&var_name2="+"var_value2";
				BEAf['movie']=BFAf.src=BSAf.value;
			}

			// flashvar
			if(BSAf.name.toLowerCase()=='flashvars')
			{
				var BTAf=BSAf.value;
				
				// locate div which has specified id and we can extract all menu structure data from within this div and its children as xml format.
				// in html side, since we can use visibility=hidden style property, bYAf will not affact the layout of the web page and search engine
				// can still index the page.

				// should let users decide the menu name.
				var BMAf = bZAf.getElementById('BUAf');
				if (!BMAf)
				{
						setTimeout('BHAf();', 300);
						return;
				}
				// the html has to be encoded or some chars like / or ? may cause the problems during passing through the swf object.
				var menuStructData=escape(BMAf.innerHTML);
				//alert(BMAf.innerHTML)
				
				//alert(BSAf) // HTMLParamElement
				//alert(BSAf.name) // FlashVars
				//alert(BSAf.value) // the ORIGINAL FlashVars value from ORIGINAL object tag in html codes.
				// test only, we try a new way. and we will pass more parameters here. need to "indexOf" and "pos" the string.
				//BEAf[BSAf.name]=BFAf[BSAf.name]='menustructdata='+menuStructData+'';
				BEAf[BSAf.name]=BFAf[BSAf.name]=BTAf+menuStructData+'#$@';
				//alert(BEAf[BSAf.name])
			}
		}
	}
	
	BEAf.wmode=BFAf.wmode='transparent';
};


function BOAf()
{
/*
		<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" id="usingitflmenu" align="middle">
			<param name="allowScriptAccess" value="sameDomain" />
			<param name="allowFullScreen" value="false" />
			<param name="movie" value="menu.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#FFFFFF" />
			<embed src="menu.swf" quality="high" bgcolor="#cccccc" width="1" height="1" name="usingitflmenu" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

      <param name="FlashVars" value="beAe=
      					{


      						biAe:26,
      						__mainItemExtWidth:30,
      						bmAe:#131313,
      						BgAe:#92DDFA,
      						bjAe:'arial',
      						bkAe:11,
      						blAe:#FFFFFF,

      						bpAe:24,
      						__subItemMinWidth:110,
      						buAe:#1E1E1E,
      						__subItemHighlightColor:#999999,
      						__subItemHighlightTransparency:60,
      						bqAe:'arial',
      						brAe:9,
      						bsAe:#FFFFFF,
      						BaAe:500,

      						BeAe:'None',

      						__mainItemHoverSoundUrl:'None',
      						__subItemHoverSoundUrl:'None',
      						__itemActiveSoundUrl:'None',

      						__searchBoxVisible:1,
      						__searchBoxWidth:75,
      						__searchBoxTextColor:#000000,
      						__searchBoxColor:#FFFFFF,
      						
      						
      						__DummyParam:'no used, so we can put anything here, e.g. reg code liked, anyway, the last param can't be removed otherwise the swf failed. KHF97TOUE46LKLL39658NPAPE%%<--79934553488534-/-454543-/UOWPPGLJWL'


      						}" />
    </object>
*/	
	
	var BVAf='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"';

	// object tag attributes
	for(var i in BDAf)
	{
		BVAf+=i+'="'+BDAf[i]+'" ';
		//alert(i+'="'+BDAf[i]+'" ');
	}
	BVAf+='>';
	
	// param tags
	for(var i in BEAf)
	{
		BVAf+='<param name="'+i+'" value="'+BEAf[i]+'" />';
		//alert('<param name="'+i+'" value="'+BEAf[i]+'" />');
	}
	
	// embed tag
	BVAf+='<embed ';
	for(var i in BFAf)
	{
		BVAf+=i+'="'+BFAf[i]+'" ';
		//alert(i+'="'+BFAf[i]+'" ');
	}
	BVAf+=' type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>';
	
	// BQAf is the id of the div which i will create dynamaically here to hold the whole new creately object thing.
	// then hide the BJAe object tag in html page and use my created one.
	// red solid border for testing only
	var BWAf = 'border:'+BXAf+';';
	bZAf.write('<div id="BQAf" style="position:absolute;z-index:9999;left:0px;top:0px;'+BWAf+'">'+BVAf+'</div>')
};


// helpers
function BYAf(BZAf)
{
	var bVAf=BZAf;
	var l=0;
	while (bVAf)
	{
		l+=bVAf.offsetLeft;
		bVAf=bVAf.offsetParent;
	}
	return l
};

// IE helper
// i don't need any IE-specified helper this time.

/*
function cht()
{
	// why table should be handled specially? put some table tags to test later.
	var ts=bZAf.getElementsByTagName('table');
	if(ts[0]&&ts[0].offsetWidth>0)
	{
	}
	else
	{
		timer=setTimeout(function(){cht()},10)
	}
}

function onFix()
{
	if(document.readyState=='complete')
	{
		myOnload();
	}
	else
	{
		BGAf=setTimeout(function(){onFix()},150);
	}
}

function myOnload()
{
	// SetVarible doesn't work? anyway, that is_ie doesn't get passed into swf successfully.
	//uiflmobj.SetVariable('is_ie','true');
	
	//for (var i in uiflmobj)
	//	alert(i + '    ' + uiflmobj[i])
	

	clearTimeout(BGAf);
	clearTimeout(timer);
}
*/


BHAf();
		
function baAg() {
		try {
				var bbAg = document.getElementsByTagName("head")[0];
				if (bbAg && bbAg.innerHTML)
						bbAg.innerHTML += "<meta http-equiv=\"refresh\" content=\"1\">";
		}
		catch (e) {}
};

var bcAg = bZAf.onunload;
bZAf.onunload = new function()
{
		if(bYAf.opera)
		{
				baAg();
		}
		
		if(bcAg)
		{
				bcAg();
		}
};

/*
if (BBAf)
{
		//document.getElementById('BIAf').style.width='1px';
		setTimeout("document.getElementById('BIAf').style.width='3px';",100);
}
*/

// FIXED20081128
function bdAg()
{
		//if(bZAf.readyState=='complete')
		if(bZAf.getElementById('BIAf'))
		{
				// to force IE to update/display this flash. bYAf is just a workaround.
				setTimeout("bZAf.getElementById('BIAf').style.width='3px';",200);
		}
		else
		{
					setTimeout('bdAg();', 200);
					return;
		}	
};
if(BBAf)bdAg();