/**
* Javascript library
* Copyright Hieuhoc.com 2008
**/
root="http://www.hieuhoc.com/";
/**
* Utility Functions
*******************************************************************************
**/

/**
* Preload the images
**/
if (document.images)
{
  pic1 = new Image(1,1); 
  pic1.src = root + "Images/btnStandard.gif"; 

  pic2 = new Image(1,1); 
  pic2.src = root + "Images/btnStandardPress.gif"; 

  pic3 = new Image(1,1); 
  pic3.src = root + "Images/btnSearchPress.gif"; 
  
  pic4 = new Image(1,1); 
  pic4.src = root + "Images/btnSearch.gif"; 
}

/**
* Function: trim
* Dung nhu ham trim cua PHP
* Input: chuoi can trim
* Output: chuoi sau khi trim
**/
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

/**
* Function: courseChecked
* Dung cho form advanced search, neu radio button khoa hoc duoc check thi
* textbox truong se bi disable va nguoc lai
**/
function courseChecked()
{
	document.getElementById('rad_TrungTamDaoTao').checked=false;
	document.getElementById('txt_TrungTamDaoTao').disabled=true;
	document.getElementById('txt_TrungTamDaoTao').value="";
	document.getElementById('txt_KhoaHoc').disabled=false;
	document.getElementById('txt_KhoaHoc').focus(); 
}

/**
* Function: schoolChecked
* Dung cho form advanced search, neu radio button khoa hoc duoc check thi
* textbox truong se bi disable va nguoc lai
**/
function schoolChecked()
{
	document.getElementById('rad_KhoaHoc').checked=false;
	document.getElementById('txt_KhoaHoc').disabled=true;
	document.getElementById('txt_KhoaHoc').value="";
	document.getElementById('txt_TrungTamDaoTao').disabled=false;
	document.getElementById('txt_TrungTamDaoTao').focus();
}

/**
* Cac hÃ m tao hieu ung cho cac button
**/

function btnMouseDown(btnID)
{
	//btnStyle=document.getElementById(btnID).style;
	//btnStyle.backgroundImage = "url(" + root + "Images/btnStandardPress.gif)";
}

function btnMouseUp(btnID)
{
	//btnStyle=document.getElementById(btnID).style;
	//btnStyle.backgroundImage = "url(" + root + "Images/btnStandard.gif)";
}

function btnSearchMouseDown()
{
	//btnStyle=document.getElementById('btnSearch').style;
	//btnStyle.backgroundImage = "url(" + root + "Images/btnSearchPress.gif)";
}

function btnSearchMouseUp()
{
	//btnStyle=document.getElementById('btnSearch').style;
	//btnStyle.backgroundImage = "url(" + root + "Images/btnSearch.gif)";
}



/**
* Validation Functions
******************************************************************************
**/

/**'
* Function: isBlank
* Check 1 textbox, neu trong tra ve true, neu co du lieu tra ve false. Use for
* form, no message box.
* Input: 1. Id cua textbox 2. Thong bao loi neu textbox trong
* Output: true va alert neu textbox rong, false neu khong rong
**/
function isBlankForm(textid,errorid,msg){
    var temp=document.getElementById(textid);
    if(trim(temp.value)=='')
    {
        document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;';
        temp.value="";
        return true;
    }
    else
    {
        document.getElementById(errorid).innerHTML = '';
        return false;
    }
    
}

/**'
* Function: isBlank
* Check 1 textbox, neu trong tra ve true, neu co du lieu tra ve false
* Input: 1. Id cua textbox 2. Thong bao loi neu textbox trong
* Output: true va alert neu textbox rong, false neu khong rong
**/
function isBlank(textid,msg){
	var temp=document.getElementById(textid);
	if(trim(temp.value)=='')
		{
            alert(msg);
			temp.value="";
			temp.focus();
			return true;
		}
	else
		return false;
}

/**
* Function: isValidEmail
* Check 1 email hop le
* Input: Id cua textbox chua email
* Output: true neu hop le, false neu ko hop le
**/
function isValidEmail(mailid,errorid){
	temp    =document.getElementById(mailid);
	str     =temp.value;
	strlen  =str.length;
	msg     ='Vui lòng nhập e-mail hợp lệ theo mẫu: mail@domain.com';
    regex   = /^[a-zA-Z0-9\._-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4})$/;
    
    // Neu mail = '' return true
    if(str == '')
    {
        //document.getElementById(errorid).innerHTML='';
        return true;
    }
    
    if( !str.match(regex) )
    {
        document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
        return false;
    }                
    
	return true;
}


/**
* Function: isValidEmail
* Check 1 email hop le, ko write bao loi ra ngoai
* Input: Id cua textbox chua email
* Output: true neu hop le, false neu ko hop le
**/
function isValidEmailNoError(mailid){
    temp=document.getElementById(mailid);
    str=temp.value;
    at='@';
    dot='.';
    strlen=str.length;
    atpos=str.indexOf(at);
    dotpos=str.indexOf(dot);
    
    // Neu mail = '' return true
    if(temp.value=='')
    {
        //document.getElementById(errorid).innerHTML='';
        return true;
    }
                            
    // khong co @, @ o dau, @ o cuoi
    if(atpos == -1 || atpos == 0 || atpos == strlen-1)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;';
            temp.focus();
            return false;
        }
    // khong co cham, cham o dau, cham o cuoi
    if(dotpos == -1 || dotpos == 0 || dotpos == strlen-1)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
            temp.focus();
            return false;
        }
    //khong co cham sau @
    if(str.indexOf(dot,(atpos+2)) == -1)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
            temp.focus();
            return false;
        }
    //cham ngay truoc va ngay sau @
    if(str.substring(atpos-1,atpos) == dot || str.substring(atpos,atpos+1) == dot)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
            temp.focus();
            return false;
        }
    //co khoang trang trong mail
    if(str.indexOf(' ') != -1)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
            temp.focus();
            return false;
        }
    //ten domain co >4 ky tu
    var tag=str.substring(strlen-5,strlen);
    if(tag.indexOf(dot) == -1)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
            temp.focus();
            return false;
        }
    else if(tag.indexOf(dot) == 3)
        {
            //document.getElementById(errorid).innerHTML = '&nbsp;'+msg+'&nbsp;'; 
            temp.focus();
            return false;
        }

    return true;
}

/**
* Function: checkQuickSearch
* Kiem tra quick search textbox truoc khi submit
* Output: true neu searchbox ko rong, false neu searchbox rong
**/
function checkQuickSearch()
{
    if(document.getElementById('searchBox').value=='')
    {
        document.getElementById('searchBox').focus();
        return false;
    }
		
	else
		return true;
}

/**
 * Function: checkSubscribe
 * Kiem tra box subscribe to newsletter truoc khi submit
 * Textbox ko duoc trong va email nhap vao phai hop le
 * Ouput: true neu hop le, false neu ko hop le
 **/
function checkSubscribe(url)
{
	/*if(isBlankForm('emailBox','subscribeError','Vui lòng nhập e-mail đăng ký'))
		return false;*/
        
    if(document.getElementById('emailBox').value=='')
    {   
        if(document.getElementById("error"))
        {
            var d = document.getElementById('subscribeError');
            var olddiv = document.getElementById('error');
            d.removeChild(olddiv);

        }
        
        document.getElementById('subscribeError').innerHTML += '<span class="ThongBaoLoi" id="error">Vui lòng nhập e-mail đăng ký</span>';
        return false;
    }

	else if(!isValidEmailNoError('emailBox'))
    {
        if(document.getElementById("error"))
        {
            var d = document.getElementById('subscribeError');
            var olddiv = document.getElementById('error');
            d.removeChild(olddiv);
        }
        
        document.getElementById('subscribeError').innerHTML = '<b>Vui lòng nhập e-mail hợp lệ theo mẫu: mail@domain.com</b>';
        return false;
    }
		

	else
	{
		document.f1.action = url;
		document.f1.submit();
	}
}

/**
 * Function: checkAdvanceSearch
 * Kiem tra form advance search truoc khi submit
 * 1 trong 2 textbox tu khoa phai duoc nhap hoac 1 trong cac combobox phai duoc
 * chon.
 * Ouput: true neu hop le, false neu ko hop le
 **/
function checkAdvanceSearch()
{
	course=document.getElementById('txt_KhoaHoc').value;
	school=document.getElementById('txt_TrungTamDaoTao').value;
	city=document.getElementById('cmb_ThanhPho').value;
	//district=document.getElementById('cmb_QuanHuyen').value;
	major=document.getElementById('cmb_NganhNghe').value;

	if(course=="" && school=="" && city==0 && major==0)
	{
		//alert("Vui lòng nhập từ khóa hoặc chọn tiêu chí tìm kiếm!");
        document.getElementById('advSearchError').innerHTML = '&nbsp;Vui lòng nhập từ khóa hoặc chọn tiêu chí tìm kiếm&nbsp;';
		return false;
	}
	else
		return true;
}

/**
 * Function: checkComment
 * Kiem tra box comment khoa hoc truoc khi submit
 * Textbox ko duoc trong 
 * Ouput: true neu hop le, false neu ko hop le
 **/
function checkComment()
{
    var error=0;
    code=document.getElementById('txtImg').value;
             
    if(code.length != 5)
    {
        document.getElementById('codeError').innerHTML = "&nbsp;Mã bảo mật phải đúng 5 ký tự&nbsp;";
        error=1;
    }
 
    if(error==1)
        return false;
    else
        return true;
}


/**
 * Function: checkContact
 * Kiem tra form contact truoc khi submit
 * Textbox ko duoc trong 
 * Ouput: true neu hop le, false neu ko hop le
 **/
function checkContact()
{
    var error=0;
    code=document.getElementById('txtImg').value;
    
    if(isBlankForm('txtTitle','titleError','Vui lòng nhập tiêu đề'))
        error=1;
        
    if(isBlankForm('txtName','nameError','Vui lòng nhập tên của bạn'))
        error=1;
    
    if(isBlankForm('txtEmail','emailError','Vui lòng nhập email liên lạc'))
        error=1;
        
    if(!isValidEmail('txtEmail','emailError'))
        error=1;
            
    if(isBlankForm('txtContent','contentError','Vui lòng nhập nội dung liên hệ'))
        error=1;
        
    if(code.length != 5)
    {
        document.getElementById('codeError').innerHTML = "&nbsp;Mã bảo mật phải đúng 5 ký tự&nbsp;";
        error=1;
    }
    else
        document.getElementById('codeError').innerHTML = "";
        
    if(error==1)
        return false;
    else
        return true;
}


/**
 * Function: mo cua so moi
 */
function openPage(url)
{
    window.open(url);
}

function getImgSize(imgSrc)
{
    var newImg = new Image();
    newImg.src = imgSrc;
    var size = new Array();
    size['hei'] = newImg.height;
    size['wid'] = newImg.width;
    return size;
}

/**
 * Function: mo popup de view map
 */
function viewmap(img)
{
    //Get img size
    //var size = getImgSize(img);  
    
    //picwid = size['wid'];
    //pichei = size['hei'];
          
    picwid = 717;
    pichei = 480;
    
    //Open new window 
    temp=window.open("","map","status=0,toolbar=0,menubar=0,scrollbar=0,width=" + picwid + ",height=" + pichei + ",resizable=1");
    
    //Write the content
    temp.document.write("<head><title>Xem bảng đồ trường</title></head>");
    temp.document.write("<body style='margin:0;padding:0'>");
    temp.document.write("<a href='javascript:window.close();'><img src='" + img + "' title='Đóng cửa sổ'/></a>"); 
    //temp.document.write("<br/><br/><center><a href='javascript:window.close();'>Đóng cửa sổ</a></center>"); 
    temp.document.write("</body>");
    
    //Reposition window to center of screen
    var posHei = (screen.availHeight-pichei)/2;
    var posWid = (screen.availWidth-picwid)/2;
    temp.moveTo(posWid,posHei);     
}

/**
 * Function: checkReportAbuse
 * Kiem tra form report abuse truoc khi submit
 * Textbox ko duoc trong 
 * Ouput: true neu hop le, false neu ko hop le
 **/
function checkReportAbuse()
{
    var error=0;
    code=document.getElementById('txtImg').value;
        
    if(isBlankForm('txtName','nameError','Vui lòng nhập tên của bạn'))
        error=1;
    
    if(isBlankForm('txtEmail','emailError','Vui lòng nhập email liên lạc'))
        error=1;
        
    if(!isValidEmail('txtEmail','emailError'))
        error=1;
            
    if(isBlankForm('txtContent','contentError','Vui lòng nhập nội dung'))
        error=1;
        
    if(code.length != 5)
    {
        document.getElementById('codeError').innerHTML = "&nbsp;Mã phải đúng 5 ký tự&nbsp;";
        error=1;
    }
    else
        document.getElementById('codeError').innerHTML = "";
        
    if(error==1)
        return false;
    else
        return true;
}

/**
 * Function: checkSendToFriend
 * Kiem tra form send to friend truoc khi submit
 * Textbox ko duoc trong 
 * Ouput: true neu hop le, false neu ko hop le
 **/
function checkSendToFriend()
{
    var error=0;
    code=document.getElementById('txtImg').value;
        
    if(isBlankForm('txtFromName','fromNameError','Vui lòng nhập tên của bạn'))
        error=1;
    
    if(isBlankForm('txtFromEmail','fromEmailError','Vui lòng nhập email liên lạc'))
        error=1;
        
    if(isBlankForm('txtToName','toNameError','Vui lòng nhập tên người nhận'))
        error=1;
    
    if(isBlankForm('txtToEmail','toEmailError','Vui lòng nhập email người nhận'))
        error=1;
        
    if(!isValidEmail('txtFromEmail','fromEmailError'))
        error=1;
    
    if(!isValidEmail('txtToEmail','toEmailError'))
        error=1;
        
    if(code.length != 5)
    {
        document.getElementById('codeError').innerHTML = "&nbsp;Mã phải đúng 5 ký tự&nbsp;";
        error=1;
    }
    else
        document.getElementById('codeError').innerHTML = "";
        
    if(error==1)
        return false;
    else
        return true;
}



function checkAnswer(url)
{
    var code=document.getElementById('txtImg').value;
	var error=0;
              
    if(code.length != 5)
    {
        document.getElementById('codeError').innerHTML = "&nbsp;Mã bảo mật phải đúng 5 ký tự&nbsp;";
         error=1;
    }
	else
	{
		 document.getElementById('codeError').innerHTML = "";
       
	}	
	if(error==1)
       return false;
	else
	{
		document.f1.action = url;
    	document.f1.submit();
	}
}

function checkQuestion(url)
{
    var code	= document.getElementById('txtImg').value;
	var content = document.getElementById('txt_ques').value;
	var error=0;
              
    if(code.length != 5)
    {
        document.getElementById('codeError').innerHTML = "&nbsp;Mã bảo mật phải đúng 5 ký tự&nbsp;";
         error=1;
    }
	else
	{
		 document.getElementById('codeError').innerHTML = "";      
	}
	
	if(content.length == "")
    {
        document.getElementById('contentError').innerHTML = "&nbsp;Vui lòng nhập câu hỏi &nbsp;";
         error=1;
    }
	else
	{
		 document.getElementById('contentError').innerHTML = "";      
	}
	
	
		
	if(error==1)
       return false;
	else
	{
		document.f1.action = url;
    	document.f1.submit();
	}
}

	function checkUpdate(url)
	{
		var fullName 	= document.getElementById("fullName").value;
		var major	    = document.getElementById("major").value;
		var city	    = document.getElementById("city").value;
		var otherMajor	= document.getElementById("txtotherMajor");
		var otherCity	= document.getElementById("txtotherCity");
		var checkName   = 0;
		var checkMajor  = 0;
		var checkCity   = 0;
		
		if(fullName.length == 0)
		{
			document.getElementById("errorName").innerHTML = " * Không được để trống Họ Tên";
			document.getElementById("fullName").focus();	
			checkName = 0;
		}
		else
		{
			document.getElementById("errorName").innerHTML = "";
			checkName = 1;
		}
		
		if(major == 0)
		{
			if(otherMajor.value.length == 0)
			{
				document.getElementById("errorMajor").innerHTML = " * Không được để trống ngành nghề";
				checkMajor = 0;
			}
			else
			{
				document.getElementById("errorMajor").innerHTML = "";
				checkMajor = 1;
			}
		}
		else
		{
				document.getElementById("errorMajor").innerHTML = "";
				checkMajor = 1;
		}
		
		if(city == 0)
		{
			if(otherCity.value.length == 0)
			{
				document.getElementById("errorCity").innerHTML = " * Không được để trống Tỉnh/Thành phố ";
				checkCity = 0;
			}
			else
			{
				document.getElementById("errorCity").innerHTML = "";
				checkCity = 1;
			}
		}
		else
		{
				document.getElementById("errorCity").innerHTML = "";
				checkCity = 1;
		}
			
		if(checkName == 1 && checkMajor == 1 && checkCity == 1)
		{
			document.sampleform.action = url;
			document.sampleform.submit();
		}
		else
			return false;
				
	
	}
	
	function checkMajor()
	{
		var major 		= document.getElementById("major").value ;
		var otherMajor	= document.getElementById("otherMajor");
		if(major == 0)
			otherMajor.style.display = "block" ;
		else
		{
			document.getElementById("txtotherMajor").value 	= "";
			otherMajor.style.display  = "none" ;		
		}
	}
	
	function checkCity()
	{
		var city 		= document.getElementById("city").value ;
		var otherCity	= document.getElementById("otherCity");
		if(city == 0)
			otherCity.style.display = "block";
		else
		{
			document.getElementById("txtotherCity").value 	= "";
			otherCity.style.display = "none";		
		}
	}

	function checkPass(url)
		{
			var oldPass 		 = document.getElementById('txtOldPass').value;
			var checkOldPass	 = 0;
			var newPass 		 = document.getElementById('txtNewPass').value;
			var checkNewPass	 = 0;
			var confirmPass		 = document.getElementById('txtConfirmPass').value;
			var checkConfirmPass = 0;
			var checkAgree		 = 0;
			
			if(oldPass.length == 0)
			{
				document.getElementById('errorOldPass').innerHTML = "Vui lòng nhập mật khẩu cũ ";
				checkOldPass = 0;
			}
			else
			{
				document.getElementById('errorOldPass').innerHTML = "";
				checkOldPass = 1;
			}
		
			if(newPass.length < 6)
			{
				document.getElementById('errorNewPass').innerHTML = "Password phải trên 6 ký tự ";
				checkNewPass = 0;
			}
			else
			{
				document.getElementById('errorNewPass').innerHTML = "";
				checkNewPass = 1;
			}
			
			if(confirmPass.length == 0)
			{
				document.getElementById('errorConfirmPass').innerHTML = "Vui lòng xác nhận mật khẩu ";
				checkConfirmPass = 0;
			}
			else if(confirmPass != newPass)
			{
				document.getElementById('errorConfirmPass').innerHTML = "Mật khẩu xác nhận không trùng với mật khẩu mới ";
				checkConfirmPass = 0;
			}
			else
			{
				document.getElementById('errorConfirmPass').innerHTML = "";
				checkConfirmPass = 1;
			}
			
			
			
			if(checkOldPass && checkNewPass && checkConfirmPass)
			{
				document.f1.action = url;
				document.f1.submit();
			}
			else
				return false;
		
		}

	function checkEmail(url)
	{
		var email = document.getElementById('txtEmail').value;
		var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		
		 if(!filter.test(email))
            {
                document.getElementById("email_error").innerHTML = "Email không hợp lệ ";   
                return false;
            } 
		else
		{
			document.getElementById("email_error").innerHTML = "";
			document.f2.action = url;
			document.f2.submit();
		}   
	}
	
	 function checkFormRegister(url)
	  {
	  		var email = document.getElementById('txtEmail').value;
			var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			var checkEmail = 0;
			
			var pass 		 	 = document.getElementById('txtPassword').value;
			var checkPass	 	 = 0;
			var confirmPass		 = document.getElementById('txtConPassword').value;
			var checkConfirmPass = 0;
			
			var fullname 		 = document.getElementById('txtFullName').value;
			var checkFullName	 = 0;
			
			var major	    = document.getElementById("major").value;
			var city	    = document.getElementById("city").value;
			var otherMajor	= document.getElementById("txtotherMajor");
			var otherCity	= document.getElementById("txtotherCity");
			var checkMajor  = 0;
			var checkCity   = 0;
			
			//check email
			 if(!filter.test(email))
            {
                document.getElementById("email_error").innerHTML = "Email không hợp lệ ";   
				document.getElementById('txtEmail').focus();
                checkEmail = 0;
            }
			else
			{
				document.getElementById("email_error").innerHTML = ""; 
				checkEmail = 1;
			}
			
			
			//check Password and confrim password
			if(pass.length < 6)
			{
				document.getElementById('errorNewPass').innerHTML = "Password phải trên 6 ký tự ";
				checkPass = 0;
				document.getElementById('txtPassword').focus();
			}
			else
			{
				document.getElementById('errorNewPass').innerHTML = "";
				checkPass = 1;
			}
			
			if(confirmPass != pass)
			{
				document.getElementById('errorConfirmPass').innerHTML = "Mật khẩu xác nhận không trùng với mật khẩu mới ";
				checkConfirmPass = 0;
				document.getElementById('txtConPass').focus();
			}
			else
			{
				document.getElementById('errorConfirmPass').innerHTML = "";
				checkConfirmPass = 1;
			}
			
			//check full Name
			if(fullname.length == 0)
			{
				document.getElementById('fullName_error').innerHTML = "Không được để trống họ tên ";
				document.getElementById('txtFullName').focus();
				checkFullName = 0;				
			}
			else
			{	
				document.getElementById('fullName_error').innerHTML = "";
				checkFullName = 1;		
			}
			
			//check otherMajor and city if they enable
			if(major==0)
			{
				if(otherMajor.value.length == 0)
				{
					document.getElementById("errorMajor").innerHTML = " Không để trống ngành nghề";
					checkMajor = 0;
				}
				else
				{
					document.getElementById("errorMajor").innerHTML = "";
					checkMajor = 1;
				}
			}
			else
			{
				document.getElementById("errorMajor").innerHTML = "";
				checkMajor = 1;
			}
		
			if(city==0)
			{
				if(otherCity.value.length == 0)
				{
					document.getElementById("errorCity").innerHTML ="Không để trống Tỉnh/ Thành phố ";
					checkCity = 0;
				}
				else
				{
					document.getElementById("errorCity").innerHTML = "";
					checkCity = 1;
				}
			}
			else
			{
					document.getElementById("errorCity").innerHTML = "";
					checkCity = 1;
			}
			
			
			//Agree??
			if(document.getElementById('ckbAgree').checked == false)
			{
				 checkAgree = 0;
				 alert("Bạn chưa chọn đồng ý với các thoả thuận của hiếu học");
			}
			else
			{
				 checkAgree = 1;	
			}
		
		//submit
		if(checkEmail && checkPass && checkFullName && checkConfirmPass && checkMajor && checkCity && checkAgree)
		{
			document.frmSignUp.action = url;
			document.frmSignUp.submit();	
		}
		else
			return false;
	  
 }
 
 function checkRegEbook(url)
 {
	 
	var fullname   = document.getElementById("FullName");
	var class_name = document.getElementById("txtClass");
	var school	   = document.getElementById("txtSchool");
	var email 	   = document.getElementById("txtEmail");
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	var major = document.f1.marjor;
	var countMajor = 0;
	var strMajor   = "";
	for(var i=0;i<major.length;i++)
	{
		if(document.f1.marjor[i].checked == true)	
		{
			strMajor += document.f1.marjor[i].value +"@@";
			countMajor++;
		}
	}
	document.f1.majors.value = strMajor;
	
	if(fullname.value.length ==0)
	{
		alert("Vui lòng nhập họ tên");
		fullname.focus();
	}
	else if(class_name.value.length ==0)
	{
		alert("Vui lòng nhập tên lớp");
		class_name.focus();
	}
	else if(school.value.length ==0)
	{
		alert("Vui lòng nhập tên trường");
		school.focus();
	}
	else if(!filter.test(email.value))
	{
		alert("email không hợp lệ");
		email.focus();
	}
	else if(countMajor<1 || countMajor>3)
	{
		alert("chọn tối đa 3 ngành nghề quan tâm")	
		
	}
	else
	{
		document.getElementById("button").disabled = true;
		document.f1.action = url;
		document.f1.submit();	
	}
	
	
 }
 
/***********************************************
* Navigation
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
		
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

function showHideObj(id,id1)
{
	obj = document.getElementById(id);
	obj1 = document.getElementById(id1);
    if(obj.style.display == "" || obj.style.display == "none")
	{
        obj.style.display = "block";
		obj1.className = "expand";
	}
    else if(obj.style.display == "block" || obj.style.display != "" || obj.style.display != "none")
	{
        obj.style.display = "none";
		obj1.className = "collapse";
	}

}

function showHideDiv(id)
{
	obj = document.getElementById(id);

    if(obj.style.display == "" || obj.style.display == "none")
	{
        obj.style.display = "block";
	}
    else if(obj.style.display == "block" || obj.style.display != "" || obj.style.display != "none")
	{
        obj.style.display = "none";
	}

}


// -------------------------------------------------------------------
// DHTML Window Widget- By Dynamic Drive, available at: http://www.dynamicdrive.com
// show popup window
// -------------------------------------------------------------------

var dhtmlwindow={
imagefiles:['http://www.hieuhoc.com/Images/min.gif',  'http://www.hieuhoc.com/Images/close1.gif', 'http://www.hieuhoc.com/Images/restore.gif', 'www.hieuhoc.com/Images/resize.gif'], //Path to 4 images used by script, in that order
ajaxbustcache: true, //Bust caching when fetching a file via Ajax?
ajaxloadinghtml: '<b>Loading Page. Please wait...</b>', //HTML to show while window fetches Ajax Content?

minimizeorder: 0,
zIndexvalue:100,
tobjects: [], //object to contain references to dhtml window divs, for cleanup purposes
lastactivet: {}, //reference to last active DHTML window

init:function(t){
	var domwindow=document.createElement("div") //create dhtml window div
	domwindow.id=t
	domwindow.className="dhtmlwindow"
	var domwindowdata=''
	domwindowdata='<div class="drag-handle">'
	domwindowdata+='DHTML Window <div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="Minimize" /><img src="'+this.imagefiles[1]+'" title="Close" /></div>'
	domwindowdata+='</div>'
	domwindowdata+='<div class="drag-contentarea"></div>'
	domwindowdata+='<div class="drag-statusarea"><div class="drag-resizearea" style="background: transparent url('+this.imagefiles[3]+') top right no-repeat;">&nbsp;</div></div>'
	domwindowdata+='</div>'
	domwindow.innerHTML=domwindowdata
	document.getElementById("dhtmlwindowholder").appendChild(domwindow)
	//this.zIndexvalue=(this.zIndexvalue)? this.zIndexvalue+1 : 100 //z-index value for DHTML window: starts at 0, increments whenever a window has focus
	var t=document.getElementById(t)
	var divs=t.getElementsByTagName("div")
	for (var i=0; i<divs.length; i++){ //go through divs inside dhtml window and extract all those with class="drag-" prefix
		if (/drag-/.test(divs[i].className))
			t[divs[i].className.replace(/drag-/, "")]=divs[i] //take out the "drag-" prefix for shorter access by name
	}
	//t.style.zIndex=this.zIndexvalue //set z-index of this dhtml window
	t.handle._parent=t //store back reference to dhtml window
	t.resizearea._parent=t //same
	t.controls._parent=t //same
	t.onclose=function(){return true} //custom event handler "onclose"
	t.onmousedown=function(){dhtmlwindow.setfocus(this)} //Increase z-index of window when focus is on it
	t.handle.onmousedown=dhtmlwindow.setupdrag //set up drag behavior when mouse down on handle div
	t.resizearea.onmousedown=dhtmlwindow.setupdrag //set up drag behavior when mouse down on resize div
	t.controls.onclick=dhtmlwindow.enablecontrols
	t.show=function(){dhtmlwindow.show(this)} //public function for showing dhtml window
	t.hide=function(){dhtmlwindow.hide(this)} //public function for hiding dhtml window
	t.close=function(){dhtmlwindow.close(this)} //public function for closing dhtml window (also empties DHTML window content)
	t.setSize=function(w, h){dhtmlwindow.setSize(this, w, h)} //public function for setting window dimensions
	t.moveTo=function(x, y){dhtmlwindow.moveTo(this, x, y)} //public function for moving dhtml window (relative to viewpoint)
	t.isResize=function(bol){dhtmlwindow.isResize(this, bol)} //public function for specifying if window is resizable
	t.isScrolling=function(bol){dhtmlwindow.isScrolling(this, bol)} //public function for specifying if window content contains scrollbars
	t.load=function(contenttype, contentsource, title){dhtmlwindow.load(this, contenttype, contentsource, title)} //public function for loading content into window
	this.tobjects[this.tobjects.length]=t
	return t //return reference to dhtml window div
},

open:function(t, contenttype, contentsource, title, attr, recalonload){
	var d=dhtmlwindow //reference dhtml window object
	function getValue(Name){
		var config=new RegExp(Name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,)
		return (config.test(attr))? parseInt(RegExp.$1) : 0 //return value portion (int), or 0 (false) if none found
	}
	if (document.getElementById(t)==null) //if window doesn't exist yet, create it
		t=this.init(t) //return reference to dhtml window div
	else
		t=document.getElementById(t)
	this.setfocus(t)
	t.setSize(getValue(("width")), (getValue("height"))) //Set dimensions of window
	var xpos=getValue("center")? "middle" : getValue("left") //Get x coord of window
	var ypos=getValue("center")? "middle" : getValue("top") //Get y coord of window
	//t.moveTo(xpos, ypos) //Position window
	if (typeof recalonload!="undefined" && recalonload=="recal" && this.scroll_top==0){ //reposition window when page fully loads with updated window viewpoints?
		if (window.attachEvent && !window.opera) //In IE, add another 400 milisecs on page load (viewpoint properties may return 0 b4 then)
			this.addEvent(window, function(){setTimeout(function(){t.moveTo(xpos, ypos)}, 400)}, "load")
		else
			this.addEvent(window, function(){t.moveTo(xpos, ypos)}, "load")
	}
	t.isResize(getValue("resize")) //Set whether window is resizable
	t.isScrolling(getValue("scrolling")) //Set whether window should contain scrollbars
	t.style.visibility="visible"
	t.style.display="block"
	t.contentarea.style.display="block"
	t.moveTo(xpos, ypos) //Position window
	t.load(contenttype, contentsource, title)
	if (t.state=="minimized" && t.controls.firstChild.title=="Restore"){ //If window exists and is currently minimized?
		t.controls.firstChild.setAttribute("src", dhtmlwindow.imagefiles[0]) //Change "restore" icon within window interface to "minimize" icon
		t.controls.firstChild.setAttribute("title", "Minimize")
		t.state="fullview" //indicate the state of the window as being "fullview"
	}
	return t
},

setSize:function(t, w, h){ //set window size (min is 150px wide by 100px tall)
	t.style.width=Math.max(parseInt(w), 150)+"px"
	t.contentarea.style.height=Math.max(parseInt(h), 100)+"px"
},

moveTo:function(t, x, y){ //move window. Position includes current viewpoint of document
	this.getviewpoint() //Get current viewpoint numbers
	t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : this.scroll_left+parseInt(x)+"px"
	t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : this.scroll_top+parseInt(y)+"px"
},

isResize:function(t, bol){ //show or hide resize inteface (part of the status bar)
	t.statusarea.style.display=(bol)? "block" : "none"
	t.resizeBool=(bol)? 1 : 0
},

isScrolling:function(t, bol){ //set whether loaded content contains scrollbars
	t.contentarea.style.overflow=(bol)? "auto" : "hidden"
},

load:function(t, contenttype, contentsource, title){ //loads content into window plus set its title (3 content types: "inline", "iframe", or "ajax")
	if (t.isClosed){
		alert("DHTML Window has been closed, so no window to load contents into. Open/Create the window again.")
		return
	}
	var contenttype=contenttype.toLowerCase() //convert string to lower case
	if (typeof title!="undefined")
		t.handle.firstChild.nodeValue=title
	if (contenttype=="inline")
		t.contentarea.innerHTML=contentsource
	else if (contenttype=="div"){
		var inlinedivref=document.getElementById(contentsource)
		t.contentarea.innerHTML=(inlinedivref.defaultHTML || inlinedivref.innerHTML) //Populate window with contents of inline div on page
		if (!inlinedivref.defaultHTML)
			inlinedivref.defaultHTML=inlinedivref.innerHTML //save HTML within inline DIV
		inlinedivref.innerHTML="" //then, remove HTML within inline DIV (to prevent duplicate IDs, NAME attributes etc in contents of DHTML window
		inlinedivref.style.display="none" //hide that div
	}
	else if (contenttype=="iframe"){
		t.contentarea.style.overflow="hidden" //disable window scrollbars, as iframe already contains scrollbars
		if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName!="IFRAME") //If iframe tag doesn't exist already, create it first
			t.contentarea.innerHTML='<iframe src="" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+t.id+'"></iframe>'
		window.frames["_iframe-"+t.id].location.replace(contentsource) //set location of iframe window to specified URL
		}
	else if (contenttype=="ajax"){
		this.ajax_connect(contentsource, t) //populate window with external contents fetched via Ajax
	}
	t.contentarea.datatype=contenttype //store contenttype of current window for future reference
},

setupdrag:function(e){
	var d=dhtmlwindow //reference dhtml window object
	var t=this._parent //reference dhtml window div
	d.etarget=this //remember div mouse is currently held down on ("handle" or "resize" div)
	var e=window.event || e
	d.initmousex=e.clientX //store x position of mouse onmousedown
	d.initmousey=e.clientY
	d.initx=parseInt(t.offsetLeft) //store offset x of window div onmousedown
	d.inity=parseInt(t.offsetTop)
	d.width=parseInt(t.offsetWidth) //store width of window div
	d.contentheight=parseInt(t.contentarea.offsetHeight) //store height of window div's content div
	if (t.contentarea.datatype=="iframe"){ //if content of this window div is "iframe"
		t.style.backgroundColor="#F8F8F8" //colorize and hide content div (while window is being dragged)
		t.contentarea.style.visibility="hidden"
	}
	document.onmousemove=d.getdistance //get distance travelled by mouse as it moves
	document.onmouseup=function(){
		if (t.contentarea.datatype=="iframe"){ //restore color and visibility of content div onmouseup
			t.contentarea.style.backgroundColor="white"
			t.contentarea.style.visibility="visible"
		}
		d.stop()
	}
	return false
},

getdistance:function(e){
	var d=dhtmlwindow
	var etarget=d.etarget
	var e=window.event || e
	d.distancex=e.clientX-d.initmousex //horizontal distance travelled relative to starting point
	d.distancey=e.clientY-d.initmousey
	if (etarget.className=="drag-handle") //if target element is "handle" div
		d.move(etarget._parent, e)
	else if (etarget.className=="drag-resizearea") //if target element is "resize" div
		d.resize(etarget._parent, e)
	return false //cancel default dragging behavior
},

getviewpoint:function(){ //get window viewpoint numbers
	var ie=document.all && !window.opera
	var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
	this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
	this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
},

rememberattrs:function(t){ //remember certain attributes of the window when it's minimized or closed, such as dimensions, position on page
	this.getviewpoint() //Get current window viewpoint numbers
	t.lastx=parseInt((t.style.left || t.offsetLeft))-dhtmlwindow.scroll_left //store last known x coord of window just before minimizing
	t.lasty=parseInt((t.style.top || t.offsetTop))-dhtmlwindow.scroll_top
	t.lastwidth=parseInt(t.style.width) //store last known width of window just before minimizing/ closing
},

move:function(t, e){
	t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
	t.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"
},

resize:function(t, e){
	t.style.width=Math.max(dhtmlwindow.width+dhtmlwindow.distancex, 150)+"px"
	t.contentarea.style.height=Math.max(dhtmlwindow.contentheight+dhtmlwindow.distancey, 100)+"px"
},

enablecontrols:function(e){
	var d=dhtmlwindow
	var sourceobj=window.event? window.event.srcElement : e.target //Get element within "handle" div mouse is currently on (the controls)
	if (/Minimize/i.test(sourceobj.getAttribute("title"))) //if this is the "minimize" control
		d.minimize(sourceobj, this._parent)
	else if (/Restore/i.test(sourceobj.getAttribute("title"))) //if this is the "restore" control
		d.restore(sourceobj, this._parent)
	else if (/Close/i.test(sourceobj.getAttribute("title"))) //if this is the "close" control
		d.close(this._parent)
	return false
},

minimize:function(button, t){
	dhtmlwindow.rememberattrs(t)
	button.setAttribute("src", dhtmlwindow.imagefiles[2])
	button.setAttribute("title", "Restore")
	t.state="minimized" //indicate the state of the window as being "minimized"
	t.contentarea.style.display="none"
	t.statusarea.style.display="none"
	if (typeof t.minimizeorder=="undefined"){ //stack order of minmized window on screen relative to any other minimized windows
		dhtmlwindow.minimizeorder++ //increment order
		t.minimizeorder=dhtmlwindow.minimizeorder
	}
	t.style.left="10px" //left coord of minmized window
	t.style.width="200px"
	var windowspacing=t.minimizeorder*10 //spacing (gap) between each minmized window(s)
	t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},

restore:function(button, t){
	dhtmlwindow.getviewpoint()
	button.setAttribute("src", dhtmlwindow.imagefiles[0])
	button.setAttribute("title", "Minimize")
	t.state="fullview" //indicate the state of the window as being "fullview"
	t.style.display="block"
	t.contentarea.style.display="block"
	if (t.resizeBool) //if this window is resizable, enable the resize icon
		t.statusarea.style.display="block"
	t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px" //position window to last known x coord just before minimizing
	t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
	t.style.width=parseInt(t.lastwidth)+"px"
},


close:function(t){
	try{
		var closewinbol=t.onclose()
	}
	catch(err){ //In non IE browsers, all errors are caught, so just run the below
		var closewinbol=true
 }
	finally{ //In IE, not all errors are caught, so check if variable isn't defined in IE in those cases
		if (typeof closewinbol=="undefined"){
			alert("An error has occured somwhere inside your \"onclose\" event handler")
			var closewinbol=true
		}
	}
	if (closewinbol){ //if custom event handler function returns true
		if (t.state!="minimized") //if this window isn't currently minimized
			dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing
		if (window.frames["_iframe-"+t.id]) //if this is an IFRAME DHTML window
			window.frames["_iframe-"+t.id].location.replace("about:blank")
		else
			t.contentarea.innerHTML=""
		t.style.display="none"
		t.isClosed=true //tell script this window is closed (for detection in t.show())
	}
	return closewinbol
},


setopacity:function(targetobject, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	if (!targetobject)
		return
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
		}
	else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
	else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
		targetobject.style.opacity=value
},

setfocus:function(t){ //Sets focus to the currently active window
	this.zIndexvalue++
	t.style.zIndex=this.zIndexvalue
	t.isClosed=false //tell script this window isn't closed (for detection in t.show())
	this.setopacity(this.lastactivet.handle, 0.5) //unfocus last active window
	this.setopacity(t.handle, 1) //focus currently active window
	this.lastactivet=t //remember last active window
},


show:function(t){
	if (t.isClosed){
		alert("DHTML Window has been closed, so nothing to show. Open/Create the window again.")
		return
	}
	if (t.lastx) //If there exists previously stored information such as last x position on window attributes (meaning it's been minimized or closed)
		dhtmlwindow.restore(t.controls.firstChild, t) //restore the window using that info
	else
		t.style.display="block"
	this.setfocus(t)
	t.state="fullview" //indicate the state of the window as being "fullview"
},

hide:function(t){
	t.style.display="none"
},

ajax_connect:function(url, t){
	var page_request = false
	var bustcacheparameter=""
	if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE6 or below
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
	t.contentarea.innerHTML=this.ajaxloadinghtml
	page_request.onreadystatechange=function(){dhtmlwindow.ajax_loadpage(page_request, t)}
	if (this.ajaxbustcache) //if bust caching of external page
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', url+bustcacheparameter, true)
	page_request.send(null)
},

ajax_loadpage:function(page_request, t){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
	t.contentarea.innerHTML=page_request.responseText
	}
},


stop:function(){
	dhtmlwindow.etarget=null //clean up
	document.onmousemove=null
	document.onmouseup=null
},

addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
},

cleanup:function(){
	for (var i=0; i<dhtmlwindow.tobjects.length; i++){
		dhtmlwindow.tobjects[i].handle._parent=dhtmlwindow.tobjects[i].resizearea._parent=dhtmlwindow.tobjects[i].controls._parent=null
	}
	window.onload=null
}

} //End dhtmlwindow object

document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>') //container that holds all dhtml window divs on page
window.onunload=dhtmlwindow.cleanup

// -------------------------------------------------------------------
// End popup window
// -------------------------------------------------------------------



/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
		
var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox