// JavaScript Document
var ie4=document.all
var ns6=document.getElementById&&!document.all

function confirm_check(url,mess)
{
	anser=confirm(mess)
	
	if(anser==true)
		window.location = url
}
function linkto(url)
{
	window.location = url
}
function checknumber(o)
{
	message="Chi duoc nhap so"
	if(isNaN(o.value))
	{
		error_message ="* " + message + "\n"
		alert(error_message)
		o.value=''
		//o.select()
		return false
	}
	else return true
}
function checkemty(o,message)
{	
	if(o.value=="")
	{
		o.focus()
		error_message ="* " + message + "\n"
		alert(error_message)
		return true
	}
	else return false
}
function checkemail(e,message)
{
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
	var returnval=emailfilter.test(e.value)
	if (returnval==false)
	{
		alert(message)
		e.select()
		return false
	}
	return true
}
function checkpassword(pass,cpass,message)
{
	if(pass.value!=cpass.value)
	{
		alert(message)
		return false
	}
	return true
}
function creatTextBox(name,value,stye)
{
	return "<input name='"+name+"' value='"+value+"' "+stye+" />"
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random")
	{
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center")
	{
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else 
		if((pos!="center" && pos!="random") || pos==null)
		{
			LeftPosition=0;
			TopPosition=20
		}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);}
// -->
function xemphieu(url)
{
	//alert(url)
	NewWindow(url,'mywin','600','340','yes','center')
}
function printpage()
{
	window.print()
}
function display(objname)
{
	o = document.getElementById(objname);
	
	if(o.style.display == 'none')
	{
		o.style.display = '';
	}
	
}
function intiSype(objname)
{
	o = document.getElementById(objname);
	o.style.marginTop = "70px";
}
function displaypos(objname,pos)
{
	o = document.getElementById(objname);
	
	//alert(o.clientHeight)
	//alert(o.offsetTop)
	//alert(o.offsetBottom)
	
	//var d = document;
	//alert(d.body.clientWidth)
	//alert(d.body.clientHeight)
	if(o.style.display == 'none')
	{
		o.style.display = '';
		offsetBottomdiv = o.offsetTop + o.offsetHeight
		offsetBottompage = ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight
		//offsetBottompage =window.pageYOffset+window.innerHeight
		//alert(offsetBottomdiv)
		//alert(offsetBottompage)
		if(offsetBottomdiv > offsetBottompage)
		{
			o.style.marginTop =  -o.offsetHeight + pos  + "px";
		}
		offsetBottomdiv = o.offsetTop + o.offsetHeight
		//alert(offsetBottomdiv)
		//alert(offsetBottompage)
		//alert(o.offsetHeight)
		if(offsetBottomdiv  > offsetBottompage)
		{
			o.style.marginTop =  -o.offsetHeight  + "px";
		}
		
	}
	
		
}
function iecompattest()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function hiddenTimeOut(objname,time)
{
	setTimeout("hidden('"+objname+"')",time)
}
function hiddeninti(objname)
{
	o = document.getElementById(objname);
	o.style.display = 'none';
	intiSype(objname)
}
function hidden(objname)
{
	o = document.getElementById(objname);
	o.style.display = 'none';
	
}
