﻿function initScrollLayer() {
  var wndo = new dw_scrollObj('wn', 'lyr1');
  
  wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
  dw_scrollObj.GeckoTableBugFix('wn');
}
var oldflashID = "";

function ShowHideFlashDivs(id) {

    if (oldflashID != id) {
        var flashDiv = document.getElementById(id);
        if (oldflashID) {

            var oldflashdiv = document.getElementById(oldflashID);
            oldflashdiv.style.display = "none";
        }

        flashDiv.style.display = "";
        oldflashID = id;


    }
}
function initScrollLayer2() {
  var wndo = new dw_scrollObj('wn2', 'lyr2');
  
  wndo.setUpScrollbar("dragBar2", "track2", "v", 1, 1);
  dw_scrollObj.GeckoTableBugFix('wn2');
}
function initScrollLayer3() {
    var wndo = new dw_scrollObj('wn3', 'lyr3');

    wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
    dw_scrollObj.GeckoTableBugFix('wn3');
}

function changefont(id, num) {

    document.getElementById('contenttd').style.font = num + 'verdana,arial,helvetica,tahoma';
    document.getElementById('contenttd').className = 'class' + num;
}


function scrolling3()
{  
   initScrollLayer();
}
function scrolling2()
{  
   initScrollLayer2();
}
// JavaScript Document

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
var MenuNumber=50;
var MaxSubmenu=40;
var SubMenuArray=new Array ();
function FillArray() {
for (j=1 ; j<=MenuNumber;j++)
	{
		SubMenuArray[j]='SubMenu'+j;
	}
}
FillArray();
function HideAll(){
	MM_showHideLayers('HideAll','','hide');	
	HideAll1();
	HideAll3();
}
function HideAll3(){
	for (j=1 ; j<SubMenuArray.length;j++)
	{
		MM_showHideLayers(SubMenuArray[j],'','hide')
	}
}
function HideAll1(){
	MM_showHideLayers('HideAll1','','hide');
	for(i=1;i<=MaxSubmenu;i++)
		MM_showHideLayers('SubMenu_sub'+i,'','hide');
}
function P7_Snap() { //v2.63 by PVII
var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}
var Panetmenu = "";
function revelerCacherSousNavm(LineId){
	var Sub = document.getElementById (LineId+"_sub");
		if(Sub.style.display == "none"){
			document.getElementById (LineId).className= "menuitemson";
			Sub.style.display = "";
			if (Panetmenu != "") revelerCacherSousNavm(Panetmenu);
			Panetmenu = LineId;
		}
		else
		{
			document.getElementById (LineId).className= "menuitems";
			Sub.style.display = "none";
			Panetmenu = "";
		}
	}
var Panetmenuo = "";
function revelerCacherSousNavo(LineId){
	var Sub = document.getElementById (LineId+"_sub");
	    if(Sub != null)
	    {
		    if(Sub.style.display == "none"){
			    document.getElementById (LineId).className= "menuitemson2";
			    Sub.style.display = "";
			    if (Panetmenuo != "") {revelerCacherSousNavo(Panetmenuo);}
			    Panetmenuo = LineId;
		    }
		    else
		    {
			    document.getElementById (LineId).className= "menuitems2";
			    Sub.style.display = "none";
			    Panetmenuo = "";
		    }
		}
	}
function changeClass(id,classoff,classon){
	
	var Sub = document.getElementById (id);
		if(Sub.className == classoff){
		
			Sub.className= classon;
			
		}else{
		
			Sub.className= classoff;
		}
}
function a0() {
		document.getElementById ("about0").style.display = "";
		document.getElementById ("about1").style.display = "none";
		document.getElementById ("about2").style.display = "none";
		document.getElementById ("about3").style.display = "none";
}
function a1() {
		document.getElementById ("about0").style.display = "none";
		document.getElementById ("about1").style.display = "";
		document.getElementById ("about2").style.display = "none";
		document.getElementById ("about3").style.display = "none";
}
function a2() {
		document.getElementById ("about0").style.display = "none";
	        document.getElementById ("about1").style.display = "none";
		document.getElementById ("about2").style.display = "";
		document.getElementById ("about3").style.display = "none";
}
function a3() {
		document.getElementById ("about0").style.display = "none";
		document.getElementById ("about1").style.display = "none";
		document.getElementById ("about2").style.display = "none";
		document.getElementById ("about3").style.display = "";
}

function ValidateEmail(nameId, nameMessage, emailId, emailMessage, emailSignatureMessage, commentsId, commentsMessage)
{
    if(document.getElementById(nameId))
    {
        var name = document.getElementById(nameId);
        if(name.value == "")
        {
            alert(nameMessage);
            name.focus();
            return false;
        }
    }
    
    if(document.getElementById(emailId))
    {
        var email = document.getElementById(emailId);
        if(email.value == "")
        {
            alert(emailMessage);
            email.focus();
            return false;
        }
        else if (email.value.indexOf ('@', 0) == -1 || email.value.indexOf ('.', 0) == -1 )
        {
            alert(emailSignatureMessage);
            email.focus();
            return false;
        }
    }
    
    if(document.getElementById(commentsId))
    {
        var comments = document.getElementById(commentsId);
        if(comments.value == "")
        {
            alert(commentsMessage);
            comments.focus();
            return false;
        }
    }
    return true;
}
function ResetEmail(nameId, titlesId, jobId, emailId, countriesId, commentsId)
{
    if(document.getElementById(nameId))
    {
        document.getElementById(nameId).value = '';
    }
    
    if(document.getElementById(titlesId))
    {
        document.getElementById(titlesId).selectedIndex = 0;
    }
    
    if(document.getElementById(jobId))
    {
        document.getElementById(jobId).value = '';
    }
    
    if(document.getElementById(emailId))
    {
        document.getElementById(emailId).value = '';
    }
    
     if(document.getElementById(countriesId))
    {
        document.getElementById(countriesId).selectedIndex = 0;
    }
    
    if(document.getElementById(commentsId))
    {
        document.getElementById(commentsId).value = '';
    }
}
function checkCookie()
{
    var cookieName = 'MBRFVotingPollCookieArabic';
    var c_name = getCookie(cookieName);
    if (c_name == null || c_name == "")
    {
        return false;
    }
    return true;
}

function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1)
        { 
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1)
            {
                c_end=document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        } 
    }
    return "";
}

function setCookie(c_name,value)
{
    var expiryDate = new Date(2050,0,30);
    document.cookie = c_name + "=" + escape(value) + "; expires=" + expiryDate.toGMTString();
} 
   
function PrintContent(contentId)
{ 
    var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,"; 
    disp_setting += "scrollbars=yes,width=650, height=600, left=100, top=25"; 
    var content_vlue = document.getElementById(contentId).innerHTML; 
    var docprint = window.open("","",disp_setting); 
    docprint.document.open(); 
    docprint.document.write('<html><head><title>مؤسسة محمد بن راشد آل مكتوم</title><link href="/SiteCollectionImages/ar-sa/Core Styles/styles.css" rel="stylesheet" type="text/css" />'); 
    docprint.document.write('</head><body onload="self.print()" style="padding-right:10px">');
    docprint.document.write('<table cellspacing="0" cellpadding="0" border="0" align="center" width="35%"><tr><td>&nbsp;<td><td>');
    docprint.document.write('<div align="left"><img src="/SiteCollectionImages/Images/ar-sa/PrintLogo.gif"/></div>');
    
    docprint.document.write('<div class="greysec1px"><br/></div></div>');
   
    docprint.document.write(content_vlue);
    
    docprint.document.write('</td><td>&nbsp;</td></tr></table>');
    docprint.document.write('<script type="text/javascript">var divGalleryLink = document.getElementById("ctl00_PlaceHolderMain_eventGalleryLink_divMain");if(divGalleryLink != null){divGalleryLink.style.display="none";}');
    docprint.document.write('var divList = document.getElementById("ctl00_PlaceHolderMain_backToList_divMain");if(divList != null){divList.style.display="none";}');
    docprint.document.write('var divProgramFaqLink = document.getElementById("ctl00_PlaceHolderMain_programFaqLink_divMain");if(divProgramFaqLink != null){divProgramFaqLink.style.display="none";}');
    docprint.document.write('var divBreadcrumb = document.getElementById("ctl00_PlaceHolderMain_breadcrumb_Breadcrumb");if(divBreadcrumb != null){divBreadcrumb.style.display="none";}');
    docprint.document.write('var divPrintSection = document.getElementById("printsection");if(divPrintSection != null){divPrintSection.style.display="none";}');
    docprint.document.write('</script>');
    docprint.document.write('<div class="paddingprinttilte" align="center"><div><a href=' + location.href + '>' + location.href + '</a></div>');
    docprint.document.write('</body></html>'); 
    docprint.document.close(); 
    docprint.focus(); 
}

function ValidateEmailToFriend(recipientEmailId, recipientEmailMessage, yourNameId, yourNameMessage, emailSignatureMessage, yourEmailId, yourEmailMessage)
{
    if(document.getElementById(recipientEmailId))
    {
        var recipientEmail = document.getElementById(recipientEmailId);
        if(recipientEmail.value == "")
        {
            alert(recipientEmailMessage);
            recipientEmail.focus();
            return false;
        }
        else if (recipientEmail.value.indexOf ('@', 0) == -1 || recipientEmail.value.indexOf ('.', 0) == -1 )
        {
            alert(emailSignatureMessage);
            recipientEmail.focus();
            return false;
        }
    }
    
    if(document.getElementById(yourNameId))
    {
        var yourName = document.getElementById(yourNameId);
        if(yourName.value == "")
        {
            alert(yourNameMessage);
            yourName.focus();
            return false;
        }
    }
    
    if(document.getElementById(yourEmailId))
    {
        var yourEmail = document.getElementById(yourEmailId);
        if(yourEmail.value == "")
        {
            alert(yourEmailMessage);
            yourEmail.focus();
            return false;
        }
        else if (yourEmail.value.indexOf ('@', 0) == -1 || yourEmail.value.indexOf ('.', 0) == -1 )
        {
            alert(emailSignatureMessage);
            yourEmail.focus();
            return false;
        }
    }
    return true;
}
function ResetEmailToFriend(recipientEmailId, yourNameId, yourEmailId, notesId)
{
    if(document.getElementById(recipientEmailId))
    {
        document.getElementById(recipientEmailId).value = '';
    }
    
    if(document.getElementById(yourNameId))
    {
        document.getElementById(yourNameId).value = '';
    }
    
    if(document.getElementById(yourEmailId))
    {
        document.getElementById(yourEmailId).value = '';
    }
    
    if(document.getElementById(notesId))
    {
        document.getElementById(notesId).value = '';
    }
}
function ValidateCommentsOnPage( yourNameId, yourNameMessage, emailSignatureMessage, yourEmailId, yourEmailMessage) {
   

    if (document.getElementById(yourNameId)) {
        var yourName = document.getElementById(yourNameId);
        if (yourName.value == "") {
            alert(yourNameMessage);
            yourName.focus();
            return false;
        }
    }

    if (document.getElementById(yourEmailId)) {
        var yourEmail = document.getElementById(yourEmailId);
        if (yourEmail.value == "") {
            alert(yourEmailMessage);
            yourEmail.focus();
            return false;
        }
        else if (yourEmail.value.indexOf('@', 0) == -1 || yourEmail.value.indexOf('.', 0) == -1) {
            alert(emailSignatureMessage);
            yourEmail.focus();
            return false;
        }
    }
    return true;
}
function ResetCommentOnPage(yourNameId, yourEmailId, notesId) {
    

    if (document.getElementById(yourNameId)) {
        document.getElementById(yourNameId).value = '';
    }

    if (document.getElementById(yourEmailId)) {
        document.getElementById(yourEmailId).value = '';
    }

    if (document.getElementById(notesId)) {
        document.getElementById(notesId).value = '';
    }
}
function SendMailToFriend()
{
    window.open('/Arabic/Pages/EmailToFriend.aspx?Subject=' + document.title + '&Url=' + window.location.href, '', 'width=600,height=335,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
}
function CommentThisPage() {
    window.open('/Arabic/Pages/ComentsOnPage.aspx?Subject=' + document.title + '&Url=' + window.location.href, '', 'width=600,height=335,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
}
/**///-->



/*scripts for the marquee scrolling begin*/

/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 135)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
/*scripts for the marquee scrolling end*/

/*inside scrolling begin*/
//Written by Nathan Faubion: http://n-son.com
//Use this or edit how you want, just give me
//some credit!

function jsScroller (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className.indexOf("Scroller-Container") > -1) {
			o = list[i];
		}
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px";
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 40
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("Scroller-Container") > -1) {
				o = list[i];
			}
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
};


/*inside scrolling end*/
var oldDivId	= "news_1";

function ShowHideTabs(id)
{
	 
	if (oldDivId != id) {
		var Div	= document.getElementById('div' + id);
		var TD	= document.getElementById(id);
		if (oldDivId) {
			var oldDiv	= document.getElementById('div' + oldDivId);
			var oldTD	= document.getElementById(oldDivId);
			
			oldDiv.style.display	= "none";
			oldTD.className			= "headrpt2";
		}
		
		Div.style.display	= "";
		TD.className		= "headrpton";	
		oldDivId			= id;
		scrolling2();
		
	}
}