function fbs_click() {
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;
}

$(document).ready(function(){
	//Hack for superfish menu when menu stays open on browser back button
	$(window).unload(function(){
		$('ul.sf-menu li.current').hideSuperfishUl();
	});

	/*
	$('a.video').each(function() {
		var orginalhref = $(this).attr('href');
		var newhref = orginalhref.replace('watch?v=', 'v/')
		//alert(newhref);
		$(this).attr('href', newhref);
		$(this).attr('rel', 'shadowbox;height=400;width=600');
	});
	*/

	//$('a.video').attr('rel', 'shadowbox;height=400;width=600');
	//$('a.video').attr('href', 'http://www.youtube.com/v/0nbLiSebPas');

    $("#marker").fadeTo(250, .4);
	$("#marker").hover(function(){
            $(this).fadeTo(250, 1.0); // This should set the opacity to 100% on hover
        },function(){
            $(this).fadeTo(250, .4); // This should set the opacity back to 50% on mouseout
            
    });

    $("#facebook").fadeTo(250, .4);
	$("#facebook").hover(function(){
            $(this).fadeTo(250, 1.0); // This should set the opacity to 100% on hover
        },function(){
            $(this).fadeTo(250, .4); // This should set the opacity back to 50% on mouseout
            
    });

    $("#icelandic").fadeTo(250, .4);
	$("#icelandic").hover(function(){
            $(this).fadeTo(250, 1.0); // This should set the opacity to 100% on hover
        },function(){
            $(this).fadeTo(250, .4); // This should set the opacity back to 50% on mouseout
            
    });

    $("#uk").fadeTo(250, .4);
	$("#uk").hover(function(){
            $(this).fadeTo(250, 1.0); // This should set the opacity to 100% on hover
        },function(){
            $(this).fadeTo(250, .4); // This should set the opacity back to 50% on mouseout
            
    });

    $("#search_btn").fadeTo(250, .4);
	$("#search_btn").hover(function(){
            $(this).fadeTo(250, 1.0); // This should set the opacity to 100% on hover
        },function(){
            $(this).fadeTo(250, .4); // This should set the opacity back to 50% on mouseout
            
    });

	$('a.video').livequery(function(){     
		var orginalhref = $(this).attr('href');
		var newhref = orginalhref.replace('watch?v=', 'v/')
		//alert(newhref);
		$(this).attr('href', newhref);
		$(this).attr('rel', 'shadowbox;height=400;width=600');	
	});

	$('a.video').live('click',function(event){
	   Shadowbox.open(this);
	   //Stops loading link
	   event.preventDefault();
	});

	var highestCol = Math.max($('#left').height(),$('#right').height());
	$('.elements').height(highestCol);


	/* Even height functions
	$.fn.setAllToMaxHeight = function(){
		return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
	}
	 usage: $(‘div.unevenheights’).setAllToMaxHeight()
	 */

$("#navbar li.menu").hoverIntent(expandMenu, resetMenu); 

// expand the height of the menu 
function expandMenu(){ 
    $(this).find('ul').show(); 
} 

// reset the height of the menu 
function resetMenu() { 
    $(this).find('ul').hide(); 
} 





			
	//$('a.tTip').tinyTips('light', 'title');
	//$('a.imgTip').tinyTips('light', '<div align=center><img src="admin/images/websmith_cms_small.png" /><br />www.WebSmith.is</div>');
	//$('img.tTip').tinyTips('green', 'title');
	//$('span.tagline').tinyTips('light', '<div align=center>Vefsmíði: Styx ehf.</div>');


	//$('#slider').data('nivoslider').stop(); //Stop the Slider
	//$('#slider').data('nivoslider').start(); //Start the Slider



$('#slider').nivoSlider({
        effect:'random', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:800, // Slide transition speed
        pauseTime:6000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.3, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded

		// Effects sets
		/*
		•sliceDown
		•sliceDownLeft
		•sliceUp
		•sliceUpLeft
		•sliceUpDown
		•sliceUpDownLeft
		•fold
		•fade
		•random
		•slideInRight
		•slideInLeft
		•boxRandom
		•boxRain
		•boxRainReverse
		•boxRainGrow
		•boxRainGrowReverse
		*/

	});

	if ( $("#slider").length ) { // ef slider div er til staðar
	  //$('#slider').data('nivoslider').stop(); // stoppa myndaslider við pageload
	}


});

