function ExecuteHandlers()
 {
 	 
 	 AssignRollovers("navigation0");
 	 AssignRollovers("navigation1");
 	 Externals();
 	 TextOptions();
 	 changelang();
 	 $(".teamlist li").eq(0).css({display:"block"});
 	 $(document).everyTime(6000,function(i){
 	  newsticker();
 	  Rotatelist();
 	  
 	});
 	 

 }

/*

Mouse Rollover Behaviour Function

*/

function AssignRollovers(NavClass)
 {
  
  var Isactive=0;  
  
  $("."+NavClass+" li a")
  .bind("mouseover", function(e)
  {
  active=$(this).find("img").attr("src");
  if(active.indexOf("active")<=-1)
  {
  active=active.replace("_en","active_en");
  $(this).find("img").attr("src",active);
  Isactive=1;
  }
  }
  );
  
  $("."+NavClass+" li a")
  .bind("mouseout", function(e)
  {
  active=$(this).find("img").attr("src");
  if(Isactive==1)
  {
  active=active.replace("active_en","_en");
  $(this).find("img").attr("src",active);
  Isactive=0;
  }
  }
  ); 
 
 }

function Externals()
 {
  $("a[rel='External']")
  .bind("click",function(){this.target="_blank";});
 }    



var cIndex=0;
var nIndex=1;

function Rotatelist()
 {

   $(".teamlist li").eq(cIndex).fadeOut("slow",function(){
   	
   	$(".teamlist li").eq(nIndex).fadeIn("slow");
   cIndex=nIndex;
   nIndex=nIndex+1;
   
   if(nIndex == $(".teamlist li").length)
   nIndex=0;
   	
   	
   	});
  

   window.status = cIndex+" "+nIndex;

 } 


function GalleryTitles()
 {
  //$(".gallery li a").append("<strong>"+$(this)+"</strong>");
 
 $(".gallery li a").each(function(index)
  {
   $(this).append("<strong>"+$(this).find("img").attr("title")+"</strong>");
   
  });
 
 $(".gallery li a img").removeAttr("style"); 
 
 }


function TextOptions()
 {
 	var currentFontSize = $("html").css("font-size"); 
 	 

 	

  $("div.typeoptions a.textop1").addClass("Active");
  
  $("div.typeoptions a.textop1")
  .bind("click",function()
   { 
   	$(this).parent().find("a").removeClass("Active"); 
   	$(this).addClass("Active"); 
   	$(".rightpane").css("font-size",currentFontSize); 
   	$.cookie('fontsize',currentFontSize,{path:"/",domain:"moorfields.ae"}); 
   	return false;
   }
  );

  $("div.typeoptions a.textop2")
  .bind("click",function()
   { 
   	$(this).parent().find("a").removeClass("Active"); 
   	$(this).addClass("Active"); 
   	$(".rightpane").css("font-size",18); 
   	$.cookie('fontsize',18,{path:"/",domain:"moorfields.ae"});   		 	
   	return false;
   }
  );

  $("div.typeoptions a.textop3")
  .bind("click",function()
   { 
   	$(this).parent().find("a").removeClass("Active"); 
   	$(this).addClass("Active"); 
   	$(".rightpane").css("font-size",20);  
   	$.cookie('fontsize',20,{path:"/",domain:"moorfields.ae"});   	 	 	
   	return false;
   }
  ); 
 }  
 
 

function changelang()
 {
  $("a.language")
  .bind("click",function()
   {
   	if(location.href.indexOf("/en/")>=0)
   	
     location.href=location.href.replace("/en/","/ar/");
    
    else

     location.href=location.href.replace("/ar/","/en/");
    	
   
   return false;
   });
 }



function newsticker()
 {
 	var elheight = $(".sf_newsList li").eq(0).height();
  var eltotal = $(".sf_newsList li").length;
  $(".sf_newsList").animate({marginTop:-(elheight+20)},500,function(){
  	 
     $(".sf_newsList li").eq(0).clone().appendTo(".sf_newsList");
  	 $(".sf_newsList li").eq(0).remove();
  	 $(".sf_newsList").css({marginTop:0});
  	 
  	
  	});
  
  
  
 } 






 
