	function setCurPage(oLang){
		var pathUrl = location.href;
		var cPage = pathUrl.split("/")[pathUrl.split("/").length - 1].replace("#","");
		if(oLang=="en")
		{
			if(pathUrl.indexOf("thai")!=-1){
				location.href="../"+cPage;
			}
		}
		else
		{	
			if(pathUrl.indexOf("thai")==-1){
				location.href="thai/"+ cPage;
			}
		}
	}
	


sfHover = function() {
	if(document.getElementById("nav")){
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/* Job Application Form Script */
function createCaret(textEl) {
	if (textEl.createTextRange)
		textEl.caretPos = document.selection.createRange().duplicate();
}

function insertCode(openTag, tagData, closeTag) {
	if (document.all.real_email_message.createTextRange && document.all.real_email_message.caretPos) {
		var caretPos = document.all.real_email_message.caretPos;
		caretPos.text = openTag+caretPos.text+closeTag;
	} else {
		document.all.real_email_message.value += openTag+tagData+closeTag;
		document.all.real_email_message.focus();
	}
}

function putButton(toolTip, textdis, openTag, tagData, closeTag) {
	document.write("<input class=fb type=button value=\"" +textdis+ "\"  onClick=\"javascript:insertCode(\'"+openTag+"\', \'"+tagData+"\', \'"+closeTag+"\');\" onmouseover=\"document.all.tooltip.innerHTML='"+toolTip+"';\" onmouseover=\"document.all.tooltip.innerHTML='';\" onfocus=\"document.all.real_email_message.focus();\">");
}

function preview(){
  prewin=window.open('about:Please wait','prewin','width=500,height=440,top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
  prewin.document.write("<title>Preview window</title><body bgcolor=#CAE4FF><br>");
  prewin.document.write("<table border=0 width=100% cellspacing=0 cellpadding=8 bgcolor=gray style=\"border: 1 dotted gray;\"><tr><td bgcolor=#FFFFFF width=100%><font face=Verdana size=1>");
  prewin.document.write(document.all.real_email_message.value);
  prewin.document.write("</td></tr></table>");
}
//putButton("Bold", "B", "<b>", "", "</b>");

function pop(url,w,h,scroll){
  if(scroll==1) bars='yes';
	else bars='no';
  popwindow= open(url, "popwin","width=" + w + "px,height==" + h + "px,top=0,left=0;fullscreen=no,scrollbars==" + bars + ",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes");
}
/* Job Application Form Script END */

function ShowImage(sImageName,w,h)
{
   if(!w && !h){
	   window.open(sImageName, "Image", "width=250,height=250,status=no,resizable=yes,scrollbars=yes");
   }
   else
   {
	   window.open(sImageName, "Image", "width="+w+",height="+h+",status=no,resizable=yes,scrollbars=yes");
   }
}
function ShowFile(sFileName)
{
   window.open(sFileName, "File", "width=550,height=550,status=no,resizable=yes,scrollbars=yes");
}

var jobFlag;

$(document).ready( function() {
    if($(".firstpage").length > 0){
	    	 	window.open("jobalert.php",  "File", "width=550,height=550,status=no,resizable=yes,scrollbars=no");
	}
});
