/*---------------------------------------------------------------------------*/
function getDateClient(para) {
	var d = new Date();
	var y = parseInt(d.getYear());
	y %= 100;
	if (y < 10) y = "0" + y;
	if (para == "en") {
		var weekday 	= ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
		var monthday 	= ['January','February','March','April','May','June','July','August','September','October','November','December'];
		document.getElementById("spnDate").innerHTML = "<b>" + weekday[d.getDay()] + "</b>,&nbsp;" + monthday[d.getMonth()] + "&nbsp;" + d.getDate() + ",&nbsp;" + "20" + y;
	} else {
		var weekday 	= ['Ch&#7911; nh&#7853;t','Th&#7913; hai','Th&#7913; ba','Th&#7913; t&#432;','Th&#7913; n&#259;m','Th&#7913; s&aacute;u','Th&#7913; b&#7843;y'];
		var monthday 	= ['01','02','03','04','05','06','07','08','09','10','11','12'];
		document.getElementById("spnDate").innerHTML = "<b>" + weekday[d.getDay()] + "</b>,&nbsp;ng&agrave;y&nbsp;" + d.getDate() + "/"  + monthday[d.getMonth()] + "/" + "20" + y;
	}
}

function showImage(url) {
	var img = new Image();
	img.src = url;
	w = img.width;
	h = img.height;
	t=(screen.availHeight - h)/2;
	l=(screen.availWidth - w)/2;
	window.open(url,"","width=" + (w + 20)+ "px,height=" + (h + 20)+ ",top=" + t +"px,left=" + l + "px,resizable=0,status=0,scrollbars=yes");
}

// tim control
function $$(id) {
	return document.getElementById(id);
}
function trimSpace(s) {
	for (i=0;i<s.length;i++)
		s = s.replace("&nbsp;"," ");
	while(s.charCodeAt(0)==32 && s.length>1) {
		s=s.substr(1,s.length)
	}
	
	//-------------------------
	if(s.charCodeAt(0)==32 && s.length==1)
		return "";
	else
		return s;
}
function isEmail(email) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(email);
}

function Trim(s) {
	return trimSpace(s);
}
function CompDate(strDate1,strDate2){
		var m1, d1, y1;
		var m2, d2, y2;
		var s, pos1, pos2;
		var s = strDate1, s1 = strDate2;
		if (s.length == 0 || s1.length == 0) return true;

		pos1 = s.indexOf("/",0);
		pos2 = s.indexOf("/",pos1+1);
		d1 = parseInt(s.substr(0,pos1),10);
		m1 = parseInt(s.substr(pos1+1,pos2-pos1-1),10);
		y1 = parseInt(s.substr(pos2+1,s.length-pos2),10);
		
		pos1 = s1.indexOf("/",0);
		pos2 = s1.indexOf("/",pos1+1);
		d2 = parseInt(s1.substr(0,pos1),10);
		m2 = parseInt(s1.substr(pos1+1,pos2-pos1-1),10);
		y2 = parseInt(s1.substr(pos2+1,s1.length-pos2),10);
		
		var d1 = new Date(y1,m1,d1);
		var d2 = new Date(y2,m2,d2);
		if (d1 > d2 || d1 == d2) 
			return true;
		else
			return false;
	}
