function initArray() {
	for(i=0;i<initArray.arguments.length; i++) {
		this[i] = initArray.arguments[i];
	}
}
function getFullYear(d) { // d is a date object
	yr = d.getYear();
	if (yr < 1000)
	yr+=1900;
	return yr;
}
function outDate(){
	var isnMonths=new initArray("01","02","03","04","05","06","07","08","09","10","11","12");
	var isnDays= new initArray("Ch&#7911; nh&#7853;t","Th&#7913; 2","Th&#7913; 3","Th&#7913; 4","Th&#7913; 5","Th&#7913; 6","Th&#7913; 7","Ch&#7911; nh&#7853;t");
	today=new Date();		
	document.write("<b><font face=Verdana color=#FF6600 size=1>" + (today.getDate()<10?("0"+today.getDate()):(today.getDate())) + "-" +isnMonths[today.getMonth()]+"-" + getFullYear(today) + "</font></b>");

}
function checkTextBoxSearch (str) {
	var textVal = str.value;	
	if (textVal == '') {
		alert("Nhap vao noi dung tim kiem");
		str.focus();
		return false;
	}
	return true;
}
function checkPassword(str) {
	var textVal = str.value;	
	if (textVal == '') {
		alert("Nhap vao mat khau");
		str.focus();
		return false;
	}
	return true;

}
function checkEmail(str){
	var textValue = str.value;
	var err=''
	if (textValue == ''){
		err += "Dia chi email khong hop le";
		alert(err);
		str.focus();
		return false
	}
	if (textValue.indexOf('@') <= 0 || textValue.indexOf('@') == textValue.length -1){
		err += "Dia chi email khong hop le";		
	} else {
		var substr = textValue.substring(textValue.indexOf('@'),textValue.length);
		if (textValue.indexOf('.') <= 0) {
			err += "Dia chi email khong hop le\n";
		}
	}
	if (err != '') { 
		alert(err); 
		str.focus();
		return false;
	}
	return true;
}

function fnCategories(s){	
	
	var whereId = document.frm_main.where_id.options[document.frm_main.where_id.selectedIndex].value;	
	var catId = document.frm_main.cat_id.value;
	var subCatId = document.frm_main.sub_cat_id.value;	
	var sel = document.frm_main.sel.value;	
	var title = document.frm_main.title.value;	
	var url = s + "&cat_id=" + catId + "&sub_cat_id=" + subCatId + "&sel=" + sel +"&where_id=" + whereId + "&title=" + title;
	document.location = url;
	
}	

/* IE and NS6+ */
/* begin no click right */
function clickIE() {
	if (document.all) {
		return false;
	}
}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which==2||e.which==3) {
			return false;
		}
	}
}
function disable() {
/*
	if (document.layers) {
		document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
	} else {
		document.onmouseup=clickNS;document.oncontextmenu=clickIE;
	}

	document.oncontextmenu=new Function("return false")
*/
}
/*****************************/
 disable();
/*****************************/


