﻿//------------------ 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="burasita.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgBurasita\',\'\',\'images/m_burasita2.gif\',1)"><img src="images/m_burasita1.gif" alt="บุราสิตา" name="imgBurasita" width="118" height="18" border="0" id="imgBurasita" /></a>'
menu_unit[1]='<a href="burakanda.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgBurakanda\',\'\',\'images/m_burakanda2.gif\',1)"><img src="images/m_burakanda1.gif" alt="บุรากานดา" name="imgBurakanda" width="118" height="18" border="0" id="imgBurakanda" /></a>'
menu_unit[2]='<a href="burayada.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgBurayada\',\'\',\'images/m_burayada2.gif\',1)"><img src="images/m_burayada1.gif" alt="บุราญาดา" name="imgBurayada" width="118" height="18" border="0" id="imgBurayada" /></a>'
menu_unit[3]='<a href="buraladda.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgBuraladda\',\'\',\'images/m_buraladda2.gif\',1)"><img src="images/m_buraladda1.gif" alt="บุราลัดดา" name="imgBuraladda" width="118" height="18" border="0" id="imgBuraladda" /></a>'
menu_unit[4]='<a href="buranantha.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgBuranantha\',\'\',\'images/m_buranantha2.gif\',1)"><img src="images/m_buranantha1.gif" alt="บุรานันทา" name="imgBuranantha" width="118" height="18" border="0" id="imgBuranantha" /></a>'
menu_unit[5]='<a href="buranonsi.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgBuranonsi\',\'\',\'images/m_buranonsi2.gif\',1)"><img src="images/m_buranonsi1.gif" alt="บุรานนทรี" name="imgBuranonsi" width="118" height="18" border="0" id="imgBuranonsi" /></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(); // 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_brr.gif" width="132" height="73" border="0" /></a></td>');
	document.write('<td><img src="images/title_brr.gif" width="350" height="74" /></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/ic_sansiri.gif" alt="Sansiri PCL. Call 1685" width="74" height="17" 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/txt_showeng.gif" width="88" height="14" /></td>');
	document.write('<td><a href="' + enURL + '"><img src="images/ic_en.gif" alt="Change to English" 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">ขนาดตัวอักษร</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/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "unit" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "ready" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "buranonsi" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "buranantha" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "buraladda" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "burayada" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "burakanda" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "burasita" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "activity" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;	
		case "contact" :
			document.write('<img src="images/brc.jpg" width="724" height="345" />');
			document.write('<img src="images/brc_promotion_th.gif" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
	}
	document.write('</td></tr>');
}

function writeMenu() {
	document.write('<tr><td>');
	document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#492206" class="bg_menu">');
	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.gif" alt="รายละเอียดโครงการ" width="165" height="29" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="unit.html"><img src="images/m_housetype.gif" alt="แบบบ้าน" width="141" height="29" border="0" onMouseover="dropdownmenu(this, event, menu_unit, \'150px\')" onMouseout="delayhidemenu()" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="http://instantliving.sansiri.com/default.aspx?project=51"><img src="images/m_ready.gif" alt="บ้านพร้อมอยู่" width="147" height="29" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="360tour/buraladda/" target="_blank"><img src="images/m_virtualtour.gif" alt="ชมภาพ 360 องศา" width="200" height="29" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="activity.html"><img src="images/m_activity.gif" alt="ภาพกิจกรรม" width="140" height="29" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="contact.html"><img src="images/m_contact.gif" alt="ติดต่อเรา" width="147" height="29" 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.gif" width="2" height="29" 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="25"></td></tr>');
	writeGraphicRemark()
	document.write('<tr><td height="42" align="center" class="copyright"><a href="/th" target="_blank" class="link_homepage">เข้าสู่หน้าหลัก 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_burasiri.gif" width="49" height="27" border="0" align="absmiddle" />');
	counter();
	document.write('</td></tr>');
	document.write('</table>');
}
function writeGraphicRemark() {
    var return_txt = '<tr><td height="25" valign="top"></td></tr>\n\
    <tr><td align="center" valign="top" class="copyright"><span style="font: 11px Tahoma">ภาพที่ปรากฏบนเว็บไซต์ ประกอบด้วย ภาพที่ถ่ายจากสถานที่จริง, ภาพจริงบรรยากาศจำลอง และภาพจำลอง <br>หากมีข้อสงสัยเกี่ยวกับภาพใด ๆ สามารถสอบถามจากเจ้าหน้าที่ หรือเข้าเยี่ยมชมสถานที่จริง ณ โครงการ โทร. 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>');*/
}

