function ShowBigPic(ThisPic) {
  if (document.images) {
      document.getElementById('nowshowing').src = ThisPic;
  }
} 	
function get_paydiv(id) {
	if(id){	document.getElementById("paydiv").innerHTML=document.getElementById('paydiv'+id).innerHTML;}
}    
function center_on_window(obj)
{
	var w = obj.outerWidth();
	var h = obj.outerHeight()
	obj.css({
		position:'absolute',
		top: parseInt($(window).scrollTop() + ($(window).height() - h) / 2 - 100),
		left: parseInt($(window).scrollLeft() +($(window).width() - w) / 2)
	});
}
function getRandomInt(min, max)  
{  
  return Math.floor(Math.random() * (max - min + 1)) + min;  
} 

function show_basket_info()
{
	if($('.cart').length) 
	{
		$.post("/cgi-bin/dsp.pl", { cl: "order", event: "show_basket_info", rnd: Math.random(), utf8: 1 }, 
		function(data) {
			$('.cart').html(data);
		});	
	}
}
function show_rand_vote()
{
	vote_divs = jQuery.makeArray($("div.div_vote"));	
	if(vote_divs.length > 0) { 
		var rand_index = getRandomInt(0, vote_divs.length-1);
		$(vote_divs[rand_index]).show();
	} 
}
function show_random_pic()
{
	var ran = Math.floor(Math.random()*5)+1;
	ran.toString();
	document.getElementById("rotatepic").src="/images/pic"+ran+".png";
}

$(document).ready(function() {
	
	// Examples of how to assign the ColorBox event to elements
	$("a[rel='colorbox']").colorbox();

  $('#select_fabric_page').change(function() {
			if($(this).val()) {  window.location.href=$(this).val(); }
	});
	show_basket_info();
	show_rand_vote();
	show_random_pic();
	$('.hide_parent_div').live("click", function()
	{
		$(this).closest('div').hide();
	});	
});
