function pause(ms)
{
	var now = new Date();
	var exitTime = now.getTime() + ms;
	while (true)
	{
		now = new Date();
		if (now.getTime() > exitTime) return;
	}
} 

function add_sth_done(loc)
{
	pause(1000);
	$.prettyPhoto.close();
	if ( loc ) document.location = loc;
}

function chgimg(i, m, b, c, d)
{
	$("#"+i).attr('src', m);
	$("#"+b).attr('href', c);
	$("#"+b).attr('title', d);
}

function customOrderSubmit()
{
	$('#order_a').val('custom');
	$('#checkoutForm').submit();
}

$(document).ready(function(){

	$("ul.sf-menu").supersubs({ 
		minWidth:    10,   // minimum width of sub-menus in em units 
		maxWidth:    33,   // maximum width of sub-menus in em units 
		extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
	}).superfish({  // call supersubs first, then superfish, so that subs are 
		animation:   {opacity:'show',height:'show'},  	// fade-in and slide-down animation 
		delay:     500               					// second delay on mouseout 
	});

	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});

	$('.contactmessage').prettyComments({animate: true, maxHeight:500});	

		$('.slideshowbox').cycle({ 
			fx:      'fade',
			timeout:  4000,
			speed:    1200,
		    next:   '#nextSlide', 
		    prev:   '#prevSlide', 
			pause:  1 
		});		
		$('.slideshowUp').cycle({ 
			fx:      'scrollUp',
			timeout:  3000,
			speed:    800,
//			next:   '.leftNewsBar', 
//			easing: 'backinout', 
			pause:  1 
		});		



	if ( $('#paypalform').length > 0 ) {
		$('#paypalform').submit();
	}

});

