$(document).ready(function() {
$("#contact_form").submit(function() {

efirst_name=$('input[name=fname]').val();
elast_name=$('input[name=lname]').val();
eemail=$('input[name=email]').val();
emobile=$('input[name=mobile]').val();
etel=$('input[name=tel]').val();


$.get('../Common/Include/register_interest.asp', {
    first_name: efirst_name,
    last_name: elast_name,
    email: eemail,
    mobile: emobile,
    tel: etel
}, function() {
    $('#registration_confirmation').html('<p><strong>Thank you for your interest.</strong></p><p><strong>We will contact you once further information is available.</strong></p>');
    $('table.Form').hide();

});
    
   jQuery().ajaxStart(function() {
   
        $("div#loader").show();
    
   });
   

    
    

return(false);

});


});


function ExecuteHandlers()
 {
  CenterPos();
  $(window).resize(function(){ CenterPos(); });
  //AssignRollovers(".Navigation0");
  AnimateFlash();
  //LightBoxToggle();
  //changeLang();
  setInterval("Rotate()",2500);
  $(".Didyouknow li").eq(0).fadeIn("slow");

/* IE background flickering */

	if(jQuery.browser.msie && jQuery.browser.version==6.0) 
	{
	 document.execCommand("BackgroundImageCache",false,true);
  }  
 }
 
 
function CenterPos()
 {
 
  //X=$(document).width();
  Y=$(document).height();
  //x=$(".Master").width();
  y=$(".Master").height();
  //CenterX=(X-x)/2;
  CenterY=(Y-y)/2;
  $(".Master").css({top:CenterY}); 
 
 } 

var IsActive=0;

function AssignRollovers(NavClass)
 {
 
  $(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 AnimateFlash()
 {
  $(".FlashPane img").load(function(){$(".FlashPane img").fadeIn(1500);});	
  
 }
 

var DelayId=0;

function LoadContent(NavId)
 {
  $(NavId+" li a")
  .bind("click",function(e)
   {
    $(this).parent().parent().find("a").removeClass();
    $(this).addClass("Active");
   	
    if($(this).attr("rel")!="Ext")
    {
     $("#Content").load("Data.asp?Filter="+$(this).attr("rel"));
     return false;
    }
    else
     return true;
  });
    
 }

function DirectLink(LoadLink)
 {
 	  if(LoadLink)
    {
     $("#Content").load("Data.asp?Filter="+LoadLink);
     $("a[rel='"+LoadLink+"']").addClass("Active");
    }
 } 
 

function InitiateThickbox()
 {
  tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
	clearTimeout(DelayId);
 } 
 
function GalleryPager()
 {

  $(".Pager").find("a#Next").bind("click",function(){
  	$(this).css("display","none");
  	$("#List1").css("display","none");
  	$("#List2").css("display","block");
  	$("a#Previous").css("display","block");
  	return false;
  	});

  $(".Pager").find("a#Previous").bind("click",function(){
  	$(this).css("display","none");
  	$("#List2").css("display","none");
  	$("#List1").css("display","block");
  	$("a#Next").css("display","block");
  	return false;
  	});

 }

function LightBoxToggle()
 {
  $(".Footer li a")
  .bind("click", function(e)
   {
   	
   	if($(this).attr("rel")=="#Home")
   	return true;
   	
   $("#LightBox").css({height:$(".Master").height()+70});
   $("#LightBox").fadeIn("slow");
   if(document.documentElement && document.documentElement.scrollTop)
    $($(this).attr("rel")).css("top",document.documentElement.scrollTop);
   else
    $($(this).attr("rel")).css("top",self.pageYOffset);
   $($(this).attr("rel")).fadeIn("slow"); 
   
   $("h5 a[rel='HideLightbox']")
   .bind("click",function(e)
    {
   	 $("#LightBox").fadeOut("slow");
     $(".PopUp").fadeOut("slow");
     return false;
    }
   );
    return false;
   }
  );  
}    

function ShowFaq()
 {

  $(".Facts li a")
  .bind("click",function(){
  	$(this).parent().parent().find("a").removeClass("Active");
  	$(this).addClass("Active");
  	$(this).parent().parent().find("div:visible").slideUp(600);
  	$(this).next().slideDown(400);
  	
  	return false;
  	});
 
 
 }



var cIndex=1;
var pIndex=0;
function Rotate()
 {
 	//alert('done');
 	if(cIndex==pIndex)
  $(".Didyouknow li").eq(cIndex).fadeIn("slow");
  
  else
  {
   $(".Didyouknow li").eq(pIndex).fadeOut("slow",function(){$(".Didyouknow li").eq(cIndex).fadeIn("slow");});

  }	
  
  pIndex=cIndex;
  
  if(cIndex==$(".Didyouknow li").length-1)
  cIndex=0;
  else
  cIndex=cIndex+1;


 }
 

function changeLang()
 {
 	$("a.Language").
 	bind("click",function(){ 
  location.href=location.href.replace("EN","AR");
  });
 } 
