<!--
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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}

function emotions(text) {
	document.forms['form1'].content.value +="[" + text + "]";
	document.forms['form1'].content.focus();
}

function textformat(text) {
	if(text==null) {
		textmsg = prompt("Hay nhap vao dia chi website : ","http://");
		if(textmsg!=null&&textmsg!="http://") {
			document.forms['form1'].content.value +="[links]" + textmsg + "[/links]";
		}
	} else {
		document.forms['form1'].content.value +="[" + text + "]noi dung[/" + text + "]";
	}	
	document.forms['form1'].content.focus();
}

function MM_openBrWindow(theURL, winName, features, w , h) { //v2.0
	isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
	var posTop = Math.round(screen.height/2 - h/2);
	var posLeft = Math.round(screen.width/2 - w/2);
	if(isIE) {		
		features += ',top=' + posTop + ', left='+posLeft+', width='+w+', height='+h;
	}
	else {
		features += ',screenY=' + posTop + ', screenX='+posLeft+', width='+w+', height='+h;
	}
	
	mypopup = window.open(theURL,winName, features);
	mypopup.focus();
}

//-- show current date from local user in English
function showDateENG() {
// variables declaration
var dt=new Date();
var strMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var strDay = new Array("Sunday","Monday","Tuesday","Wednessday","Thursday","Friday","Saturday");
var date= "<b>"+strDay[dt.getDay()] + "</b>, ";
var years=dt.getYear();
if (years<1900) years+= 1900;
return (date += strMonth[dt.getMonth()] + " "+dt.getDate()+", "+years);
}

function showDateVN() {
// variables declaration
var dt=new Date();
var strMonth = new Array("th&#225;ng Gi&#234;ng","th&#225;ng 2","th&#225;ng 3","th&#225;ng 4","th&#225;ng 5","th&#225;ng 6","th&#225;ng 7","th&#225;ng 8","th&#225;ng 9","th&#225;ng 10","th&#225;ng 11","th&#225;ng Ch&#7841;p");
var strDay = new Array("Ch&#7911; Nh&#7853;t","Th&#7913; Hai","Th&#7913; Ba","Th&#7913; T&#432;","Th&#7913; N&#259;m","Th&#7913; S&#225;u","Th&#7913; B&#7843;y");
var date= strDay[dt.getDay()] + " ,&nbsp; ng&#224;y ";
var years= dt.getYear();
if (years<1900) years+= 1900;
return (date += dt.getDate()+" "+strMonth[dt.getMonth()] + " n&#259;m "+years);
}

//-- show current date from local user in France
function showDateFR() {
// variables declaration
var dt=new Date();
var strMonth = new Array("Janvier","F&#233;vrier","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","D&#233;cembre");
var strDay = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
var date= ":: Aujourd'hui est " + strDay[dt.getDay()] + ", ";
var years=dt.getYear();
if (years<1900) years+= 1900;
return (date += strMonth[dt.getMonth()] + " "+dt.getDate()+", "+years);
}

function showhidden(msgID) {
	var x;
	x=document.getElementById(msgID);
	x.style.visibility=(x.style.visibility=="hidden"?"visible":"hidden");	
}

function showLayer(msgID,sVal) {
	var x;
	sVal=(sVal=="show"||sVal=="visible")?"visible":"hidden";
	x=document.getElementById(msgID);
	if(x.style.visibility!=sVal) x.style.visibility=sVal;
}
function checkEmail(email){
	 return !!email.match(/^[A-Za-z0-9\._\-+]+@[A-Za-z0-9_\-+]+(\.[A-Za-z0-9_\-+]+)+$/);
 
}

function checkUserid(uid){
	 return !!uid.match(/^[A-Za-z]+[A-Za-z0-9_]*$/);
 
}
// For all cookie
function createCookie(name, value, days)
{
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
  return null;
}

function eraseCookie(name)
{
  createCookie(name, "", -1);
}

// for form reservation submit
function refresh_captcha(img_id, url) {
		document.getElementById(img_id).src=url+'?session='+Math.random();				
	}
	
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function getStyle(el,prop) {
	var x = document.getElementById(el);	
	if (window.getComputedStyle)
		return document.defaultView.getComputedStyle(x,null).getPropertyValue(prop);
	else 
		return x.currentStyle[prop];
}
// change css live
function setStylesheet(title){
	var i, cacheobj, altsheets=[""];
	for(i=0; (cacheobj=document.getElementsByTagName("link")[i]); i++) {
		if(cacheobj.getAttribute("rel").toLowerCase()=="alternate stylesheet" && cacheobj.getAttribute("title")) { 
			cacheobj.disabled = true
			altsheets.push(cacheobj) //store reference to alt stylesheets inside array
			if(cacheobj.getAttribute("title") == title) //enable alternate stylesheet with title that matches parameter
				cacheobj.disabled = false //enable chosen style sheet
		}
	}
}
//-->