// JavaScript Document


//  Menu Slider Control ------------

$(document).ready(function(){
 
   $(".content").hide(); //updated line, removing the #panel ID.
 
   $('#tab').toggle(function(){ //adding a toggle function to the #tab
   $('#tab').stop().animate({left:"0px", opacity:1},500);
      $('#panel').stop().animate({width:"100px", opacity:1}, 500, function() {//sliding the #panel to 400px
	  $('.content').fadeIn('slow'); //slides the content into view.
	  });  
   },
   function(){ //when the #tab is next cliked
   $('.content').fadeOut('slow', function() { //fade out the content 
   $('#tab').stop().animate({left:"-190px", opacity:1},500);
      $('#panel').stop().animate({width:"0", opacity:1}, 500); //slide the #panel back to a width of 0
	  });
   });
 
});

//----------------------------


	
// SMOKE ANIMATION ------------------------

/*

$(document).ready(function(){
	
	$('body').append('<div id="smoke1"></div><div id="smoke2"></div><div id="smoke3"></div>');
	
	setInterval("bloooming_smoke('smoke1','smoke2','smoke3')", 50);

 });   
 
 */
 

// Font Replacement & LightBox ------------

Cufon.replace('h1', {
	color: '-linear-gradient(#f1f1f1,#e5e5e5,#f1f1f1)',
	textShadow: '1px 1px #000'

});
Cufon.replace('h2', {
	textShadow: '1px 1px #000'

});

Cufon.replace('h6', {
	color: '-linear-gradient(#f1f1f1,#e5e5e5,#f1f1f1)',
	textShadow: '1px 1px #000'
});



$(document).ready(function() {
	$("a[rel^='gallery']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 30, /* padding for each side of the picture */
		opacity: 0.55, /* Value betwee 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		modal: false, /* If set to true, only the close button will close the window */
		changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
		callback: function(){} /* Called when prettyPhoto is closed */
	});					   
	/*$('#right .content').mousemove(function(e) {
		var _top = parseInt($('#right').offset().top) + 80;
		var _contentH = parseInt($('#right .content').height());
		var _H = $('#right').height() - 100;
		var _scH = _contentH - _H;
		var _ypos = e.pageY - _top;
		
		if(_scH > 0) {
			var _contentY = -(_scH / _H)*_ypos + 10;
			$('#right .content').animate({top: _contentY}, { queue:false, duration: 24000 });
		}
	});
	$(document).find('.content h3, .content p').fadeOut(0);
	$('.content li').hover(function() {
    		$(this).find('h3, p').stop(true, true).fadeIn(600);
    	}, function() {
    		$(this).find('h3, p').stop(true, true).fadeOut(600);
    	}
    );
	$('.content li').hover(function() {
			$(this).find('img').stop(true, true).fadeTo(600, 0.75);
		}, function() {
			$(this).find('img').stop(true, true).fadeTo(600, 1);
		}
	);
	$(document).find('.show').fadeIn(600);
	$('.content li').hover(function() {
    		$(this).find('.show').stop(true, true).fadeIn(600);
    	}
    );*/
});

//----------------------------




// Form Validation ------------

$(document).ready(function() {
	$("#contactform").validationEngine()
	//$.validationEngine.loadValidation("#date")
	//alert($("#formID").validationEngine({returnIsValid:true}))
	//$.validationEngine.buildPrompt("#date","This is an example","error")	 		 // Exterior prompt build example
	//$.validationEngine.closePrompt(".formError",true) 							// CLOSE ALL OPEN PROMPTS
});





// SCROLLER ------------
$(document).ready(function(){
	$('#scrollbar1').tinyscrollbar();	 // SCROLL
});


//  TOOLTIP  ---------------
$(document).ready(function() {

	//Select all anchor tag with rel set to tooltip
	$('a[rel=tooltip]').mouseover(function(e) {
		
		//Grab the title attribute's value and assign it to a variable
		var tip = $(this).attr('title');	
		
		//Remove the title attribute's to avoid the native tooltip from the browser
		$(this).attr('title','');
		
		//Append the tooltip template and its value
		$('body').append('<div id="tooltip"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>');		
				
		//Show the tooltip with faceIn effect
		$('#tooltip').fadeIn('500');
		$('#tooltip').fadeTo('10',0.9);
		
	}).mousemove(function(e) {
	
		//Keep changing the X and Y axis for the tooltip, thus, the tooltip move along with the mouse
		//$('#tooltip').css('top', e.pageY + 10 );
		//$('#tooltip').css('left', e.pageX + 20 );
		$('#tooltip').css('top', e.pageY - 25 );
		$('#tooltip').css('left', e.pageX - 230 );
		
	}).mouseout(function() {
	
		//Put back the title attribute's value
		$(this).attr('title',$('.tipBody').html());
	
		//Remove the appended tooltip template
		$('body').children('div#tooltip').remove();
		
	});

});



// ZOOM ----------------------
$(document).ready(function(){
	$('#zoom').etalage({
		thumb_image_width: 659,
		thumb_image_height: 908,
		source_image_width: 1931,
		source_image_height: 3000,
		zoom_area_height: 500,
		magnifier_invert: false,
		hide_cursor: true,
		speed: 400
	});
});

$(document).ready(function(){
	$('#zoomb').etalage({
		thumb_image_width: 659,
		thumb_image_height: 876,
		source_image_width: 1931,
		source_image_height: 3000,
		zoom_area_height: 500,
		magnifier_invert: false,
		hide_cursor: true,
		speed: 400
	});
});





(function($) {

	$.fn.easyTooltip = function(options){
	  
		// default configuration properties
		var defaults = {	
			xOffset: -300,		
			yOffset: 0,
			tooltipId: "easyTooltip",
			clickRemove: false,
			content: "",
			useElement: ""
		}; 
			
		var options = $.extend(defaults, options);  
		var content;
				
		this.each(function() {  				
			var title = $(this).attr("title");				
			$(this).hover(function(e){											 							   
				content = (options.content != "") ? options.content : title;
				content = (options.useElement != "") ? $("#" + options.useElement).html() : content;
				$(this).attr("title","");									  				
				if (content != "" && content != undefined){			
					$("body").append("<div id='"+ options.tooltipId +"'>"+ content +"</div>");		
					$("#" + options.tooltipId)
						.css("position","absolute")
						.css("top",(e.pageY - options.yOffset) + "px")
						.css("left",(e.pageX + options.xOffset) + "px")						
						.css("display","none")
						.fadeIn("fast")
				}
			},
			function(){	
				$("#" + options.tooltipId).remove();
				$(this).attr("title",title);
			});	
			$(this).mousemove(function(e){
				$("#" + options.tooltipId)
					.css("top",(e.pageY - options.yOffset) + "px")
					.css("left",(e.pageX + options.xOffset) + "px")					
			});	
			if(options.clickRemove){
				$(this).mousedown(function(e){
					$("#" + options.tooltipId).remove();
					$(this).attr("title",title);
				});				
			}
		});
	  
	};

})(jQuery);

