//common.js
$(function() {
	$("#loading").ajaxStart(function(){
	   $(this).show();
	}).ajaxStop(function(){
	   $(this).hide();
	});

	var ss = document.location.pathname;
	
	var mo = [
		/^\/(th|en)\/?/, 
		/^\/(th|en)\/about-us\/?/, 
		/^\/(th|en)\/products\/?/, 
		/^\/(th|en)\/news\/?/,
		/^\/(th|en)\/project-ref\/?/,
		/^\/(th|en)\/contact-us\/?/
	];
	var menu = 0;
	$.each(mo, function(i, m) {
		if(m.test(ss)) menu = i;
	});

	var ln = /^\/th\/?/.test(ss) ? 'th' : 'en';
	$('#flash_header').flash({
		src:	'/assest/flash/'+ ln + '/mainnav.swf',
		width:	'515px',
		height: '40px',
		menu:	false,
		wmode:	'transparent',
		flashvars: {'default_menu': menu}
	});

	$('#quick_search form').submit(function() {
		if($(this).find('#keyword').val() == '') {
			$(this).find('#keyword').focus();
			return false;
		}
	});
});

function isIE6() {
	return $.browser.msie && $.browser.version<7;
}
