var tempHtml;
var tempString;
var tempArray = new Array();
var tempW;
var tempL;
var tempH;
var vars;
if (collection == null)	var collection;
if (majesty == null)	var majesty;
if (majesty == null)	var majesty;
if (section == null)	var section;
if (subSection == null)	var subSection;
if (roomType == null)	var roomType;

function genDivTop() {
	winInit();
	
	tempW = screenMinW - photoW;
	tempL = screenW - tempW;
	tempH = screenH;
	
	tempHtml = '<div style="position:absolute; left:'+tempL+'px; width:'+tempW+'px; height:'+tempH+'px; z-index:100;" id="contentDiv">';
	
//Shadow
	tempHtml += '<div style="position:absolute; left:-10px; width:10px; height:'+tempH+'px; z-index:1; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+path+'images/common/shadow.png\', sizingMethod=\'scale\')" id="shadowDiv"></div>';
	
	//genFlashMenu();
	
	document.write(tempHtml);
}


function genFlashMenu() {
	
//Flash majesty Menu Start
	
	vars = "path=" + path + "&collection=" + collection + "&majesty=" + majesty + "&section=" + section + "&subSection=" + subSection + "&roomType=" + roomType;
	
	tempHtml = '<div style="position:absolute; left:-196px; top:'+(menuY-20)+'px; width:233px; height:340px; z-index:1000;" id="menuDiv">';
	tempHtml += '	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" nncodebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="233" height="340" id="menuFlash">';
	tempHtml += '	<param name="movie" value="'+path+'swf/majesty_menu.swf">';
	tempHtml += '	<param name="quality" value="high">';
	tempHtml += '	<param name="menu" value="false">';
	tempHtml += '	<param name="wmode" value="transparent">';
	tempHtml += '	<param name="flashVars" value="'+vars+'">';
	tempHtml += '	<embed src="'+path+'swf/majesty_menu.swf" flashVars="'+vars+'" quality="high" wmode="transparent" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="233" height="340" name="menuFlash"></embed>';
	tempHtml += '	</object>';
	tempHtml += '</div>';
	
	document.write(tempHtml);
	
//Flash majesty Menu End
}


function genDivBottom() {
	tempHtml = '</div>';

	document.write(tempHtml);
}


var copyrightMinH = 20;
var copyrightMaxH = 95;

function genFooter() {
	
	//tempHtml = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml = '<tr>';
	tempHtml += '	<td height="16" style="background:url('+path+'images/common/board_bg_02.gif) bottom;">';
	tempHtml += '		<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '			<tr>';
	tempHtml += '				<td height="14" style="border-left:3px solid #C6C6C2;"><img src="'+path+'images/common/spacer.gif" width="1" height="1"></td>';
	tempHtml += '				<td width="91"><a href="'+path+'majesty.htm" onMouseOver="MM_swapImage(\'btn_other_majesty\',\'\',\''+path+'images/common/btn_other_majesty_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/btn_other_majesty.gif" width="91" height="16" border="0" id="btn_other_majesty" alt="OTHER majesty"></a></td>';
	tempHtml += '				<td width="14"><img src="'+path+'images/common/spacer.gif" width="14" height="1"></td>';
	tempHtml += '			</tr>';
	tempHtml += '			<tr>';
	tempHtml += '				<td height="2" bgcolor="#66593C"><img src="'+path+'images/common/spacer.gif" width="1" height="2"></td>';
	tempHtml += '				<td bgcolor="#736444"><img src="'+path+'images/common/spacer.gif" width="1" height="2"></td>';
	tempHtml += '				<td bgcolor="#66593C"><img src="'+path+'images/common/spacer.gif" width="1" height="2"></td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	tempHtml += '<tr>';
	tempHtml += '	<td height="40" style="border-left:3px solid #5C5036; background-color:#736444;" valign="top">';
	
	
	genCopyright(0);
	
	
	tempHtml += '<img src="'+path+'images/common/spacer.gif" width="1" height="1"></td>';
	tempHtml += '</tr>';
	//tempHtml += '</table>';
	
	document.write(tempHtml);
}


function genText(thismajesty, arrayName, name, theHeight, theWidth) {

	tempHtml = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '	<tr valign="top">';
	tempHtml += '		<td rowspan="2" style="padding-right:10px;" height="'+theHeight+'">';
	
	
	if (navigator.appName.indexOf("Microsoft") > -1) {
		tempHtml += '<div style="position:absolute; width:100%; height:'+theHeight+'px; overflow:hidden;" id="'+name+'" class="content"><span id="content">';
	} else {
		if (theWidth) {
			tempString = theWidth;
		} else {
			tempString = 160;
		}
		tempHtml += '<div style="position:absolute; width:'+tempString+'px; height:'+theHeight+'px; overflow:hidden;" id="'+name+'" class="content"><span id="content">';
	}
	
	tempArray = arrayName;
	
	tempHtml += tempArray;
	
	tempHtml += '</span></div>';
	
	tempHtml += '</td>';
	tempHtml += '		<td width="8"><a href="javascript:;" onMouseDown="scrollStart(\''+name+'\', -4);" onMouseUp="scrollStop();" onMouseOut="scrollStop();"><img src="'+path+'images/common/arrow_up.gif" width="8" height="6" border="0" id="arrow_up_'+name+'"></a></td>';
	tempHtml += '	</tr>';
	tempHtml += '	<tr>';
	tempHtml += '		<td valign="bottom"><a href="javascript:;" onMouseDown="scrollStart(\''+name+'\', 4);" onMouseUp="scrollStop();" onMouseOut="scrollStop();"><img src="'+path+'images/common/arrow_down.gif" width="8" height="6" border="0" id="arrow_down_'+name+'"></a></td>';
	tempHtml += '	</tr>';
	tempHtml += '</table>';
	
	document.write(tempHtml);
}


function checkTextHeight(name) {
//	alert(document.getElementById(name).document.height);
	if (document.getElementById(name).scrollHeight <= document.getElementById(name).offsetHeight) {
		document.getElementById('arrow_up_'+name).style.display = 'none';
		document.getElementById('arrow_down_'+name).style.display = 'none';
	} else {
		document.getElementById('arrow_up_'+name).style.display = 'block';
		document.getElementById('arrow_down_'+name).style.display = 'block';
	}
	
	document.getElementById(name).scrollTop = 0;
}


var musicOn = true;

function musicClick(target) {
	if (musicOn) {
		document.getElementById('copy_music').src = path+'images/common/copy_mute.gif';
		musicOn = false;
	} else {
		document.getElementById('copy_music').src = path+'images/common/copy_music.gif';
		musicOn = true;
	}
}

function musicOver(Over) {
	if (musicOn) {
		if (Over == 1) {
			document.getElementById('copy_music').src = path+'images/common/copy_mute_f2.gif';
		} else {
			document.getElementById('copy_music').src = path+'images/common/copy_music.gif';
		}
	} else {
		if (Over == 1) {
			document.getElementById('copy_music').src = path+'images/common/copy_music_f2.gif';
		} else {
			document.getElementById('copy_music').src = path+'images/common/copy_mute.gif';
		}
	}
}

function genCopyright(writeIt) {
//Bottom Navagation Start
	if(writeIt)	tempHtml = '';
	
	if (section == "home") {
		tempString = 194;
	} else {
		tempString = 180;
	}
	
	tempHtml += '<div style="position:absolute; width:100%; left:0px; top:'+Number(screenH-copyrightMinH)+'px; height:20px; overflow:hidden;" id="copyrightMask">';
	tempHtml += '<div style="position:absolute; left:0px; top:0px; width:'+tempString+'px; height:110px; padding-left:7px; padding-top:5px; padding-bottom:5px; background-color:#000000; filter:Alpha(Opacity=75);" id="copyrightDiv" onMouseOver="copyrightGo(\'copyrightMask\', 1);" onMouseOut="copyrightGo(\'copyrightMask\', 0);">';
	
	tempHtml += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	
	tempHtml += '	<tr>';
	tempHtml += '		<td class="copyright" align="right"><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="'+path+'../index.htm" class="copyright" onMouseOver="MM_swapImage(\'copy_home\',\'\',\''+path+'images/common/copy_home_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_home.gif" width="26" height="8" hspace="9" border="0" name="copy_home"></a><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="#" class="copyright" onMouseOver="MM_swapImage(\'copy_chi\',\'\',\''+path+'images/common/copy_chi_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_chi.gif" width="21" height="10" hspace="9" border="0" name="copy_chi"></a><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="#" class="copyright" onMouseOver="MM_swapImage(\'copy_eng\',\'\',\''+path+'images/common/copy_eng_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_eng.gif" width="18" height="8" hspace="9" border="0" name="copy_eng"></a></td>';
	//tempHtml += '		<td class="copyright"><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="#" class="copyright" onMouseOver="MM_swapImage(\'copy_home\',\'\',\''+path+'images/common/copy_home_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_home.gif" width="26" height="8" hspace="9" border="0" name="copy_home"></a><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="javascript:musicClick();" class="copyright" onMouseOver="musicOver(1);" onMouseOut="musicOver(0);"><img src="'+path+'images/common/copy_music.gif" width="30" height="8" hspace="9" border="0" name="copy_music" id="copy_music"></a><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="#" class="copyright" onMouseOver="MM_swapImage(\'copy_chi\',\'\',\''+path+'images/common/copy_chi_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_chi.gif" width="21" height="10" hspace="9" border="0" name="copy_chi"></a><img src="'+path+'images/common/line_v.gif" width="1" height="6" align="absmiddle"><a href="#" class="copyright" onMouseOver="MM_swapImage(\'copy_eng\',\'\',\''+path+'images/common/copy_eng_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_eng.gif" width="18" height="8" hspace="9" border="0" name="copy_eng"></a></td>';
	tempHtml += '	</tr>';
	
	tempHtml += '	<tr>';
	tempHtml += '		<td style="padding-top:10px; padding-bottom:10px;"><a href="javascript:NewWindow(\'/eng/privacy.htm\',\'privacy\',\'720\',\'600\',\'1\',\'0\');" class="copyright" onMouseOver="MM_swapImage(\'copy_privacy\',\'\',\''+path+'images/common/copy_privacy_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_privacy.gif" width="87" height="6" vspace="3" border="0" name="copy_privacy"></a><br><a href="javascript:NewWindow(\'/eng/terms.htm\',\'terms\',\'720\',\'600\',\'1\',\'0\');" class="copyright" onMouseOver="MM_swapImage(\'copy_terms\',\'\',\''+path+'images/common/copy_terms_f2.gif\',1);" onMouseOut="MM_swapImgRestore();"><img src="'+path+'images/common/copy_terms.gif" width="126" height="6" vspace="3" border="0" name="copy_terms"></a></td>';
	tempHtml += '	</tr>';
	
	tempHtml += '	<tr>';
	tempHtml += '		<td class="copyright"><img src="'+path+'images/common/copy_copy.gif" width="148" height="29" border="0"></td>';
	tempHtml += '	</tr>';
	
	tempHtml += '</table>';
	
	tempHtml += '</div>';
	tempHtml += '</div>';
	
	if(writeIt)	document.write(tempHtml);
	
//Bottom Navagation end
}

var goSpeed = 1;
var speed = 10;
var goStep;
var timeOut;
var timeOut2;
var tempTop;
var tempH;
var objTop;
var objH;
var pulldownNo;
var tempObj;
var tempScreenH;

function copyrightGo(target, go) {
	if (screenH > screenMinH) {
		tempScreenH = screenH;
	} else {
		tempScreenH = screenMinH;
	}
	
	if (go == 1) {
		//document.getElementById(target).style.pixelTop = Number(screenH-copyrightMaxH);
		//document.getElementById(target).style.height = Number(copyrightMaxH);
		tempTop = Number(tempScreenH-copyrightMaxH);
		tempH = Number(copyrightMaxH);
		tempObj = target;
		copyrightMotion();
	} else {
		//document.getElementById(target).style.pixelTop = Number(screenH-copyrightMinH);
		//document.getElementById(target).style.height = Number(copyrightMinH);
		tempTop = Number(tempScreenH-copyrightMinH);
		tempH = Number(copyrightMinH);
		tempObj = target;
		timeOut2 = setTimeout("copyrightMotion()",200);
	}
}

function copyrightMotion() {
	clearTimeout(timeOut2);
	objTop = Number(document.getElementById(tempObj).style.pixelTop);
	objH = Number(document.getElementById(tempObj).style.pixelHeight);
	
	//goStep = Math.round(tempTop-objTop)/speed;
	//goStep2 = Math.round(tempH-objH)/speed;
	if(tempTop>objTop)	goStep = 5;	else	goStep = -5;
	
	if (objTop-tempTop>1 | objTop-tempTop<-1) {
		objTop += goStep;
		objH += -goStep;
		timeOut = setTimeout("copyrightMotion()",goSpeed);
	} else {
		objTop = tempTop;
		objH = tempH;
		clearTimeout(timeOut);
	}
	//window.status = goStep;
	document.getElementById(tempObj).style.top = objTop;
	document.getElementById(tempObj).style.height = objH;
}