  /* -------------------------------------------------

START:: EXTERNAL LINKS

------------------------------------------------- */
function linksExternal(){

   if (document.getElementsByTagName){
     var anchors = document.getElementsByTagName("a");
     for (var i=0; i<anchors.length; i++){
	       var anchor = anchors[i];
		   if (anchor.getAttribute("rel") == "_external"){
			   anchor.target = "_blank";
           }
      }
    }
}
/* -------------------------------------------------

END:: EXTERNAL LINKS

------------------------------------------------- */

		var height = $(window).height();
		var width = $(window).width();	
		//resize Gallery Holder
		if (height < 850  ){
		
		globalResize = 380;
		
		
		}else{
			
		globalResize = 380;	
		}



/*---------------------------
Start:: FullHolder Show/Hide
*----------------------------*/		
function showFullHolder(){

$("#fullHolder").fadeIn();
	
};

function hideFullHolder(){

$("#fullHolder").fadeOut();
	
};

/*---------------------------
Start:: FullHolder Show/Hide
*----------------------------*/


/*******************************************/


/*------------------
Start:: Login Form
*-------------------*/
function bindLoginLoader(){

	$("#customers").click(function(){
	
		loginLoader();				   
	
	});
	
};

function loginLoader(){
	
hideFullHolder();
hideGallery();
contentOpen();

$("#loaderActionGallery").css({display: 'block'});
$.post("_fetchContent/_login/login.php",
  {customerWindowHeight: $(document).height(), customerWindowWidth: $(document).width() },
 
  function(loginContent){
	
		$("#productTitle").fadeOut();
		$("#contentTitle").fadeOut();
		$("#galleryHolder").fadeOut();
		closeBtn("hide");
	
  
  		$("#productContent").fadeOut(function(){
  		$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");
			
			//$("#productContent").html(loginContent);

			$("#fullHolderData").html(loginContent);
			showFullHolder();		   

			
						// validate signup form on keyup and submit
						var loginForm = $("#loginForm").validate({
						submitHandler: function(loginForm){$(loginForm).ajaxSubmit({
						
					
						beforeSubmit:function(){
							
						$("#loaderActionGallery").css({"display" : "block"});	
						},
						
						
						success:function(data){
						var response = data.split("@");
						if (response[0] == 1){
						
							
							$("#loginFormHolder").hide();
							
							
						}
						
						
						$("#loginResults").html(response[1]);
						
						
						$("#loaderActionGallery").css({"display" : "none"});
						$("a[rel^='prettyPhoto']").prettyPhoto({
						theme: 'dark_square' /* light_rounded / dark_rounded / light_square / dark_square */															   
															   
															   });
						return false;
						}//,
						//target: "#loginResults"
						});
						
						},
						rules: {
								loginName: "required",
								loginPassword: "required"
							   }
						});// end: Validator
			
			//bind contact Loader to Lost Password Button
			$("#lostPass").click(function(){contactLoader();});
   
   			//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});
   
   
  			 $("#productContent, #productTitle").fadeIn();
																 
			   loadSingleImage("customers");													 
			 
			 
		
			 });
   
			 $("#loaderActionGallery").fadeOut();
	
  }); 
	
};


/*------------------
End:: Login Form
*-------------------*/



/*******************************************/



/*------------------------------
Start:: Identity Loader Form
*-------------------------------*/

function bindIdentityVideo(){
$("#identityVideo").click(function(){identityVideoLoader();});	
}

function bindIdentityLoader(){
$("#identity").click(function(){identityLoader();});
};


function identityLoader(){
hideFullHolder();	
hideGallery();
closeBtn("hide");
$("#loaderActionGallery").css({display: 'block'});
contentOpen();	

$.post("_fetchContent/_identity/identity.php",
  {},
  function(identity){
	
	
	$("#productTitle").fadeOut();
	$("#contentTitle").fadeOut();
	$("#productContent").fadeOut();
	
	$("#galleryHolder").fadeOut(function(){
																					 
	//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});																				 		

		$("#fullHolderData").html(identity);
			showFullHolder();
			loadSingleImage("identity");
			$("#loaderActionGallery").css({display: 'none'});			
		
	
	}); //end:: FadeOut		  
		  

});// end:: post   
};// end:: Function


function identityVideoLoader(){
hideGallery();	
$("#fullHolderData").html("");	
$("#galleryHolder, #contentTitle").html("");
$("#productTitle").html("");
$("#productContent").html("");
contentClose();
closeBtn("hide");

resizeLoader();
navBtnState("hide");
// show Loaders
$("#slideLoaderInner,#loaderAction").css({"display" : "block"});

// $("#loaderActionGallery").css({display: 'block'});

$.post("_fetchContent/_identity/identityVideo.php",
  {videoHeight: $("#navigationHolderInner").height()},
  function(videoData){

	$(".wrapperImage").hide();
	$("embed").remove();
	$("#slideHolder").append(videoData);
	
	return false;
	$("#productTitle").fadeOut();
	$("#contentTitle").fadeOut();
	$("#productContent").fadeOut();
	
	$("#galleryHolder").fadeOut(function(){
																					 
	//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});																				 		

		$("#fullHolderData").html(videoData);
			showFullHolder();
			//loadSingleImage("identity");
			$("#loaderActionGallery").css({display: 'none'});			
		
	
	}); //end:: FadeOut		  
		  

});// end:: post 	
   
};// end:: Function


/*------------------------------
End:: Identity Loader Form
*-------------------------------*/



/*******************************************/


//start:: bind product loaders		
function bindProductLoaders(){
	$("ul.servicesContent li a").bind("click",function(){
			productsLoader(this.id);
	});
};
//end:: bind product loaders



/*------------------------------
START:: CONTACT LOADERS
*-------------------------------*/
function bindContactLoader(){

$("#contact").click(function(){
	contactLoader();
});	
	
};

function bindwedProTeamLoader(){
$("#wedProTeam").click(function(){
	wedProLoader();
});		
}


function bindDestinationLoader(){

$("#profilDestination").click(function(){
	destinationLoader();
});	
	
};


function wedProLoader(){
hideFullHolder();	
hideGallery();
$("#loaderActionGallery").css({display: 'block'});
contentOpen();	
closeBtn("hide");

$.post("_fetchContent/_wedProVideos/wedProTeam.php",
  {},
  function(contact){
	  
	$("#productTitle").fadeOut();
	$("#contentTitle").fadeOut();
	$("#productContent").fadeOut();
	$("#galleryHolder").fadeOut();
$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");	
	$("#productContent").fadeOut(function(){
		$("#fullHolderData").html(contact);
		showFullHolder();
		//$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");
		//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});
		
		loadSingleImage("wedproteam");
		$("#productContent").hide();
		$("#loaderActionGallery").css({display: 'none'});
    
	}); //end:: FadeOut CallBack
  

});
};


/*------------------------------
Start:: Destination Loader
*-------------------------------*/
 
function destinationLoader(){
hideFullHolder();	
hideGallery();
$("#loaderActionGallery").css({display: 'block'});
contentOpen();	
closeBtn("hide");

$.post("_fetchContent/_destination/destination.php",
  {},
  function(contact){
	  
	$("#productTitle").fadeOut();
	$("#contentTitle").fadeOut();
	$("#productContent").fadeOut();
	$("#galleryHolder").fadeOut();
$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");	
	$("#productContent").fadeOut(function(){
		$("#fullHolderData").html(contact);
		showFullHolder();
		//$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");
		//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});
		
		loadSingleImage("destination");
		$("#productContent").hide();
		$("#loaderActionGallery").css({display: 'none'});
    
	}); //end:: FadeOut CallBack
  

});
};
/*------------------------------
END:: Destination Loader
*-------------------------------*/


/*------------------------------
Start:: Contact Loader
*-------------------------------*/
 
function contactLoader(){
hideFullHolder();	
hideGallery();
$("#loaderActionGallery").css({display: 'block'});
contentOpen();	
closeBtn("hide");

$.post("_fetchContent/_contact/contact.php",
  {},
  function(contact){
	  
	$("#productTitle").fadeOut();
	$("#contentTitle").fadeOut();
	$("#productContent").fadeOut();
	$("#galleryHolder").fadeOut();
$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");	
	$("#productContent").fadeOut(function(){
		$("#fullHolderData").html(contact);
		showFullHolder();
		//$("#productTitle, #contentTitle,#productContent,#galleryHolder").html("");
		//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});
						
						// validate signup form on keyup and submit
						var contactForm = $("#contactForm").validate({
						submitHandler: function(contactForm){$(contactForm).ajaxSubmit({
						beforeSubmit:function(){
						$("#loaderActionGallery").css({display: 'block'});	
						},
						success:function(){
						//$('#contactHolder').unblock();
						$("#loaderActionGallery").css({display: 'none'});
						return false;
						},
						target: "#contactResult"
						});
						
						},
						rules: {
								fullName: "required",
								email: {
									required: true,
									email:true
									
								},
								message: "required"
							   }
		
						});// end: Validator																					  
		loadSingleImage("contact");
		$("#productContent").hide();
		$("#loaderActionGallery").css({display: 'none'});
    
	}); //end:: FadeOut CallBack
  

});
};
/*------------------------------
END:: Contact Loader
*-------------------------------*/










/*------------------------------
Start:: Products Loader
*-------------------------------*/
function productsLoader(productId){
//hideFullHolder();
hideGallery();
contentOpen();
$("#loaderActionGallery").fadeIn();
$.post("_fetchContent/_products/print.php",
  { prId: productId },
  function(prContent){
  $("#galleryHolder, #contentTitle").html("");
  //load the product Image
  
  
  // SET NEW IMAGE
  newLabel = new Image();  

  if($.browser.msie){
      labelLoader = '_images/_prtoductLabels/'+ productId + lang +'.png?'+ (new Date()).getTime() +'';
  }else{
      labelLoader = '_images/_prtoductLabels/'+ productId + lang +'.png';
  }

// assign Image Path to Img Dom Object
newLabel.src = labelLoader;

// bind the load event to Img Object
$(newLabel).bind('load', function() {

$("#galleryHolder").fadeOut("fast",function(){
								
//var	productTitle = '<img src="_images/_prtoductLabels/'+ productId + lang +'.png?'+ (new Date()).getTime() +'" alt=""/>';		

		$("#productTitle").html("");
//		$("#productContent").html(prContent);
		$("#fullHolderData").html(prContent);
		showFullHolder();
		//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});
		closeBtn("hide");
		$("#loaderActionGallery").fadeOut(function(){
										  loadSingleImage(productId);
										  });
	});

//$("#productContent").fadeIn();
//$("#productTitle").fadeIn();
	

}); //End Label Loader

  }); 

	
};

/*
end:: ProductsLoader
*/

function closeBtn(mode){
if (mode == "hide"){
$("#contentControllerBtn").fadeOut();	
}else if (mode == "show"){
$("#contentControllerBtn").fadeIn();	
}
};

function imgLoad(img, completeCallback){

loader = '_imageGallery/image_upload/'+ img +'?'+ (new Date()).getTime() +'';

if(loader!=null && completeCallback!=null){
	
	$("#slideLoaderInner,#loaderAction").css({
			"display" : "block"
	});		
	
	var loadWatch = setInterval(watch, 100);
	
	function watch(){
		if(loader.complete){
		clearInterval(loadWatch);
		$(".wrapperImage").fadeOut("fast");
		$('.wrapperImage').attr('src','_imageGallery/image_upload/'+ imgId +'');
		completeCallback(loader);
		}
	}

}else{
	
	//if(typeof errorCallback=="function") errorCallback();
	//alert ("send Me Data, Image And CallBack Function");
	}
};


function showImage(img){
resizeLoader();	
	//alert ("hello image loaded");
	$('.wrapperImage').fadeIn("fast"); 
		resizeLoader();
		setNavBtns(img);
		//alert("loaded");
	//return false;
};
/* start:: Function To Load Image */

/* --------------------------------------------------



START::----------------------------------------------
FUNCTION TO LOAD THE IMAGE FROM THUMBNAILS SECTION 
TO THE MAIN CONTAINER -- IMAGE HOLDER
-----------------------------------------------------*/
function loadImage(img){
$("embed").remove();
//resize The Loader
resizeLoader();

//get Image Id To Load
var imgId = img;


// show Loaders
$("#slideLoaderInner,#loaderAction").css({"display" : "block"});	

// set new Dom Image	
var galleryWrapper = new Image(); 

//set Path to load Image
if($.browser.msie){
     	 
		 var  galleryImage = '_imageGallery/image_upload/'+ imgId +'?'+ (new Date()).getTime() +'';
//		 alert ("ie loading image");
//		 alert (galleryImage);
  
  }else{
         
		 var galleryImage = '_imageGallery/image_upload/'+ imgId;// +'?'+ (new Date()).getTime() +'';
}

// assign Image Path to Img Dom Object
galleryWrapper.src = galleryImage;

$(galleryWrapper).unbind().bind("load",function() {  
		
		$("#slideLoaderInner,#loaderAction").css({
		"display" : "none"
		});	 
		
		$('.wrapperImage').fadeOut(function(){ 
			  $('.wrapperImage').attr('src', galleryImage);
				resizeLoader();	
				setNavBtns(img);
		}).fadeIn(); //end:: WrapperImage FadeOut	 
	 
 });	
};

/* --------------------------------------------------
END::----------------------------------------------
FUNCTION TO LOAD THE IMAGE FROM THUMBNAILS SECTION 
TO THE MAIN CONTAINER -- IMAGE HOLDER
-----------------------------------------------------*/



/* --------------------------------------------------
START::----------------------------------------------
Load Single Image Function: 
ACCEPT: imageName
-----------------------------------------------------*/
function loadSingleImage(imageName){
$("embed").remove();
resizeLoader();
navBtnState("hide");
// show Loaders
$("#slideLoaderInner,#loaderAction").css({"display" : "block"});	

// set new Dom Image	
singleWrapper = new Image(); 

//set Path to load Image
  if($.browser.msie){
       singleImageSrc = '_images/_productsCatImgs/'+ imageName +'.jpg?'+ (new Date()).getTime() +'';
  }else{
     	singleImageSrc = '_images/_productsCatImgs/'+ imageName +'.jpg';
  }

// assign Image Path to Img Dom Object
singleWrapper.src = singleImageSrc;

// bind the load event to Img Object
$(singleWrapper).unbind().bind('load', function() { 
       
		$("#slideLoaderInner,#loaderAction").css({"display" : "none"});
		
		
		$('.wrapperImage').fadeOut(function(){ 
		
			$('.wrapperImage').attr('src', singleImageSrc);
		
		}).fadeIn(); //end:: WrapperImage FadeOut	
});
	
};
/* --------------------------------------------------
END::----------------------------------------------
Load Single Image Function: 
ACCEPT: imageName
-----------------------------------------------------*/







/* --------------------------------------------------
START::----------------------------------------------
RESIZE LOADER Function: 
CENTER THE IMAGE LOADER
-----------------------------------------------------*/
function resizeLoader(){

		//slideLoaderInner Height and Width
		var loaderInnerWidth = $(window).width();
		var loaderInnerHeight = $(window).height();
		$("#slideLoaderInner,#navigationHolder").css({ 
								"width"  : loaderInnerWidth,
								"height"  : loaderInnerHeight - 170
							 });
		
		//resize Next / Previus Photo Button
		$("#nextPhoto, #previousPhoto").css({ 
							
							"height": loaderInnerHeight - 170,
							"width": (loaderInnerWidth / 2) - 1
							});
	
};
/* --------------------------------------------------
END::----------------------------------------------
RESIZE LOADER Function: 
CENTER THE IMAGE LOADER
-----------------------------------------------------*/






/* --------------------------------------------------
START::----------------------------------------------
FADEIN FADEOUT GALLERY HOLDER Function: 
FADEIN FADEOUT GALLERY THUMBNAILS
-----------------------------------------------------*/
function updateGallery(data){

	navContent = data.split("@");
	$("#contentTitle").fadeOut();
	$("#galleryHolder").fadeOut(function(){
		$("#contentTitle").html("<img src='_imageGallery/image_upload/"+ navContent[1] +"' />");
		$("#galleryHolder").html(navContent[0]);
		applyNav();
		$("#galleryHolder").fadeIn();
		$("#contentTitle").fadeIn();
		loadImageController();	
		resize();
		resizeDataHolder(0);
		iniNavBtns();
	});
	
//		$("#contentTitle").fadeOut(function(){								
//		$(this).fadeIn();
//		});	
	$("#loaderActionGallery").fadeOut();	
};

/* --------------------------------------------------
END::----------------------------------------------
FADEIN FADEOUT GALLERY HOLDER Function: 
FADEIN FADEOUT GALLERY THUMBNAILS
-----------------------------------------------------*/







/* --------------------------------------------------
START::----------------------------------------------
APPLY THE AJAX PAGGING TO GALLERY THUMBNAILS
NEXT AND PREVIOUS PAGES
-----------------------------------------------------*/

function nextPage(){
var nextPage= $('.nav_btn_next').attr("rel").split("&");// response.split("&");
$("#loaderActionGallery").css({
							  display: 'block'
							  });
$.post("_fetchLibrary/fetchImageGallery.php",
  { galleryCatId: 'cat_' + nextPage[1], resultPage: nextPage[0]},
  function(response){
  updateGallery(response); 
  });	
	
}

function prevPage(){
var prevPage= $('.nav_btn_back').attr("rel").split("&");// response.split("&");
$("#loaderActionGallery").css({
							  display: 'block'
							  });
$.post("_fetchLibrary/fetchImageGallery.php",
  { galleryCatId: 'cat_' + prevPage[1], resultPage: prevPage[0]},
  function(response){
  updateGallery(response);
  });	
	
};


function applyNav(){
	
$("#nextPage").click(function(){							  
var nextPage= $('.nav_btn_next').attr("rel").split("&");// response.split("&");
$("#loaderActionGallery").css({
							  display: 'block'
							  });
$.post("_fetchLibrary/fetchImageGallery.php",
  { galleryCatId: 'cat_' + nextPage[1], resultPage: nextPage[0]},
  function(response){
  updateGallery(response); 
  });
});

$("#prevPage").click(function(){							  
var prevPage= $('.nav_btn_back').attr("rel").split("&");// response.split("&");
$("#loaderActionGallery").css({
							  display: 'block'
							  });
$.post("_fetchLibrary/fetchImageGallery.php",
  { galleryCatId: 'cat_' + prevPage[1], resultPage: prevPage[0]},
  function(response){
  updateGallery(response);
  });
});

};

/* --------------------------------------------------
END::----------------------------------------------
APPLY THE AJAX PAGGING TO GALLERY THUMBNAILS
NEXT AND PREVIOUS PAGES
-----------------------------------------------------*/





/* --------------------------------------------------
START::----------------------------------------------
FETCH THE GALLERY THUMBNAILS ACCORDING TO MENU SELECTION ->
/IMAGES/ CATEGORY
-----------------------------------------------------*/

function fetchSourceNew(catImg){
contentClose();	
//console.log(catImg);
$.post("_fetchLibrary/fetchImageGalleryNew.php",
  { galleryCatId: catImg},
  
  function(response){ 
	var content = response.split("@");
	//console.log(response);
	
	$("#productContent, #productTitle,#galleryHolder, #contentTitle").html("");	
	
	hideFullHolder();
	
	//$('#productContent').jScrollPaneRemove();

	$("#contentTitle").fadeOut();
	
	
	$(".imageGalleryContainer").fadeOut(function(){
		
		$(".imageGalleryContainer").html(content[0]);
		
		$('#myCarousel').jcarousel({});
		
		applyNav();
		navBtnState("show");
		iniNavBtns();
		$(".imageGalleryContainer").fadeIn();
		
		//return false;
		//$("#contentTitle").fadeIn();
		loadImageController();	
		
		//$("#contentOuterHolder").hide();
		resize();
		resizeDataHolder(0);
	
	
	}).fadeIn();
	
	
	$("#loaderActionGallery").fadeOut();
	
	
  });

	
}

//function fetchSource(catImg){
////fetch Gallery Images
//$.post("_fetchLibrary/fetchImageGallery.php",
//  { galleryCatId: catImg},
//  function(response){ 
//	var content = response.split("@");
//	//console.log(response);
//	$("#productContent, #productTitle,#galleryHolder, #contentTitle").html("");	
//	hideFullHolder();
//	//$('#productContent').jScrollPaneRemove();
//
//	$("#contentTitle").fadeOut();
//	$("#galleryHolder").fadeOut(function(){
//	
//		$("#galleryHolder").html(content[0]);
//		//$("#contentTitle").html("<img src='_imageGallery/image_upload/"+ content[1] +"' />");
//
//		applyNav();
//		navBtnState("show");
//		iniNavBtns();
//		$("#galleryHolder").fadeIn();
//		$("#contentTitle").fadeIn();
//		loadImageController();	
//		
//		//$("#contentOuterHolder").hide();
//		resize();
//		resizeDataHolder(0);
//	
//	
//	}).fadeIn();
//	
//	
//	$("#loaderActionGallery").fadeOut();
//	
//	
//  }
//);
//
//};//end:: function


function fetchGalleryImg(){
	
	
	
$(".galleryCat").click(function(){

hideFullHolder();
contentClose();
showGallery2();
$("#loaderActionGallery").css({
							  display: 'block'
							  });

fetchSourceNew(this.id);

//$.post("_fetchLibrary/fetchImageGalleryNew.php",
//  { galleryCatId: this.id},
//  function(response){ 
//  //console.log(response);
//	var content = response.split("@");
//	//console.log(content[0]);
//	$("#productContent, #productTitle").html("");	
//
//	//$('#productContent').jScrollPaneRemove();
//
//	$("#contentTitle").fadeOut();
//	
//	// Here is the problem ----->
//	
//	$(".jcarousel-skin-tango").fadeOut(function(){
//		
//		$(this).remove();
//		
//		
//		$(".imageGalleryContainer").html(content[0]);
//		
//		$('#myCarousel').jcarousel({});
//		
//		applyNav();
//		navBtnState("show");
//		iniNavBtns();
//		$(".imageGalleryContainer").fadeIn();
//		
//		//return false;
//		//$("#contentTitle").fadeIn();
//		loadImageController();	
//		
//		//$("#contentOuterHolder").hide();
//		resize();
//		resizeDataHolder(0);
//	
//		
//		
//	});
//	
//	
//	
//	
////	$("#galleryHolder").fadeOut(function(){
////
////
////	
////	$("#galleryHolder").html(content[0]);
////	
////	applyNav();
////	navBtnState("show");
////	iniNavBtns();
////	
////	$("#galleryHolder").fadeIn();
////	loadImageController();	
////	resize();
////	resizeDataHolder(0);
////	closeBtn("show");
////	});
//	
//	
//	$("#loaderActionGallery").fadeOut();
//	
//	
//  }); 			
});	
};//end:: function

/* --------------------------------------------------
END::----------------------------------------------
FETCH THE GALLERY THUMBNAILS ACCORDING TO MENU SELECTION ->
/IMAGES/ CATEGORY
-----------------------------------------------------*/

function resize(){

		var height = $(window).height();
		var width = $(window).width();


		if (height > 600){

			$(".wrapperImage").attr({
//				height : $(window).height() - 100  <-- Bofere ADD wedpro Link
				height : $(window).height() - 170
			});
		
		}
		
		var imageWidth = 	$(".wrapperImage").width();
		var imageHeight= 	$(".wrapperImage").height();		
		
		$("#slideHolder").css({ 
								"height" : imageHeight - 5,
								"width"  : imageWidth
							 });


	
		
	
		//slideLoaderInner Height and Width
		var loaderInnerWidth = $(".wrapperImage").width();
		var loaderInnerHeight = $(".wrapperImage").height();
		$("#navigationHolder").css({ 
								"width"  : loaderInnerWidth,
								"height"  : loaderInnerHeight - 5
							 });
		resizeLoader();
		//alert(loaderInnerWidth);	
};


function resizeDataHolder(enable){
		var height = $(window).height();
		var width = $(window).width();	
		//resize Gallery Holder
		if (height < 850  ){

		$(".wrapperImage").attr({
//		height : $(window).height() - 100 <-- Before Add WedPro Link
		height : $(window).height() - 170
		});


		globalResize = 380;

		$(".wrapperImage").attr({
//		height : $(window).height() - 100 <-- Before Add WedPro Link
		height : $(window).height() - 170
		});
		
		$("#contentOuterHolder").css({
								height: height - 150,
								width:380
		});			
		
		$("#contentInnerHolder").css({
								 height: height - 150
			
		});
		
		$("#galleryHolder").css({
				
								margin: "0px 10px 0px 0px",
								height:440,
								width: 380,
								position: "absolute",
								bottom: 5,
								left: 11
		});
		

		$("#galleryHolder ul").css({
				
								margin: "0px 0px 0px 0px",
								padding: "0px 0px 0px 5px"
								
								});




		$("#galleryHolder li").css({
				
								margin: "2px 5px 3px 0px",
								height:100,
								width: 100,
								overflow:"hidden",
								float:"left",
								background: "#000 url(_images/_core/bgImgLoader.gif) 50% 50% no-repeat"
								});
		
		
		$(".thumbImg").css({
							
								height:100,
								width: 100
							
							});
		
		$("#loaderActionGallery").css({
								
								left: 70,
								bottom: 250
								
		});	
		

		$("#productContent").css({
							width:340,
							height:400,
							padding: "0px 0px 0px 5px"
				
				});	

//		$(".jScrollPaneContainer").css({
//							width:350,
//							height:400,
//							padding: "0px 0px 0px 5px"
//				
//				});
		
		$("#fullHolderData").css({width:340,padding: "0px 0px 0px 25px"});
		$("#contentTitle").css({
							bottom:445,
							left: 30
				
				});	
		
		$("#productTitle").css({
							padding: "0px 0px 15px 5px"
				
		});	
	
	
	
		$("#contentContainer").css({
								height:450,
//								width: 340,
								position: "absolute",
								bottom: 5,								
								padding: "0px 0px 0px 0px"
		});	


		
		var content = $("#productContent").html();
		if (content != ""){
		//$('#productContent').jScrollPane({scrollbarMargin: 0});	
		}	
		

		$("#navHolder").css ({
							 
							 width: 300,
							 bottom: 5,
							 left: "10px"
							 
							 });

		
		
		}else{
			

		globalResize = 380;

		$(".wrapperImage").attr({
//		height : $(window).height() - 100 <-- Before Add WedPro Link
		height : $(window).height() - 170
		});
		
		$("#contentOuterHolder").css({
								height: height - 150,
								width:380
		});			
		
		$("#contentInnerHolder").css({
								 height: height - 150
			
		});
		
		$("#galleryHolder").css({
				
								margin: "0px 10px 0px 0px",
								height:440,
								width: 380,
								position: "absolute",
								bottom: 5,
								left: 11
		});
		

		$("#galleryHolder ul").css({
				
								margin: "0px 0px 0px 0px",
								padding: "0px 0px 0px 5px"
								
								});




		$("#galleryHolder li").css({
				
								margin: "2px 5px 3px 0px",
								height:100,
								width: 100,
								overflow:"hidden",
								float:"left",
								background: "#000 url(_images/_core/bgImgLoader.gif) 50% 50% no-repeat"
								});
		
		
		$(".thumbImg").css({
							
								height:100,
								width: 100
							
							});
		
		$("#loaderActionGallery").css({
								
								left: 70,
								bottom: 250
								
		});	
		

		$("#productContent").css({
							width:340,
							height:400,
							padding: "0px 0px 0px 5px"
				
				});	

//		$(".jScrollPaneContainer").css({
//							width:350,
//							height:400,
//							padding: "0px 0px 0px 5px"
//				
//				});
		
		$("#fullHolderData").css({width:340,padding: "0px 0px 0px 25px"});
		$("#contentTitle").css({
							bottom:445,
							left: 30
				
				});	
		
		$("#productTitle").css({
							padding: "0px 0px 15px 5px"
				
		});	
	
	
	
		$("#contentContainer").css({
								height:450,
//								width: 340,
								position: "absolute",
								bottom: 5,								
								padding: "0px 0px 0px 0px"
		});	


		
		var content = $("#productContent").html();
		if (content != ""){
		//$('#productContent').jScrollPane({scrollbarMargin: 0});	
		}	
		

		$("#navHolder").css ({
							 
							 width: 300,
							 bottom: 5,
							 left: "10px"
							 
							 });
		}
		
};



/* end:: Function Resize Content */


/* --------------------------------------------------
START::----------------------------------------------
FUNCTION TO BIND THE EVENTS FOR NEXT AND PREVIOUS
NAVIGATION BUTTONS

FUNCTION TO HIDE NAVIGATION BUTTONS WHEN OTHER SECTIONS 
SELECTED I.E. PRODUCTS / CONTACT / CUSTOMERS ETC.

FUNCTION TO INITIALIZE THE NAVIGATION BUTTON
//FIND THE FIRST ELEMENT OF THUMBNAILS AND SET THE NAV
-----------------------------------------------------*/

function setNavBtns(imageSrc){
var next = $("[id='" + imageSrc + "']").parent().next().children("a").attr("id");
var prev = $("[id='" + imageSrc + "']").parent().prev().children("a").attr("id");


$("#nextPhoto, #previousPhoto").unbind("click");


	if (next != undefined){
		// Set Event for Next Image Button
		$("#nextPhoto").show();
		$("#nextPhoto").one("click",function(){
			contentClose();
			loadImage(next);
		});	
		
	}else{
		//check if next page exist
		
			if ( $(".nav_btn_next").length > 0 ){
			
				$("#nextPhoto").show();
				
					$("#nextPhoto").one("click",function(){
						//contentOpen();
						//nextPage();
					});
				
				//alert("There is another Page to Fetch");				
							
			}else{

				$("#nextPhoto").hide();		
			
			}
		
		//contentOpen();
		
	
	}


	if (prev != undefined){
		// Set Event for Previous Image Button
		$("#previousPhoto").show();
		$("#previousPhoto").one("click",function(){
			contentClose();									 
			loadImage(prev);
		});
		
	}else{
			
			if ( $(".nav_btn_back").length > 0 ){
				//alert ("found prev page");
			
				$("#previousPhoto").show();
				
					$("#previousPhoto").one("click",function(){
						contentOpen();
						prevPage();
					});
				
				//alert("There is another Page to Fetch");				
							
			}else{

				$("#previousPhoto").hide();		
			
			}
	}

};

function navBtnState(method){

	if (method == "hide"){
	
		$("#nextPhoto").hide();
		$("#previousPhoto").hide();	
	
	}else if (method == "show"){
	
		$("#nextPhoto").show();	
		$("#previousPhoto").show();		
	}

};

function iniNavBtns(){
	
	var firstImg = $("#myCarousel li a:first").attr("id");
	loadImage(firstImg);
	
//imgLoad(firstImg[0], function(img){
//j(img).fadeIn();
//});
	
	
	//imgLoad(firstImg,showImage);
};
/* --------------------------------------------------
END::----------------------------------------------
FUNCTION TO BIND THE EVENTS FOR NEXT AND PREVIOUS
NAVIGATION BUTTONS
-----------------------------------------------------*/


function loadImageController(imgSrc){

$(".galleryImgHolder").unbind("click");

$(".galleryImgHolder").click(function(){

var imgId = this.id;
var next = $("[id='" + imgId + "']").parent().next().children("a").attr("id");
var prev = $("[id='" + imgId + "']").parent().prev().children("a").attr("id");


//unbind Click Events From Next / Prev Buttons
$("#nextPhoto, #previousPhoto").unbind("click");
	
	// Set Event for Next Image Button
	$("#nextPhoto").one("click",function(){
		loadImage(next);
	});

	// Set Event for Previous Image Button
	$("#previousPhoto").one("click",function(){
		loadImage(prev);
	});

contentClose();
//imgLoad(imgId,showImage);
loadImage(imgId);


});

};

/* end:: Function To Load Image */


function hideAll(){	
//	$(".showService").each(function(){
//  		$(this).fadeOut("slow");
//		
////		$('.notice').fadeIn().idle(2000).fadeOut('slow');
//
//	});
//
//	$(".galleryCat").each(function(){
//	  $(this).fadeOut("slow");
//	});
	
	
};


function menuSelectedActions(){
//	// Hide All Other Sub Menus
//	
//	//Remove Class selected From All MainItems and Add Class Selected to Current Item
//	$("#contentMainMenu a.mainItem").click(function(){
//
//		$("#contentMainMenu a.mainItem").each(function(){
//			$(this).removeClass("selected").addClass("noSelected");
//			//console.log($(this).attr("class"));
//		});		
//
//		$("#contentMainMenu ul.subMenu").each(function(){
//			$(this).fadeOut().removeClass("visible").addClass("hidden");
//			//console.log($(this).attr("class"));
//		});	
//
//	
//	$(this).removeClass("noSelected").addClass("selected");	
////$(this+".subMenu:first").fadeIn();
//	 $(this).next('ul.subMenu').fadeIn();
//	 //console.log($(this).attr("id"));
////<ul id="galleryCatHolder" class='hidden subMenu'>
//	});
}


function removeSelectedAll(){
//	$("#contentMainMenu a").each(function(){
//		$(this).removeClass("selected").addClass("noSelected");
//		//console.log($(this).attr("class"));
//	});
}

function showInfo(){
	
//	
//	$("#info").click(function(){
//	  removeSelectedAll();
//	  $(this).removeClass("noSelected").addClass("selected");
//	 // $("#infoContent").fadeIn();	
//	});
	
}


function hideAllMenu(){
	
	
//	$(".infoContent").each(function(){
//  		$(this).fadeOut("slow");
//	});
//	
//	$(".galleryCat").each(function(){
//	  $(this).fadeOut("slow");
//	});	

}

function showGallery(flag){

//$("#galleryCatHolder li a").click(function(){
//	
//	$("#galleryCatHolder li a").each(function(){
//	  $(this).addClass("noSelected");
//	});	
//
//	$(this).addClass("selected").removeClass("noSelected");

//});
	




//$("#gallery").click(function(){
//	hideAllMenu();
//	$(this).addClass("selected");
//	
//	$(".showService").each(function(){
//  		$(this).fadeOut("slow");
//	});
//
//	$(".galleryCat").each(function(){
//	  $(this).fadeIn("slow");
//	});
//
//
//});

}; //end:: function showGallery


function showServices(flag){

//$("#services").click(function(){
//// hide gallery cats
//
//	$(".galleryCat").each(function(){
//	  $(this).fadeOut("slow");
//	});
//	  
//	  
//	 $(".showService").each(function(){
//	  $(this).fadeIn("slow");
//	  });
//  
//});

}; //end:: function ShowServices




function contentOpen(){

	$("#contentOuterHolder").animate({ 
        width: globalResize, // var depends on screen size -- result from resize() functions
        opacity: 20
      }, 500 );

	  //$("#contentControllerBtn").css({"background-image" : "url(_images/_core/closeBtn.png)"});
		
	  $("#contentContainer, #contentTitle").fadeIn();		


var $holder = $('#contentOuterHolder');
if ($.browser.msie){
    $holder[0].style.removeAttribute('filter');
}

	  $("#contentOuterHolder").css({"background-image" : "url(_images/_core/titleBg.png)"});
	

	  $("#contentControllerBtn").unbind("click").click(function(){
	  contentClose();
	  });
};// end:: content open






function contentClose(){

//	  $("#contentControllerBtn").css({
//	  	"background-image" : "url(_images/_core/openBtn.png)"
//	  	});

var $holder = $('#contentOuterHolder');
if ($.browser.msie){
	$("#contentOuterHolder").css({"background-image" : "url(_images/_core/titleBg.png)"});
};

 $("#contentContainer, #contentTitle").hide("fast",function(){
														
	$("#contentOuterHolder").animate({ 
        width: "30px",
        opacity: 20
      }, 500 );	
	
	$("#contentOuterHolder").css({"background-image" : "url(_images/_core/titleBg.png)"});
														
 });

//	  $("#contentControllerBtn").unbind("click").click(function(){
//	  contentOpen();
//	  });
	  
}; // end:: content Close



function vimeoVideoActions(){
//hide all other contents

$("#papigo2009, #santorini2010, #boudoir").click(function(){
$("#fullHolderData").html("");	
$("#galleryHolder, #contentTitle").html("");
$("#productTitle").html("");
$("#productContent").html("");
contentClose();
closeBtn("hide");

resizeLoader();
navBtnState("hide");
// show Loaders
$("#slideLoaderInner,#loaderAction").css({"display" : "block"});

// $("#loaderActionGallery").css({display: 'block'});

$.post("_fetchContent/_wedProVideos/"+ $(this).attr("id") +".php",
  {videoHeight: $("#navigationHolderInner").height()},
  function(videoData){

	$(".wrapperImage").hide();
	$("embed").remove();
	$("#slideHolder").append(videoData);
	
	return false;
	$("#productTitle").fadeOut();
	$("#contentTitle").fadeOut();
	$("#productContent").fadeOut();
	
	$("#galleryHolder").fadeOut(function(){
																					 
	//$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});																				 		

		$("#fullHolderData").html(videoData);
			showFullHolder();
			//loadSingleImage("identity");
			$("#loaderActionGallery").css({display: 'none'});			
		
	
	}); //end:: FadeOut		  
		  

});// end:: post 	
	
});


//hideFullHolder();
//contentOpen();
//$("#loaderActionGallery").fadeIn();
//$.post("_fetchContent/_products/print.php",
//  { prId: productId },
//  function(prContent){
//  $("#galleryHolder, #contentTitle").html("");
//  //load the product Image
//  
//  
//  // SET NEW IMAGE
//  newLabel = new Image();  
//
//  
//
//
//  if($.browser.msie){
//      labelLoader = '_images/_prtoductLabels/'+ productId + lang +'.png?'+ (new Date()).getTime() +'';
//  }else{
//      labelLoader = '_images/_prtoductLabels/'+ productId + lang +'.png';
//  }
//// assign Image Path to Img Dom Object
//newLabel.src = labelLoader;
//
//// bind the load event to Img Object
//$(newLabel).bind('load', function() {
//
//$("#galleryHolder").fadeOut("fast",function(){
//								
//var	productTitle = '<img src="_images/_prtoductLabels/'+ productId + lang +'.png?'+ (new Date()).getTime() +'" alt=""/>';		
// 		 
//		$("#productTitle").html(productTitle);
//		$("#productContent").html(prContent);
//		$('#productContent').jScrollPane({scrollbarMargin: 0,scrollbarOnLeft : false});
//		closeBtn("hide");
//		$("#loaderActionGallery").fadeOut(function(){
//										  loadSingleImage(productId);
//										  });
//	});
//
//$("#productContent").fadeIn();
//$("#productTitle").fadeIn();
//	
//
//}); //End Label Loader
//
//  }); 

	











// load Video

	
}

function hideGallery(){

	$("#imgGalleryHolder").animate({ 
        opacity: 0.22,
		width: "0px",
		height: "0px"
      }, 600,function(){
		$("#imgGalleryHolder").hide();
	});	
	
//$('#imgGalleryHolder').animate({
//    opacity: 0.25,
//    right: '-50',
//    height: 'toggle'
//  }, 700, function() {
//    // Animation complete.
//  });
}

function showGallery2(){
	$("#imgGalleryHolder").show();
	$("#imgGalleryHolder").animate({ 
        opacity: 1,
		width: "599px",
		height: "100px"
      }, 600,function(){
		$("#imgGalleryHolder").show();
	});
}

$(document).ready(function() {	

linksExternal();

$('#myCarousel').jcarousel({});

//return false;


vimeoVideoActions();
  

//<ul class='wedProContent hidden subMenu'>

$("#contentMainMenu li ul.subMenu a").click(function(){
	//console.log("");
	
//	$(this:first-child('ul').fadeOut();
	
	//$('li.item-a').closest('ul').css('background-color', 'red');	
	var closes = $(this).parents('ul:first');
	//console.log("closed:"+closes);
	
	closes.find("li a").removeClass("selected").addClass("noSelected");
	closes.find("ul.subMenu").fadeOut();
	
	
//	closes.each(function(){
//		console.log(this);	
//	});
	
//	$(this).closest('ul').each(function(){
//		
//		$(this).removeClass("selected").addClass("noSelected");
//			
//	})
	
	//css('background-color', 'red');	
	$(this).next('ul.subMenu').fadeIn();
	$(this).removeClass("noSelected").addClass("selected");
});  


$("#contentMainMenu li a.mainItem").click(function(){
	//console.log("");

	//Hide All other subMenus
	$("#contentMainMenu li ul.subMenu li a").each(function(){
		//$(this).fadeOut();
		$(this).removeClass("selected").addClass("noSelected");
		//$(this).fadeIn();
	});

	$("#contentMainMenu li ul.subMenu").each(function(){
		$(this).fadeOut();
		//$(this).removeClass("selected").addClass("noSelected");
		//$(this).fadeIn();
	});
	
	$(this).next('ul.subMenu').fadeIn();
	
	$("#contentMainMenu li a.mainItem").each(function(){
		$(this).removeClass("selected").addClass("noSelected");		
	});
	$(this).removeClass("noSelected").addClass("selected");
	

	
});  

  //return false;
var $holder = $('#contentMenuHolder');
if ($.browser.msie){
    $holder[0].style.removeAttribute('filter');
}  

//Global Menu Class Manipulation
menuSelectedActions();
						   
resize();
resizeDataHolder();




loadImageController();
fetchGalleryImg();

bindProductLoaders();
bindContactLoader();
bindIdentityLoader();
bindIdentityVideo();
bindLoginLoader();
bindDestinationLoader();
bindwedProTeamLoader();


// bind click event for non subcategories links
$(".hideall").click(function(){
hideAll();
});




//Bind MainMenu Actions
showServices();
showGallery();
showInfo();
// ShowInfo
// Show Gallery
//







$("#contentControllerBtn").click(function () {
	$("#contentOuterHolder").animate({ 
        width: "30px",
        opacity: 20
      }, 500 );

//	  $("#contentControllerBtn").css({
//	  	"background-image" : "url(_images/_core/openBtn.png)"
//	  	});
		
	  $("#contentControllerBtn").unbind("click");
	  $("#contentControllerBtn").click(function(){
	  contentOpen();
	  });
}); 
	
		$(window).resize(function() {
		resize();
		resizeDataHolder(0);
		});



		 
});
