function mouser_focus(){
	if (document.getElementById('SUB_EMAIL').value == "Fill in your email to subscribe newsletter"){
		document.getElementById('SUB_EMAIL').value = "" ;
	}
}
//--------------------------------

function mouser_out(){
	if (document.getElementById('SUB_EMAIL').value != "" || document.getElementById('SUB_EMAIL').value == "Thank you."){

	} else {
		document.getElementById('SUB_EMAIL').value = "Fill in your email to subscribe newsletter" ;
	}
}
//--------------------------------

function CheckEmail() {
	var str = document.getElementById('SUB_EMAIL').value;
	if ( (str.indexOf(".") < 2) || (str.indexOf("@") < 1) || str == '' )  {
	//	if (!(str == '')) {
			alert('E-mail corret');
			return false;
	//	}
	}
	Subscribe(str);
	return true;
}

//----------------------------------

function Subscribe(e_mail){
	var myConn = new XHConn();
	if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");
	var fnWhenDone = function (oXML) { 
		if (oXML.responseText == "OK"){
			document.getElementById('SUB_EMAIL').value = "Thank you." ;
			alert('Thank you.');
		} else if (oXML.responseText == "ERROR") {
			alert('Sorry Please come back again for the next one.');
		} else if (oXML.responseText == "DUP") {
			alert('You had already done this subscribe.')
		} else {
			alert('Sorry Please come back again for the next one.');
		}
	}
	DataToSend = "mail=" + e_mail + "&cmd=add";
	myConn.connect("subscribe_mail.html", "POST", DataToSend, fnWhenDone);
	return false
}
//---------------------------------------

function changeFAQ(target,answer) {
	var num_abs 
	var type_ques
	if (target == 'ans_hot' || target == '1'){
			target = 'ans_hot'
			num_abs = 8
			type_ques = 1
	} else if (target == 'first' || target == '2'){
			target = 'first'
			num_abs = 4
			type_ques = 2
	} else if (target == 'health' || target == '3'){
			target = 'health'
			num_abs = 4
			type_ques = 3
	} else if (target == 'practice' || target == '4'){
			target = 'practice'
			num_abs = 5
			type_ques = 4
	} else if (target == 'ashtanga' || target == '5'){
			target = 'ashtanga'
			num_abs = 3
			type_ques = 5
	}
	for (i= 1; i <= num_abs; i++ ){
				document.getElementById(target+'_'+i).style.display = "none";
				document.getElementById('ques_' +type_ques+'_'+i).style.color = "";
			if (i == answer){
				document.getElementById(target+'_'+i).style.display = "";
				document.getElementById('ques_' +type_ques+'_'+i).style.color = "#ff0066";
			}
	}
}
//------------------------------------------------------
function highlightFAQ(flag,target) {
	if (flag == "yes"){
		document.getElementById('ques_' +target+'_'+'1').style.color = "#ff0066";
	} else if (flag == "no") {
		alert(flag);
		alert(target);
		document.getElementById('ques_' +target+'_'+'1').style.color = "";
	}
}
//---------------------------------------------------------------------------
function changeTypeFAQ(target,lang) {
	for (i=1;i <=5 ; i++){
			document.getElementById('faq_text_'+i).style.color="";
			document.getElementById('table_faq_'+i).style.display="none";
			if (i == target){
				document.getElementById('faq_text_'+i).style.color="#ff0066";
				document.getElementById('table_faq_'+i).style.display="";
			}
	}
	document.getElementById('img_faq').style.backgroundImage="url(./images/faq_"+target+"_"+lang+".png)";
	document.getElementById('img_faq').style.backgroundPosition="top center";
	document.getElementById('img_faq').style.backgroundRepeat="no-repeat";
	changeFAQ(target,'1'); 
}
//---------------------------------------------------------------------------

function changeTestimonial(target,lang) {
	for (i=1;i <=4 ; i++){
			document.getElementById('faq_text_'+i).style.color="";
			document.getElementById('table_faq_'+i).style.display="none";
			if (i == target){
				document.getElementById('faq_text_'+i).style.color="#ff0066";
				document.getElementById('table_faq_'+i).style.display="";
			}
	}
//	CheckResolution();
}
//---------------------------------------------------------------------------
function changeschedules(target,lang){
	
	for (i=1;i <=6 ; i++){
		document.getElementById('faq_text_'+i).style.color="";
		if (i == target){
				document.getElementById('faq_text_'+i).style.color="#ff0066";
			//	document.getElementById('table_faq_'+i).style.display="";
			}
	}
	document.getElementById('img_faq').style.backgroundImage="url(./images/classes_schedules_"+target+"_"+lang+".png)";
}
//---------------------------------------------------------------------------
function showdes(obj){
	for (i= 1; i <= 12; i++ ){
				document.getElementById("des_"+i).style.display = "none";
				
				document.getElementById("link_present_"+i).style.display = "none";
				document.getElementById("link_"+i).style.display = "";
			if (i == obj){
				document.getElementById("des_"+i).style.display = "";
				
				document.getElementById("link_present_"+i).style.display = "";
				document.getElementById("link_"+i).style.display = "none";
			}
	}
	document.getElementById('img_des').style.backgroundImage="url(./images/img_des_"+obj+".png)";
	if (obj == 11){
		document.getElementById('img_des').style.backgroundPosition="0% 100%";
	} else {
		document.getElementById('img_des').style.backgroundPosition="0% 80%";
	}
	document.getElementById('img_des').style.backgroundRepeat="no-repeat";
}
//---------------------------------------------------------------------------
function showside_pic(obj){
	for (i= 1; i <= 27; i++ ){
				document.getElementById("t_"+i).style.display = "none";
				document.getElementById("link_"+i).style.display = "";
				document.getElementById("link_present_"+i).style.display = "none";
				document.getElementById("des_"+i).style.display = "none";
			if (i == obj){
				document.getElementById("t_"+i).style.display = "";
				document.getElementById("des_"+i).style.display = "";
				document.getElementById("link_"+i).style.display = "none";
				document.getElementById("link_present_"+i).style.display = "";
			}
	}
}
//---------------------------------------------------------------------------
function changeStudios(obj){
	for (i= 1; i <= 8; i++ ){
				document.getElementById("studio_"+i).style.display = "none";
				
			if (i == obj){
				document.getElementById("studio_"+i).style.display = "";
			}
	}
	
}
//---------------------------------------------------------------------------
function chang_location(lang){
	var location_id = document.getElementById('SCHEDULES').value
//	if (location_id == 1){ 
		location.replace("classes_schedules5445.html?id=" + location_id +"&lang=" + lang);
//	}
}
//---------------------------------------------------------------------------
function launch(url, w_width, w_height) {
	window.open(url, 'page'+w_width+w_height,'titlebar=no,top=0,left=0,width=' + w_width +',height=' + w_height +',screenX=0,screenY=0,top=0,left=0,scrollbars=1');
}
//---------------------------------------------------------------------------
function checkSubmit(page) {
	if (page == 'contact'){
		if (document.getElementById('NAME').value == "" && document.getElementById('MOBILE').value == "" && document.getElementById('EMAIL').value == ""  && document.getElementById('INQUIRIES').value == ""){
			alert('Please input information')
			return false;
		}
	}
	PressSubmit();
}
//---------------------------------------------------------------------------------
function PressSubmit() {
	document.getElementById('form1').submit();
}
//-----------------------------------------------------------------------------
function formReset(){
	document.getElementById("form1").reset()
}
//---------------------------------------------------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

window.onload = CheckResolution;

function CheckResolution(){
	var aWidth,aHeight;
	if (location.href.indexOf("teachers_profile.html") >= 1){
		MM_preloadImages('images/n_ben.png','images/n_john.png','images/n_harreson.png','images/n_angela.png','images/n_gee.png','images/n_luke.png','images/n_sherry.png','images/n_mon.png','images/n_ake.png','images/n_ple.png','images/n_big.png','images/n_oh.png','images/n_racket.png','images/n_bee.png','images/n_candy.png','images/n_ying.png','images/n_vindie.png','images/n_merritt.png','images/n_shaun.png','images/n_anna.png','images/n_pim.png','images/n_kim.png','images/n_art.png','images/n_pong.png','images/n_golf.png','images/n_bb.png','images/n_nong.png');
	}
	
	if (self.innerHeight) { // all except Explorer
		aWidth = self.innerWidth;
		aHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		aWidth = document.documentElement.clientWidth;
		aHeight = document.documentElement.clientHeight;
	} else if (document.body) {  // other Explorers
		aWidth = document.body.clientWidth;
		aHeight = document.body.clientHeight;
	}
	
	aHeight = document.body.scrollHeight;
	row_height = aHeight - 130 - 792 - 20;
	var page_array =new Array("membership_","classes_schedules.html","news_","about_us_testimonial.html");
	for (i=0;i < page_array.length ; i++){
		if (location.href.indexOf(page_array[i]) >= 1){
			innerhtml = '<img src="./images/themes/dot.gif" width="1" height="' + row_height +'" />';
			document.getElementById('table_mini_left').innerHTML = innerhtml;
		}
	}
	var page_array2 =new Array("http://www.absoluteyogabangkok.com/about_us.php");
//	for (i=0;i < page_array2.length ; i++){
//		if (location.href.indexOf(page_array2[i]) >= 1){
			aHeight = document.body.scrollHeight;
			
			row_height = aHeight - 197;
			col_width = ((aWidth - 1000-25) / 2)-1;
			if (col_width < 1 ){
				col_width =1 
			}
//			alert(aHeight);
			innerhtml = '<img src="./images/dot.gif" width="1" height="' + row_height +'" />';
			document.getElementById('border_height_left').innerHTML = innerhtml;
			document.getElementById('border_height_right').innerHTML = innerhtml;
//alert(innerhtml);
			innerhtml = '<img src="./images/dot.gif" width="' + col_width +'" height="196" />';
			document.getElementById('border_width_left').innerHTML = innerhtml;
			document.getElementById('border_width_right').innerHTML = innerhtml;
	//	}
//	}
}
