


// function to generate random
function randomFromTo(from, to){
       return Math.floor(Math.random() * (to - from + 1) + from);
}


// to make links
function LinkTo(theURL) { //v2.0
window.location = ''+theURL+'';
}

$(window).load(function() {

	// fadehover class
	$(".fadehover").hover(function () {$(this).fadeTo("fast", 0.5);}, 
	function () {$(this).fadeTo("fast", 1);});		
	
	setTimeout('insp_items()', 200);
	
});


// place inspiration items in background
function insp_items() {
	
var i = 0;
$('body .insp_item').each(function (e) {		
	i++;
	var id = $(this).attr('id');							
	var el = $('#'+id);
	
	//margin left & right
	var ww = $(window).width()-el.width()
	var margin_right = Math.round((ww - 550) / 2 + 550);
	
	//split up left and right
	if(i<14){
	var w = randomFromTo(margin_right, ww);
	}
	else{
	var w = randomFromTo(0, Math.round((ww - 550) / 2));		
	}
			
	var h = Math.round(Math.random() * ($(window).height() - el.height() - 150 + 75))+130;
	el.css({ top:h, left:w});	
	el.fadeIn("slow");
	
	$('#'+id+' .insp_pic').mousedown(function(e) {
	$('#'+id+' .insp_info').fadeIn("slow");
	el.draggable();
	})
	
	$('#'+id+' .close_insp').mousedown(function(e) {
	$('#'+id+' .insp_info').fadeOut("fast");
	})

	
})};

