﻿var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
function popUp(evt,oi)
 {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; 
 ds.visibility = "visible";}}}
                  function HidePouup(evt,oi)
 {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; 
 ds.visibility = "hidden";}}}
function MoveItem(lstRightID,lstLeftID,mode)
{
    var lstLeft= document.getElementById(lstLeftID); var lstRight= document.getElementById(lstRightID); var Source; var Target;
    switch(mode)
    {
        case 1:
            Source=lstRight; Target=lstLeft; break;
        case 2:
            Source=lstLeft; Target=lstRight; break;
    }
    if (Source.options.selectedIndex < 0)
        return;
    var newOption = new Option();
    newOption.text = Source.options[Source.options.selectedIndex].text;
    newOption.value = Source.options[Source.options.selectedIndex].value;
    Target.options[Target.length] = newOption;
    Source.remove(Source.options.selectedIndex);
}
function MoveAllItems(lstRightID,lstLeftID,mode)
{
    var lstLeft= document.getElementById(lstLeftID);    var lstRight= document.getElementById(lstRightID);    var Source;    var Target;
    switch(mode)
    {   case 1:  Source=lstRight; Target=lstLeft; break; 
        case 2: Source=lstLeft; Target=lstRight; break;   
    }
    for(var i=Source.options.length-1;i>=0;i--)
    {
        var newOption = new Option();
        newOption.text = Source.options[i].text;
        newOption.value = Source.options[i].value;
        Target.options[Target.length] = newOption;
        Source.remove(i);
    }
}
function CheckAll(chkBoxID)
{
	for (var i=0;i<document.aspnetForm.elements.length;i++) 
	{
		var e = aspnetForm.elements[i];
		if ( (e.name != chkBoxID) && (e.type=='checkbox'))
		 {e.checked = document.getElementById(chkBoxID).checked;}
	}
}
function noCopyMouse(e) {
          var isRight = (e.button) ? (e.button == 2) : (e.which == 3);
        if(isRight) {
            alert('لا يسمح بنسخ البريد الإلكتروني  - يرجى كتابته مره أخرى للتأكد من صحته');
            return false;
        }
        return true;
}
function noCopyKey(e) 
{    var forbiddenKeys = new Array('c','x','v'); var keyCode = (e.keyCode) ? e.keyCode : e.which; var isCtrl;
    if(window.event) isCtrl = e.ctrlKey;  
    else  isCtrl = (window.Event) ? ((e.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false;
        if(isCtrl) 
        { 
            for(i = 0; i < forbiddenKeys.length; i++)
            { 
                if(forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) 
                { alert('لا يسمح بنسخ البريد الإلكتروني  - يرجى كتابته مره أخرى للتأكد من صحته');
                return false;}
            }
        }
        return true; }
function SetControlFocus(ctlID){document.getElementById(ctlID).focus();}