function showWin() {
  		openWin = window.open('http://identitycutcolour.mylocalsalon.com/OnlineBooking','booking','width=860,height=680,scrollbars=1,resizable=0,status=0,toolbar=0,location=0,directories=0,menubar=0,titlebar=0');
  	}

var resizeTimer = 0;  	
  	
// initilize the images
$(document).ready(function() {
	initImages();
}); 	
  	
$(window).load(function(){
	setTimeout(function(){
		$('#loading').animate({'opacity':0},1000,function(){
			startAnim();
		});
	},500);
});

$(window).resize(function(){
	clearTimeout(resizeTimer);
	resizeTimer = setTimeout(function(){doResize()},1000);
});

function doResize() {
	window.location.reload( true );
}

function startAnim() {
	var $obj = $('div .glideImage:last');
	var $obj = $('div .glideImage:last');
 	$obj.animate({'top' : '-100px'},3000,'linear',function() {
		animateImg();
	});
}

function initImages() {
	if (($("#imageHolder").innerHeight()) < 550) {
		$('#imageHolder').css({'height':'550px'});
	}
	var boxWidth = (($("#imageHolder").innerWidth())) + 300;
	var boxHeight = (($("#imageHolder").innerHeight())) + 300;
	if (boxHeight >= 1500) {
		boxHeight = 1500;
		$('#imageHolder').css({'height':'1200px'});
	} 
	$.each($('div .glideImage'), function() {
		$(this).html('<image src="image_view.php?i='+$(this).attr('id')+'&w=10000&h='+boxHeight+'" />');
	}); 
}

function animateImg() {
	var boxWidth = (($("#imageHolder").innerWidth())) + 300;
	var boxHeight = (($("#imageHolder").innerHeight())) + 300;
 	if (boxHeight > 1500) {
		boxHeight = 1500;
	} 
	if (boxHeight < 600) {
		boxHeight = 600;
	}
	var $obj = $('div .glideImage:last');
 	var $preObj = $obj.prev();
 	$obj.animate({'top' : '-200px'},3000,'linear',function() {
		$preObj.animate({'top' : '-100px'},3000,'linear',function() {}); 
		$obj.animate({'top' : '-300px', 'opacity' : '0'},3000,'linear',function() {
			$('#imageHolder').prepend($obj);
			$obj.css({'opacity' : '1', 'top' : '0px'});
			animateImg();	
		});
	});
}
