function checkEmail(email)
{	if ((email.indexOf("..") != -1) ||
		(email.indexOf(".@") != -1) ||
		(email.indexOf("@.") != -1) ||
		(email.indexOf(".") == -1) ||
		(email.indexOf("@") == -1) ||
		(email.indexOf(" ") == 1) ||
		(email.indexOf("@") > email.indexOf(".")) ||
		(email.indexOf("@") != email.lastIndexOf("@")) ||
		(email.indexOf("@") == 0) ||
		(email.indexOf(".") == (email.length - 1))
		) return false;
	var str = "1234567890abcdefghikjlmnopqrstuvwxyz-@._"; 
	for (i = 0; i < email.length; i++)
		if (str.indexOf(email.charAt(i)) == -1) return false;
	return true;
}
function autodisplay(obj, value)
{	for (i = 0; i <obj.length; i++ )
	{	if (obj[i].value == value)
			obj[i].selected = true;
	}
}
function check_spec_char(name, capsLock)
{	var str = "";
	if (capsLock)
		str = "1234567890ABCDEFGHIKJLMNOPQRSTUVWXYZabcdefghikjlmnopqrstuvwxyz";
	else
		str = "1234567890abcdefghikjlmnopqrstuvwxyz-@._";
	for (i = 0; i < name.length; i++)
		if (str.indexOf(name.charAt(i)) == -1) return false;
	return true;
}
function CheckEmail_search(obj){
    var re = /^([A-Za-z0-9\_\-]+\.)*[A-Za-z0-9\_\-]+@[A-Za-z0-9\_\-]+(\.[A-Za-z0-9\_\-]+)+$/;
    var sEMail = obj.value;
    if (sEMail.search(re) == -1){
			return (false);
		}
	else{
		return (true);
    }
}
function view_win(url)
{	
	var property = "width=300px,height=400px,resizable=yes,scrollbars=yes,status=0,top=0px,left=150px";	
	window.open(url,"a",property);
}
function mo(page) {
	var position_x = (screen.height - 300)/2;
    var position_y = (screen.width - 298)/ 2;
    var property = "width="+298+", height="+118+", top="+position_x+", left="+position_y+", resizable = no";
   this.open(page, "CtrlWindow", property);
}
function nho(page) {
	var position_x = (screen.height - 300)/2;
    var position_y = (screen.width - 298)/ 2;
    var property = "width="+298+", height="+30+", top="+position_x+", left="+position_y+", resizable = no";
   this.open(page, "CWindow", property);
}
function xehang(page) {
	var position_x = (screen.height - 300)/2;
    var position_y = (screen.width - 298)/ 2;
    var property = "width="+298+", height="+230+", top="+position_x+", left="+position_y+", resizable = no";
   this.open(page, "CtrlWindow", property);
}


function xemgiohang(page) {
	var position_x = (screen.height - 350)/2;
    var position_y = (screen.width - 800)/ 2;
    var property = "width="+780+", height="+320+", top="+position_x+", left="+position_y+", resizable = no, scrollbars = yes";
View = this.open(page, "CWindow", property);
}

function canhbao(page) {
	var position_x = (screen.height - 300)/2;
    var position_y = (screen.width - 298)/ 2;
    var property = "width="+298+", height="+118+", top="+position_x+", left="+position_y+", resizable = no";
Wall = this.open(page, "CWindow", property);
}

function ZoomIn()
{
	fsize = chuoi.style.fontSize;
	fsize = fsize.substring(0,2);
	fsize = parseInt(fsize);
	if(fsize<=13)
	{
		fsize = fsize + 1;
		chuoi.style.fontSize = fsize+"pt";
	}
}

function ZoomOut()
{
	fsize = chuoi.style.fontSize;
	fsize = fsize.substring(0,2);
	fsize = parseInt(fsize);
	if(fsize>=8)
	{
		fsize = fsize - 1;
		chuoi.style.fontSize = fsize+"pt";
	}
}

font_arr = Array("Arial","Tahoma","Times New Roman","Verdana");
font_i = 0;

function ChangeFont()
{
	font_i++;
	chuoi.style.fontFamily = font_arr[font_i];
	if(font_i==font_arr.length-1) font_i=-1;
}

String.prototype.trim = function()
{
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
};