﻿//------------------ Detect language --------------------
var nowURL = document.URL;
var thURL = nowURL.replace('/en/','/th/');
var enURL = nowURL.replace('/th/','/en/');

//------------------ Init Text Size--------------------
// setDefaults arguments: size unit, default size, minimum, maximum
// optional array of elements or selectors to apply these defaults to
dw_fontSizerDX.setDefaults("px", 13, 9, 26, ['td.text'] );
//dw_fontSizerDX.setDefaults( "px", 13, 9, 26, ['body', 'td', 'div', 'p', 'font'] );
dw_Event.add( window, 'load', dw_fontSizerDX.init );

//------------------Contents for menu_unit------------------
var menu_unit=new Array()
menu_unit[0]='<a href="The_Glory_Emperor367.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgEmpire367\',\'\',\'images/m_the-glory-367.gif\',1)"><img src="images/m_the-glory-367.gif" alt="The Glory Empire 367" name="imgEmpire367" width="154" height="18" border="0" id="imgEmpire367" /></a>'
menu_unit[1]='<a href="The_Glory_Emperor386.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgEmpire386\',\'\',\'images/m_the-glory-386.gif\',1)"><img src="images/m_the-glory-386.gif" alt="The Glory Empire  386" name="imgEmpire386" width="154" height="18" border="0" id="imgEmpire386" /></a>'
menu_unit[2]='<a href="The_Emperor_A.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgEmperorA\',\'\',\'images/m_the-emperor-A.gif\',1)"><img src="images/m_the-emperor-A.gif" alt="The Emperor A" name="imgEmperorA" width="154" height="18" border="0" id="imgEmperorA" /></a>'
menu_unit[3]='<a href="The_Emperor_B.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgEmperorB\',\'\',\'images/m_the-emperor-B.gif\',1)"><img src="images/m_the-emperor-B.gif" alt="The Emperor B" name="imgEmperorB" width="154" height="18" border="0" id="imgEmperorB" /></a>'
menu_unit[4]='<a href="The_Emperor_C.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgEmperorC\',\'\',\'images/m_the-emperor-C.gif\',1)"><img src="images/m_the-emperor-C.gif" alt="The Emperor C" name="imgEmperorC" width="154" height="18" border="0" id="imgEmperorC" /></a>'
menu_unit[5]='<a href="The_Emperor_D.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgEmperorD\',\'\',\'images/m_the-emperor-D.gif\',1)"><img src="images/m_the-emperor-D.gif" alt="The Emperor D" name="imgEmperorD" width="154" height="18" border="0" id="imgEmperorD" /></a>'
menu_unit[6]='<a href="The_Villa_Cabana_Series.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgVillaCabana\',\'\',\'images/m_the-villa-cabana.gif\',1)"><img src="images/m_the-villa-cabana.gif" alt="The Villa Cabana Series" name="imgVillaCabana" width="154" height="18" border="0" id="imgVillaCabana" /></a>'

var menuwidth='122px' //default menu width
//var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

//------------------Page Elements---------------------
function header(section) {
	document.write('<table width="952" border="0" align="center" cellpadding="0" cellspacing="0" id="Header">');
	document.write('<tr><td height="22"></td></tr>');
	writeTitle(); // Logo and options
	document.write('<tr><td height="17"></td></tr>');
	writeMainImage(section); // Main image of page
	writeMenu(section); // Main menu
	document.write('</table>');
}

function writeTitle() {
	document.write('<tr><td>');
	
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>');
	document.write('<td width="12"></td>');
	document.write('<td width="152"><a href="index.html"><img src="images/logo_emperor.gif" width="150" height="88" border="0" /></a></td>');
	document.write('<td><img src="images/title_emp_en.gif" width="578" height="88" /></td>');
	// Options
	document.write('<td><table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write('<tr><td align="right"><a href="/th" target="_blank"><img src="images/uc_sansiricall.gif" alt="Sansiri PCL. Call 1685" width="112" height="34" border="0" /></a></td></tr>'); // Sansiri Logo
	document.write('<tr><td height="40" align="right"><table width="100" border="0" cellspacing="0" cellpadding="0"><tr>');
	document.write('<td><img src="images/text_en.gif" width="88" height="14" /></td>');
	document.write('<td><a href="' + thURL + '"><img src="images/ic_th.gif" alt="เปลี่ยนเป็นภาษาไทย" width="24" height="12" border="0" /></a></td>');
	document.write('</tr></table></td></tr>');

	document.write('<tr><td align="right">');
	document.write('<div id="sizer"><table border="0" cellspacing="0" cellpadding="0"><tr>');
	document.write('<td align="right" class="changesize">Text size</td>');
	document.write('<td width="37" align="right"><a class="decrease" href="#"><img src="images/ic_fontdec.gif" alt="Decrease text size" width="31" height="13" border="0" /></a></td>');
	document.write('<td width="37" align="right"><a class="increase" href="#"><img src="images/ic_fontinc.gif" alt="Increase text size" width="31" height="13" border="0" /></a></td>');
	document.write('</tr></table></div>');
	document.write('</td></tr>');
	document.write('</table></td>');
		// ------
	document.write('</tr></table>');
	
	document.write('</td></tr>');
}

function writeMainImage(section) {
	document.write('<tr><td>');
	switch(section) {
		case "info" :
			//document.write('<img src="images/p_home.jpg" width="952" height="344" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "unit" :
			//document.write('<img src="images/p_housetype.jpg" width="952" height="344" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "The_Emperor_A" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "The_Emperor_B" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "The_Emperor_C" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
		    writeFlash('images/flashbanner.swf',952,345);
			break;
		case "The_Emperor_D" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "The_Villa_Cabana_Series" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "The_Glory_Emperor367" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;		
		case "The_Glory_Emperor386" :
			//document.write('<img src="images/p_houseviewdetail.jpg" width="952" height="384" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "ready" :
			//document.write('<img src="images/p_housetype.jpg" width="952" height="344" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "activity" :
			//document.write('<img src="images/p_housetype.jpg" width="952" height="344" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
		case "contact" :
			//document.write('<img src="images/p_contactus.jpg" width="952" height="344" />');
			writeFlash('images/flashbanner.swf',952,345);
			break;
	}
	document.write('</td></tr>');
}

function writeMenu(section) {
	switch(section) {
		case "The_Emperor_A" :
		case "The_Emperor_B" :
		case "The_Emperor_C" :
		case "The_Emperor_D" :
		case "The_Emperor_D" :
		case "The_Villa_Cabana_Series" :
		case "The_Glory_Emperor367" :
		case "The_Glory_Emperor386" :
			section ="unit";
			break;
	}
	document.write('<tr><td>');
	document.write('<table width="100%" border="0" background="images/bg_menu.jpg" cellpadding="0" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<table width="450" border="0" align="center" cellpadding="0" cellspacing="0"><tr valign="top">');
	document.write('<td><a href="index.html"><img src="images/m_info'+ ((section=='info')?'2':'1')+'.jpg" alt="Project Information" width="154" height="36" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="unit.html"><img src="images/m_housetype'+ ((section=='unit')?'2':'1')+'.jpg" alt="House Type" width="145" height="36" border="0" onMouseover="dropdownmenu(this, event, menu_unit, \'150px\')" onMouseout="delayhidemenu()" /></a></td>');
	writeMenubar(); // bar
	//document.write('<td><a href="ready.html"><img src="images/m_readytomovein'+ ((section=='ready')?'2':'1')+'.jpg" alt="Ready to move in" width="201" height="36" border="0" /></a></td>');
	//writeMenubar(); // bar
	document.write('<td><a href="/th/project/the_emperor_narasiri/360tour/index.html" target = "blank"><img src="images/m_virtualtour'+ ((section=='vrtour')?'2':'1')+'.jpg" alt="Virtual Tour 360" width="160" height="36" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="activity.html"><img src="images/m_activity'+ ((section=='ready')?'2':'1')+'.jpg" alt="Activity" width="137" height="36" border="0" /></a></td>'); 
	writeMenubar(); // bar
	document.write('<td><a href="contact.html"><img src="images/m_contact'+ ((section=='contact')?'2':'1')+'.jpg" alt="Contact Us" width="145" height="36" border="0" /></a></td>');
	document.write('</tr></table>');
	document.write('</td></tr>');
	document.write('</table>');
	document.write('</td></tr>');
}

function writeMenubar() {
	document.write('<td><img src="images/m_bar.jpg" width="2" height="36" border="0" /></td>');
}

function footer() {
	document.write('<table width="952" border="0" align="center" cellpadding="0" cellspacing="0" id="Footer">');
	document.write('<tr><td height="30" valign="bottom"><img src="images/line_bottom.gif" width="982" height="3" /></td></tr>');
	document.write('<tr><td height="5"></td></tr>');
	 writeGraphicRemark()
	document.write('<tr><td height="30" align="center" class="copyright"><a href="/en" target="_blank" class="link_homepage">Go to main page www.sansiri.com</a>&nbsp;::&nbsp;Copyright&copy; 2009. Sansiri Public Co., Ltd. All right reserved. <b>One of quality projects of </b><img src="images/logo_bottom_th.jpg" width="54" height="30" border="0" align="absmiddle" />');
	document.write('<tr><td height="10"></td></tr>');
	counter();
	document.write('</td></tr>');
	document.write('</table>');
}
function writeGraphicRemark() {
	var return_txt = '<tr><td height="5" valign="top"></td></tr>\n\
      <tr><td align="center" valign="top" class="copyright"><span style="font: 9px Verdana">Featured photography on website  consists of photography on location, photography on location with simulated atmosphere and simulated graphic.<br>Should you have any questions regarding any photography, please contact our customer service staffs or visit our projects\' site. Call 1685.</span></td></tr>\n\
	<tr><td height=10></td></tr>';
	document.write(return_txt);

}


function counter()
{	document.write('<script language="javascript" src="/scripts/googleAnalytics.js"></script>');
        document.write('<script language="javascript" src="/scripts/adword.js"></script>');
	/*document.write('<script language="javascript" src="/include/sansiri_tag.js"></script>');*/
	/*document.write('<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>');*/
	/*document.write('<script language="javascript" src="/include/adword.js"></script>');*/
}

