﻿//------------------ 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="sirikanda.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgSaransithorn\',\'\',\'images/m_sirikanda.gif\',1)"><img src="images/m_sirikanda.gif" alt="สริรกานดา" name="imgSaransithorn" width="149" height="14" border="0" id="imgSaransithorn" /></a>'
menu_unit[1]='<a href="siriyada.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgSaranwasa\',\'\',\'images/m_siriyada.gif\',1)"><img src="images/m_siriyada.gif" alt="สิริญาดา" name="imgSaranwasa" width="149" height="14" border="0" id="imgSaranwasa" /></a>'
menu_unit[2]='<a href="siriladda.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgSaranramai\',\'\',\'images/m_siriladda.gif\',1)"><img src="images/m_siriladda.gif" alt="สิริลัดดา" name="imgSaranramai" width="149" height="14" border="0" id="imgSaranramai" /></a>'
menu_unit[3]='<a href="sirinuntha.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgSaranvalai\',\'\',\'images/m_sirinuntha.gif\',1)"><img src="images/m_sirinuntha.gif" alt="สิรินันทา" name="imgSaranvalai" width="149" height="14" border="0" id="imgSaranvalai" /></a>'
menu_unit[4]='<a href="sirinalin.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgSaranruthai\',\'\',\'images/m_sirinalin.gif\',1)"><img src="images/m_sirinalin.gif" alt="สิรินลิน" name="imgSaranruthai" width="149" height="14" border="0" id="imgSaranruthai" /></a>'
menu_unit[5]='<a href="sirinonsi.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'imgSaranruthai\',\'\',\'images/m_sirinonsri.gif\',1)"><img src="images/m_sirinonsri.gif" alt="สิรินนทรี" name="imgSaranruthai" width="149" height="14" border="0" id="imgSaranruthai" /></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_sts.gif" width="133" height="73" border="0" /></a></td>');
	document.write('<td><img src="images/title_sts_en.gif" width="350" height="63" /></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="78" 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_showth.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 align="center">');
	//document.write('<div style="position:absolute; width: 952px; height: 345px;"><table width="952" border="0" cellpadding="0" cellspacing="0"><tr><td align="right" valign="top"><img src="images/promotion.gif" border="0"></td></tr></table></div>');
	switch(section) {
			case "info" :
			document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "unit" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		
		case "ready" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
			
		case "sirisita" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "sirinuntha" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "siriyada" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
		     //writeFlash('images/flashbanner.swf',952,345);
			break;
		case "sirikanda" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "siriladda" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "sirinalin" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;		
		case "sirinonsi" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
		case "activity" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;	
		case "contact" :
		document.write('<img src="images/sb8.jpg" width="724" height="345" />');
			document.write('<img src="images/sb8_promotion_en.jpg" width="228" height="345" />');
			//writeFlash('images/flashbanner.swf',952,345);
			break;
	}
	document.write('</td></tr>');
}

function writeMenu(section) {
	switch(section) {
		case "sirisita" :
		case "sirikanda" :
		case "siriyada" :
		case "siriladda" :
		case "sirinuntha" :
		case "sirinalin" :
		case "sirinonsi" :
			section ="unit";
			break;
	}
	document.write('<tr><td>');
	document.write('<table width="100%" border="0" td background="images/bg_menu.gif" 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')+'.gif" alt="Project Information" width="159" height="35" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="unit.html"><img src="images/m_housetype'+ ((section=='unit')?'2':'1')+'.gif" alt="House Type" width="152" height="35" 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=50"><img src="images/m_readyen'+ ((section=='ready')?'2':'1')+'.gif" alt="Ready to Move in" width="207" height="35" border="0"/></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="/th/project/setthasiri/bangna_wongwaen/360tour/outside/index_en.html" target = "blank"><img src="images/m_virtualtour'+ ((section=='vrtour')?'2':'1')+'.gif" alt="Virtual Tour 360" width="169" height="35" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="activity.html"><img src="images/m_activity'+ ((section=='activity')?'2':'1')+'.gif" alt="activity" width="98" height="35" border="0" /></a></td>');
	writeMenubar(); // bar
	document.write('<td><a href="contact.html"><img src="images/m_contact'+ ((section=='contact')?'2':'1')+'.gif" alt="Contact Us" width="147" height="35" 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="1" height="35" 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">Copyright&copy; 2009. Sansiri Public Co., Ltd. All right reserved. <b>One of quality project of </b><img src="images/logo_sts_s.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: 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>');*/
}

