/* Menu */

navHover = function() {
	var lis = $$("#navmenu li");
	if(!lis){return;}
	lis.each(function(el, i){
	    el.addEvent('mouseleave', function(e){
            this.removeClass('iehover');
        }.bind(el));
        el.addEvent('mouseenter', function(e){
            this.addClass('iehover');
        }.bind(el));
	});
	/*lis.addEvent('mouseleave', function(e){
        this.addClass('iehover');
    }).bind(this);
    lis.addEvent('mouseenter', function(e){
        this.removeClass('iehover');
    }).bind(this);*/
	//var lis = $("navmenu").getElementsByTagName("LI");
	
	/*for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}*/
}
if(/MSIE/.test(navigator.userAgent) && parseFloat(navigator.userAgent.split('MSIE')[1]) < 7){
    window.addEvent("load", function(){navHover();});
}

function validateEmailForm(){
    var frmObj = document.forms[0];
    var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
    if(frmObj.txtNam.value == 'name' || frmObj.txtNam.value == ''){
        alert('Please enter a correct name!');
        return false;
    }
    if(!emailRe.test(frmObj.txtEml.value)){
        alert('Please enter a correct email address!');
        return false;
    }
    if(!frmObj.emlAddRem[0].checked && !frmObj.emlAddRem[1].checked){
        alert('!Please choose to add or remove emai!');
        return false;
    }
    frmObj.CMDEML.value = 'true';
    return true;
}
// for the calendars
//--------------------
window.addEvent('load',function(){    
    try{
        if(typeof(window['calendars']) != 'undefined'){
            for(var i=0; i < calendars.length; i++){
                Calendar.setup({
                    inputField     :    calendars[i],   // id of the input field
                    ifFormat       :    "%d/%m/%Y",    // format of the input field
                    showsTime      :    false
                });
            }
        }
    }
    catch(e){}
    try{
        if(/MSIE/.test(navigator.userAgent) && parseFloat(navigator.userAgent.split('MSIE')[1]) < 7){
            //IE <= 6 problem viewing check box with border
            var chkBoxs = document.getElements('input[type=checkbox]');
            chkBoxs.each(function(el, i){
                el.setStyle('border', '0px');
            });
            var radios = document.getElements('input[type=radio]');
            radios.each(function(el, i){
                el.setStyle('border', '0px');
            });
        }
    }catch(e){}
    try{
        var popUps = $$('.popUp');
        Window.onscroll = function(){
            popUps.each(function(popUp, i){
                if(popUp.getStyle('visibility') == 'visible'){
                    popUp.setStyle('top',window.getSize().scroll.y);
                    new Fx.Style($(popUp.getProperty('id')+'-content'), 'top',{duration:500}).start(window.getSize().scroll.y + 10);
                    //$(popUp.getProperty('id')+'-content').setStyle('top',window.getSize().scroll.y + 10);
                }
            });    
        }
    }catch(e){}
    
});
