/*!
 * functions for boornceline.com
 * http://www.bornceline.com/
 */

/* hover bei img work.html */
 
$(function() {
	$('#contOne img').animate({"opacity": 1 });

	$('#contOne img').hover(function() {
	$(this).stop().animate({ "opacity": .8 });
	}, function() {
	$(this).stop().animate({ "opacity": 1 });
	});
	}); 
 

$(document).ready(function(){
	$('li.headlink').hover(
	function() { $('ul', this).css('display', 'block'); },
	function() { $('ul', this).css('display', 'none'); });
});


$(function(){
  //Get our elements for faster access and set overlay width
  var div = $('#sc_menu'),
               ul = $('ul.sc_menu'),
               // unordered list's left margin
               ulPadding = 15;

  //Get menu width
  var divWidth = div.width();

  //Remove scrollbars
  div.css({overflow: 'hidden'});

  //Find last image container
  var lastLi = ul.find('li:last-child');

  //When user move mouse over menu
  div.mousemove(function(e){

    //As images are loaded ul width increases,
    //so we recalculate it each time
    var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

    var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
    div.scrollLeft(left);
  });
});



/* ACCORDEON */

$(document).ready(function() {
	//Set default open/close settings
$('.acc_container').hide(); //Hide/close all containers
$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
$('.acc_trigger').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
		$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
});

});


/* MAGNIFIER */

	$(document).ready(function() {
	$('.zoomple').zoomple({
			offset : {x:10,y:10},
			zoomWidth : 245,
			zoomHeight : 245,
			delay : 1000,
			});
 }); 


/* FadeIn */

/*
$(function() {
	$("img").each(function() {
	$(this).hide().load(function(){
	$(this).fadeIn("fast");
	});
	});
	});
*/

$(document).ready(function(){			
	//Remove outline from links
	$("a").click(function(){
		$(this).blur();
	});
	
	//open all external links in new windows
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");
});

