var Site ={
	init: function() {
		var weatherInfo = 'http://bac.beforelive.com/weather/get-weather.php?nocache='+Math.random();
		$.getScript(weatherInfo, function() {
			if(__data.status) {
				$('#temperature').html(__data.temperature);
				$('#humidity').html(__data.humidity);
				$('#local_time').html(__data.time);
			}
		});
	},
	loadPage:function(page){
		$('.loader').show();
		jQuery.get('includes/'+page+".html?s=2",{page:page}, function(data) {
			$('.loader').hide();
			jQuery("#wrap").fadeOut('slow', function() {
				jQuery(this).html(data).fadeIn('slow', function() {
					$('.inside-sub').jScrollPane({showArrows:true});
					$("a[rel^='prettyPhoto']").prettyPhoto({
						animationSpeed: 'normal', /* fast/slow/normal */
						padding: 40, /* padding for each side of the picture */
						opacity: 0.70, /* Value betwee 0 and 1 */
						showTitle: true, /* true/false */
						allowresize: true, /* true/false */
						counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
						theme: 'dark_square', /* light_rounded / dark_rounded / light_square / dark_square */
						callback: function(){}
					});
					jQuery(this).prepend('<a href="javascript:;" onclick="Site.goHome();" class="close"><img src="image/close_button.gif" alt="close" /></a>');
					imagePreview();
					//jQuery("#indicator").hide();
					//Lightview.updateViews()
				});
			});
		});	
	},
	goHome:function(){
		jQuery('#wrap').hide();
	},
	loadcareerform: function(msg, status){ 
		$('.loader').show();
		jQuery.get('includes/career.asp',{career: msg, status: status, page:'career'}, function(data) {
			/*$('.loader').hide();
			jQuery("#wrap").html(data);
			jQuery("#wrap").show();
			$('.inside-sub').jScrollPane({showArrows:true});*/
			$('.loader').hide();
			jQuery("#wrap").fadeOut('slow', function() {
				jQuery(this).html(data).fadeIn('slow', function() {
					$('.inside-sub').jScrollPane({showArrows:true});
					if (msg == 'success') {
						$('.jScrollPaneContainer').css({'height':'100px'});
					}
					$("a[rel^='prettyPhoto']").prettyPhoto({
						animationSpeed: 'normal', /* fast/slow/normal */
						padding: 40, /* padding for each side of the picture */
						opacity: 0.70, /* Value betwee 0 and 1 */
						showTitle: true, /* true/false */
						allowresize: true, /* true/false */
						counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
						theme: 'dark_square', /* light_rounded / dark_rounded / light_square / dark_square */
						callback: function(){}
					});
					jQuery(this).prepend('<a href="javascript:;" onclick="Site.goHome();" class="close"><img src="image/close_button.gif" alt="close" /></a>');
					imagePreview();
					//jQuery("#indicator").hide();
					//Lightview.updateViews()
				});
			});
		});
	}
}
$(function() {
	Site.init();
	var winH=$(window).height();
	$(".wrap-main").height(winH+"px");
});

$(function() {
	$('.links').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	});
	$('.inside-sub').jScrollPane({showArrows:true});
	$("a[rel^='prettyPhoto']").prettyPhoto({
				animationSpeed: 'normal', /* fast/slow/normal */
				padding: 40, /* padding for each side of the picture */
				opacity: 0.70, /* Value betwee 0 and 1 */
				showTitle: true, /* true/false */
				allowresize: true, /* true/false */
				counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
				theme: 'dark_square', /* light_rounded / dark_rounded / light_square / dark_square */
				callback: function(){}
			});
	imagePreview();		

});
this.imagePreview = function(){
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		//this.title = "";	
		//var c = (this.t != "") ? "<br/>" + this.t : "...";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' /><br />"+ this.t +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		//this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});		
	$("a.preview").click(function(){
		return false;
	});
};

