﻿/* ****************************************************************************
Header
Date: 					2007.11.29
Modified:				2009.07.21
**************************************************************************** */
function hideSNDropDown(dropDownLink, dropDownFly)
{	
	document.getElementById(dropDownLink).className	= 'segNavMainTab';
	if (document.getElementById(dropDownFly)!=null)
	{
		document.getElementById(dropDownFly).style.visibility = 'hidden';
	}
}
function hideSNDropDown1(dropDownLink, dropDownFly)
{
    document.getElementById(dropDownLink).className = 'segNavMainTabOn';
	if (document.getElementById(dropDownFly)!=null)
	{
		document.getElementById(dropDownFly).style.visibility = 'hidden';
	}
}	
function showSNDropDown(dropDownLink, dropDownFly)
{	
	document.getElementById(dropDownLink).className	= 'segNavMainTab';
	if (document.getElementById(dropDownFly)!=null)
	{
		document.getElementById(dropDownFly).style.visibility = 'visible';
	}
}

function showSNDropDown1(dropDownLink, dropDownFly)
{
    document.getElementById(dropDownLink).className = 'segNavMainTabOn';
	if (document.getElementById(dropDownFly)!=null)
	{
		document.getElementById(dropDownFly).style.visibility = 'visible';
	}
}
function dropDownfocus(dropDownLink, dropDownFly)
{
	showSNDropDown(dropDownLink, dropDownFly);
	this.onblur = function () { document.getElementById(dropDownFly).focus(); }
	if((menu = document.getElementById(dropDownFly)))
		if((menu_item = menu.getElementsByTagName('a')))
			menu_item[menu_item.length-1].onblur= function () { hideSNDropDown(dropDownLink, dropDownFly); };
}
function checkFormData(ob) {
    var f = document.getElementById(ob);
    var d = f.value.toLowerCase().trim();
    if (d.length < 2) {
        //alert('Bạn phải nhập tên miền muốn đăng ký (ít nhất 2 ký tự không bao gồm phần mở rộng).');
        f.style.color = 'Red';
        return false;
    }
    var re = /^[0-9a-z\-]+$/g
    //var msg = 'Tên miền chỉ bao gồm các ký tự A-Z, 0-9 và dấu trừ (-)';
    if (!re.test(d)) {
        //alert(msg);
        f.style.color = 'Red';
        return false;
    }
    if (d.indexOf('--') != -1) {
        //alert(msg);
        f.style.color = 'Red';
        return false;
    }
    if (d.lastIndexOf('-') == d.length - 1) {
        //alert(msg);
        f.style.color = 'Red';
        return false;
    }
    if (d.indexOf('-') == 0) {
        //alert(msg);
        f.style.color = 'Red';
        return false;
    }
    return true;
}

