/////////////////	onload	/////////////////
window.onload = function (){
var allA = document.getElementById('main').getElementsByTagName('a');
	for(var i=0;i<allA.length;i++){
		allA[i].onmouseover = function (){window.status = this.title;return true}
		allA[i].onmouseout = function (){window.status = '';return true}
	}


window.moveTo(0,0);
if(document.all){
	window.resizeTo(screen.availWidth, screen.availHeight);
}else if(document.layers || document.getElementById){
	if(window.outerHeight < screen.availHeight || window.outerWidth < screen.availWidth){
		window.outerHeight = screen.availHeight;
		window.outerWidth = screen.availWidth;
	}
}

};

/////////////////	end onload	/////////////////

var win=null;
function popWindow(mypage,myname,w,h,scroll){

LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;

settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);

};

/////////////

function isEmail(string){
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
		return true;
	}else{
		return false;
	}
};

/////////////

// work with moo

var txt_guide = 'Type your email here';

window.addEvent('domready', function(){

//#apply for e-news letter

	$('str_email_news_letter').addEvent('focus', function(e){
		if($('str_email_news_letter').value == txt_guide){
			$('str_email_news_letter').set('value', '');
		}
		e.stop();
	});

	$('str_email_news_letter').addEvent('blur', function(e){
		if($('str_email_news_letter').value == ''){
			$('str_email_news_letter').set('value', txt_guide);
		}
		e.stop();
	});

	$('b_subscribe').addEvent('click', function(e){
		if($('str_email_news_letter').value == '' || $('str_email_news_letter').value == txt_guide){
			alert('Please enter your email');
			return false;
		}else{
			return true;
		}
		e.stop();
	});

// lang

	$('langTH').addEvent('click', function(e){
		langSel('th');
		e.stop();
	});
	$('langEN').addEvent('click', function(e){
		langSel('en');
		e.stop();
	});

	//new SmoothScroll({duration:700}, window);

/*to work with css class
	$$('div.textBox').addEvent('mouseover', function(e){
		$$('div.textBox').set('html', 'yeah');
		e.stop();
	});
*/
});


