var str;
var tempStr1;
var tempStr2;
if (section == null)	var section = 0;
if (level1 == null)	var level1 = "";
if (level2 == null)	var level2 = "";
if (level3 == null)	var level3 = "";
if (level4 == null)	var level4 = "";
if (glossObj == null)	var glossObj = "";
var d = document;
//var sectionObj = new Object();
if (showMenu == null)	var showMenu = true;



function genLink(i)
{
	var link = (i)?i:"javascript:;";
	
	if (!(link.indexOf('http') > -1) && !(link.indexOf('javascript') > -1) && link.indexOf('/') != 0)
	{
		link = path + i;
	}
	
	return link;
}

function changeSize() {
	var xWithScroll = 0, yWithScroll = 0;
	
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	}	
	//window.alert( 'xWithScroll = ' + xWithScroll + '\nxWithScroll = ' + yWithScroll );	
	document.getElementById("flashcontainer").style.height = yWithScroll
	/*
	if (xWithScroll < 970)
		{
			document.getElementById("container").style.width = '970px';
		}
	else
		{
			document.getElementById("container").style.width = '100%';
		}
	*/
}

////////////////////////////////////////////////////////////////////////////
// function checkAllHrefAppendLite()
// lite version relatived function
// to change all the local link appended ?v=lite
// but the External Link is Not Affected
////////////////////////////////////////////////////////////////////////////
function checkAllHrefAppendLite(){
	if (!isLiteVersion() ) {
		return;
	}
	var e = document.getElementsByTagName("a");
	//var tmp = "";
	for (var i =0; i< e.length;i++) {
		var curLink = "";
		curLink = (isIE)?e[i].getAttribute('href', 2):e[i].getAttribute('href');		
		if (curLink.indexOf("http://") != -1) {			
			//tmp += i + " ) " + curLink + "\n";
			continue;
		}
		if (curLink.indexOf("mailto:") != -1) {			
			//tmp += i + " ) " + curLink + "\n";
			continue;
		}
		if (curLink.indexOf("v=lite") != -1) {			
			//tmp += i + " ) " + curLink + "\n";
			continue;
		}
		var tmpArchor = "";
		var frontLink  = "";
		if (curLink.indexOf('#') != -1){			
			var tmpAry = curLink.split("#");
			tmpArchor = "#" + tmpAry[1];
			frontLink = tmpAry[0];
		} else {
			frontLink = curLink;
		}
		curLink =  frontLink + "?v=lite" + tmpArchor;
		//tmp += i + " ) " + curLink + "\n";
		e[i].setAttribute("href",curLink);		
	}
    //alert(tmp);
}

function init() {
	changeSize();
	checkAllHrefAppendLite();
}

function genFooter() {
	var isLite = isLiteVersion();
	var liteString = (isLite)?'?v=lite':'';
	str = '';
	str += '<div class="footer_logo"><a href="#"><img src="../../eng/images/home/footer_logo.gif" alt="Beijing Hong Kong Jockey Club Clubhouse" border="0"></a></div>';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/membership_application.html'+liteString+'">Membership Application</a> | <a href="../../eng/footer/reciprocal_arrangement.html'+liteString+'">Reciprocal Arrangement</a> | <a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
	str += '<div class="footer_brown"><p>&copy; 2011 The Hong Kong Jockey Club. All Rights Reserved.<br /><a href="../../eng/footer/privacy_statement.html'+liteString+'">Privacy Statement</a></p></div>';
	
	document.write(str);
	
	/*<!-- START Nielsen Online SiteCensus V6.0 -->
	<!-- COPYRIGHT 2009 Nielsen Online -->*/

	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker.js"></scr' + 'ipt>');
	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker_config.js"></scr' + 'ipt>');
	  	try {
	   		WATracker.trackPageView('subsite-bejingclub');
		} catch (e) {}
	document.write('<noscr' + 'ipt><div><img src="//secure-sg.imrworldwide.com/cgi-bin/m?ci=hk-hkjc-wa&amp;cg=subsite-bejingclub&amp;cc=1&amp;ts=noscript" width="1" height="1" alt="" /></div></noscr' + 'ipt>');

	/*<!-- END Nielsen Online SiteCensus V6.0 -->*/
}

function genFooter_temp() {
	var isLite = isLiteVersion();
	var liteString = (isLite)?'?v=lite':'';
	str = '';
	str += '<div class="footer_logo"><a href="#"><img src="../../eng/images/home/footer_logo.gif" alt="Beijing Hong Kong Jockey Club Clubhouse" border="0"></a></div>';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/membership_application.html'+liteString+'">Membership Application</a> | <a href="../../eng/footer/reciprocal_arrangement.html'+liteString+'">Reciprocal Arrangement</a> | <a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
	str += '<div class="footer_brown2"><p style="width:auto">&copy; 2011 The Hong Kong Jockey Club. All Rights Reserved.<br /><a href="../../eng/footer/privacy_statement.html'+liteString+'">Privacy Statement</a></p></div>';
	
	document.write(str);
	
	/*<!-- START Nielsen Online SiteCensus V6.0 -->
	<!-- COPYRIGHT 2009 Nielsen Online -->*/

	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker.js"></scr' + 'ipt>');
	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker_config.js"></scr' + 'ipt>');
	  	try {
	   		WATracker.trackPageView('subsite-bejingclub');
		} catch (e) {}
	document.write('<noscr' + 'ipt><div><img src="//secure-sg.imrworldwide.com/cgi-bin/m?ci=hk-hkjc-wa&amp;cg=subsite-bejingclub&amp;cc=1&amp;ts=noscript" width="1" height="1" alt="" /></div></noscr' + 'ipt>');

	/*<!-- END Nielsen Online SiteCensus V6.0 -->*/
}

function genFooter_brcc() {
	var isLite = isLiteVersion();
	var liteString = (isLite)?'?v=lite':'';
	str = '';
	str += '<div class="footer_logo"><a href="#"><img src="../../eng/images/home/footer_logo.gif" alt="Beijing Hong Kong Jockey Club Clubhouse" border="0"></a></div>';
	str += '<div class="footer_logo"><a href="#"><img src="../../eng/images/home/footer_dragonair.gif" alt="Dragon Air" border="0"></a></div>';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/membership_application.html'+liteString+'">Membership Application</a> | <a href="../../eng/footer/reciprocal_arrangement.html'+liteString+'">Reciprocal Arrangement</a> | <a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
	str += '<div class="footer_brown2"><p style="width:auto">&copy; 2011 The Hong Kong Jockey Club. All Rights Reserved.<br /><a href="../../eng/footer/privacy_statement.html'+liteString+'">Privacy Statement</a></p></div>';
	
	document.write(str);
	
	/*<!-- START Nielsen Online SiteCensus V6.0 -->
	<!-- COPYRIGHT 2009 Nielsen Online -->*/

	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker.js"></scr' + 'ipt>');
	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker_config.js"></scr' + 'ipt>');
	  	try {
	   		WATracker.trackPageView('subsite-bejingclub');
		} catch (e) {}
	document.write('<noscr' + 'ipt><div><img src="//secure-sg.imrworldwide.com/cgi-bin/m?ci=hk-hkjc-wa&amp;cg=subsite-bejingclub&amp;cc=1&amp;ts=noscript" width="1" height="1" alt="" /></div></noscr' + 'ipt>');

	/*<!-- END Nielsen Online SiteCensus V6.0 -->*/
}

function genFooter_brcc_nodragon() {
	var isLite = isLiteVersion();
	var liteString = (isLite)?'?v=lite':'';
	str = '';
	str += '<div class="footer_logo"><a href="#"><img src="../../eng/images/home/footer_logo.gif" alt="Beijing Hong Kong Jockey Club Clubhouse" border="0"></a></div>';
//	str += '<div class="footer_logo"><a href="#"><img src="../../eng/images/home/footer_dragonair.gif" alt="Dragon Air" border="0"></a></div>';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/membership_application.html'+liteString+'">Membership Application</a> | <a href="../../eng/footer/reciprocal_arrangement.html'+liteString+'">Reciprocal Arrangement</a> | <a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
//	str += '<div class="footer_brown"><p><span><a href="../../eng/footer/contact_us.html'+liteString+'">Contact Us</a></span><br />';
	str += '<div class="footer_brown2"><p style="width:auto">&copy; 2011 The Hong Kong Jockey Club. All Rights Reserved.<br /><a href="../../eng/footer/privacy_statement.html'+liteString+'">Privacy Statement</a></p></div>';
	
	document.write(str);
	
	/*<!-- START Nielsen Online SiteCensus V6.0 -->
	<!-- COPYRIGHT 2009 Nielsen Online -->*/

	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker.js"></scr' + 'ipt>');
	document.write('<scr' + 'ipt type="text/javascript" src="//common.hkjc.com/wa/wa_tracker_config.js"></scr' + 'ipt>');
	  	try {
	   		WATracker.trackPageView('subsite-bejingclub');
		} catch (e) {}
	document.write('<noscr' + 'ipt><div><img src="//secure-sg.imrworldwide.com/cgi-bin/m?ci=hk-hkjc-wa&amp;cg=subsite-bejingclub&amp;cc=1&amp;ts=noscript" width="1" height="1" alt="" /></div></noscr' + 'ipt>');

	/*<!-- END Nielsen Online SiteCensus V6.0 -->*/
}


function genRules() {
	var isLiteStr = "";
	if (isLiteVersion() ) {
		isLiteStr = "?v=lite";
	}
	var rulesArray = new Array();
	
	rulesArray[0] = [
	{name:"Code of Conduct when Exercising Membership Privileges", id:"facilities"},
	{name:"Changing Rooms", id:"changing"},
	{name:"Recreation Centre", id:"recreation"},
	{name:"Swimming Pool", id:"swimming"},
	{name:"Sauna and Steam Room", id:"sauna"},
	{name:"Multi-purpose Studio (Table Tennis)", id:"sports"},
	{name:"Guest Rooms", id:"guest"},
	{name:"Courtyards", id:"courtyards"},
	{name:"Car Park ", id:"park"},
	{name:"Massage Area", id:"massage"},
	{name:"The Library", id:"reading"},
	{name:"The Card Room", id:"cardroom"}
	];
	
	var obj = rulesArray[0];
	
	
	str = '';
	
	str += '<select class="rules" name="select" onChange="MM_jumpMenu(\'parent\',this,0)" class="rules">';
	str += '	<option value="../../eng/points_to_observe/rules_and_regulations.html'+isLiteStr+'">------------------------- Please Select -------------------------</option>';
	
	for (var i=0; i<obj.length; i++) {
		if (pagerules == obj[i].id) {
			tempStr1 = " selected='selected'";
			} else {
			tempStr1 = "";
		}
		str += '<option value="../../eng/points_to_observe/rules_and_regulations_'+obj[i].id+'.html'+isLiteStr+'"'+tempStr1+'>'+obj[i].name+'</option>';
	}
	str += '	</select>';
	
	document.write(str);
}
