function toggleMenu(objID, thisMenu) 
{
	
	if (!document.getElementById) return;
	
	// collapse all menus
	var ob = document.getElementById(objID).style;
	var obMenu = document.getElementById(objID);
	var obSaved = ob.display;

	//alert(objID);

	var ob1 = document.getElementById('menu1').style;
	ob1.display ='none';		
	
	//var ob2 = document.getElementById('menu2').style;
	//ob2.display ='none';
	
	ob.color = "#F0F0F0";
	//background-image
	// expand the relevant menu
	//alert(document.getElementById(thisMenu.id).attributes("background-image").toString());
	ob.display = (obSaved == 'block')?'none': 'block';				

}

function setActiveMenu(objID) 
{
	//alert('Test');
	//document.getElementById(objID).className = "mH_Selected menu_link";
	//alert(document.getElementById(objID).style);
}


function verifyEmail()
{
   var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
   if (document.myform.txtName.value == "") 
   {
      alert("Please enter your name.");
      return false;
   }
   if (document.myform.txtEmail.value.search(emailRegEx) == -1) 
   {
      alert("Please enter a valid email address.");
      return false;
   }
}

//alert('test');
function SelectCurrentPage() {
   
    var e = /^((http|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?$/;
    if (document.URL.match(e)) {
        //alert(RegExp.$2); // protocol
        //alert(RegExp.$3); //host
        //alert(RegExp.$4); // path
        //alert(RegExp.$6); // file
        //alert(RegExp.$7); // hash
        var thisPage = RegExp.$6;
        if (thisPage != null) {
            var pageName = thisPage.split('.aspx');
            var thisID = 'hyp' + pageName[0] + '.ClientID';
            var thisPage = pageName[0];
            var hypDefault = document.getElementById('<%=hypDefault.ClientID %>');
            var hypAboutUs = document.getElementById('<%=hypAboutUs.ClientID %>');
            var hypServices = document.getElementById('<%=hypServices.ClientID %>');
            var hypGallery = document.getElementById('<%=hypGallery.ClientID %>');
            var hypClients = document.getElementById('<%=hypClients.ClientID %>');
            var hypContactUs = document.getElementById('<%=hypContactUs.ClientID %>');

            var hyCurrentPage = hypServices;

            switch (pageName[0]) {
                case "Default":
                    hyCurrentPage = hypDefault;
                    break;
                case "AboutUs":
                    hyCurrentPage = hypAboutUs;
                    break;
                case "Services":
                    hyCurrentPage = hypServices;
                    break;
                case "Gallery":
                    hyCurrentPage = hypGallery;
                    break;
                case "Clients":
                    hyCurrentPage = hypClients;
                    break;
                case "ContactUs":
                    hyCurrentPage = hypContactUs;
                    break;
            }

            var elclass = hyCurrentPage.getAttribute("class");
            elclass = elclass ? elclass : hyCurrentPage.getAttribute("className");
            hyCurrentPage.setAttribute("className", "menu_link_selected");
        }
    }
}

function openFrame(url) {  
    var win = open(url, "Doc", "toolbar=no,width=600,resizable=0,height=580,scrollbars=yes");
    win.focus();
    if (!win.opener) { win.opener = window };
}
