﻿
/* 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();});
}
/* Menu */

function printText(id, type){
    var width= 800;
    var height= 600;
    var left = (Window.getWidth() - width) / 2;
    var top = (Window.getHeight() - height) / 2;
    var win = window.open('print.asp?id=' + id + "&type=" + type, '_file', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height+',left = ' +  left + ',top = ' + top);
    if(window.focus ){win.focus();}
}

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 == 'الاسم' || frmObj.txtNam.value == ''){
        alert('!الرجاء إدخال الاسم بلشكل الصحيح');
        return false;
    }
    if(!emailRe.test(frmObj.txtEml.value)){
        alert('!الرجاء إدخال البريد الإلكتروني بلشكل الصحيح');
        return false;
    }
    if(!frmObj.emlAddRem[0].checked && !frmObj.emlAddRem[1].checked){
        alert('!الرجاء إختيار إضافة أو حذف البريد');
        return false;
    }
    frmObj.CMDEML.value = 'true';
    return true;
}