
// Preloading Images
var NewImgs = new Array('Image/barAll1.gif',
'Image/TitleAr1.gif',
'Image/TitleEn1.gif',
'Image/ByAra1.gif',
'Image/ByEng1.gif',

"Image/Menue/homeA.gif",
"Image/Menue/ExhibA.gif",
"Image/Menue/GALLERYA.gif",
"Image/Menue/MailListA.gif",
"Image/Menue/ProductsA.gif",
"Image/Menue/TUTORIALSA.gif",
"Image/Menue/VBookA.gif",

"Image/Menue/homeE.gif",
"Image/Menue/ExhibE.gif",
"Image/Menue/GALLERYE.gif",
"Image/Menue/MailListE.gif",
"Image/Menue/ProductsE.gif",
"Image/Menue/TUTORIALSE.gif",
"Image/Menue/VBookE.gif",

"Image/Line1.gif",
"Image/Line2.gif",
"Image/Line3.gif",
"Image/Line4.gif",

"Image/IntroE.gif",
"Image/IntroE.gif",
"Image/floral.gif",
"Image/Des-Two-Quart1.gif",
"Image/Des-Two-Quart2.gif",

"exhibition/Images/Euclid.gif",
"exhibition/Images/Galen.gif",
"exhibition/Images/Alzahrawi.gif",
"exhibition/Images/Aljazari_1.gif",
"exhibition/Images/School_1.gif");



var imgLen = NewImgs.length;
var loaded = new Array(), preImages = new Array(), currCount = 0, pending = 0;

function loadImages() {
	for (i = 0; i < imgLen; i++) {
		preImages[i] = new Image();
		preImages[i].src = NewImgs[i];
		loaded[i] = 0;
		
	}
	
//	checkLoad();
}

function checkLoad() {
	if (currCount == imgLen) { setTimeout("Wait_fadeOut()",1000); return; }
	for (i = 0; i < imgLen; i++) {
		if (!loaded[i] && preImages[i].complete) {
			loaded[i] = 1; pending++; currCount++;
			checkLoad();
			return;
		}
	}
	setTimeout("checkLoad()",10);
}



////////// other functions


function Fade_In(){

  $(document).ready(function(){
							 
	$("#Wait").css("marginTop",240);						 
    $("#Wait").fadeIn(1000,function(){
									setTimeout("checkLoad()",1500)
									});
	
  });

setTimeout("loadImages()",1200)


}



function Wait_fadeOut(){
	
  $(document).ready(function(){
    $("#Wait").fadeOut(1000,function(){
									
									$("#All").show();
									$("#footerlayer").show();
									setTimeout("fadeinSides()",100);
									
									});
	
	
  });
	
}





 
 
 function fadeinSides(){

var Layers = new Array('hedder1','footerlayer','Lft_corner','Right_corner','MainContainer_E1')

	

		for (i = 0; i < Layers.length; i++) {
			
				 
				// $("#"+Layers[i]+"").css("backgroundImage","url("+this_image_url+")");
				 
				
			$("#"+Layers[i]+"").fadeIn(1500);

	}

	setTimeout("fadeinContent();",700)
	 }
 

 function fadeinSides2(){
$("#All").show();
$("#footerlayer").show();


var Layers = new Array('hedder1','footerlayer','Lft_corner','Right_corner','MainContainer_E1')

	
		for (i = 0; i < Layers.length; i++) {
			
				
			$("#"+Layers[i]+"").fadeIn(1500);

	}

	setTimeout("fadeinContent();",700)
	 }
 
function fadeinContent(){
	
	$("#Barcode").css("backgroundImage","url('Image/barAll1.gif')");
    $("#ByEnglish").css("backgroundImage","url('Image/ByEng1.gif')");
    $("#ByArabic").css("backgroundImage","url('Image/ByAra1.gif')");
	


var Layers = new Array('MainContainer_E2','VistTL','VistTC','VistTR','VistBL','VistBC','VistBR','CopyRight','Barcode','ByEnglish','ByArabic','A1','A2','A3','A4','A5')

	
		for (i = 0; i < Layers.length; i++) {
			
				
			$("#"+Layers[i]+"").fadeIn(1500);

	}
	
   // $("#MainContainer_E2").fadeIn(1500);

setTimeout("FadingTrans(6,1);",8000);

}



function FadingTrans(z,n){
//var ContentLayers = new Array('A1','A4','A7','A10','A14')




var DivOut = "A"+n;

var DivIn = "A"+z;

$("#"+DivIn+"").fadeIn(1300);
$("#"+DivOut+"").fadeOut(1300);

		var z= z +1;
		var n= n +1;
		if(z==16){z=1};
		if(n==16){n=1};
		
//setTimeout("FadingTrans('i');",3000);
//c=c+1;
t=setTimeout("FadingTrans("+z+","+n+")",6000);
}



