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 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 create_floating_msg(msg_data)
{
	if($('.floating_msg').length) {$('.floating_msg').remove();}
	$('<div class="floating_msg"></div>').appendTo("body");
	var obj = $('.floating_msg');
	if(msg_data.width) { obj.width(msg_data.width); }
	if(msg_data.height) { obj.height(msg_data.height); }
	center_on_window(obj);
	obj.html('<img src="/js/loading1.gif" width="16" height="16" vspace="50">');
	return obj;
}
function get_form_params(form)
{
	var form_params={};	
	$('input, textarea', form).each(function() {
			if($(this).attr('name'))
			{
				var value = $(this).attr('value');
				if($("input[name='"+$(this).attr('name')+"']", form).is(':radio')) 
				{ 
					value = $("input[name='"+$(this).attr('name')+"']:checked").val();
				}
				form_params[$(this).attr('name')] = value;
			}
		})
	form_params['rnd'] = Math.random();
	form_params['utf8'] = 1;		
	return form_params;
}

$(document).ready(function() {
	hs.outlineType = 'rounded-white';
	hs.showCredits = false;

  $('#select_fabric_page').change(function select_fabric_page() {
			if($(this).val()) {  window.location.href=$(this).val(); }
	});
	show_basket_info();
	$('.hide_parent_div').live("click", function hide_parent_div()
	{
		$(this).closest('div').hide();
	});		
	$('.show_big_pic').click(function show_big_pic()
	{
		var bigPath = $(this).attr("href");
		var bigAlt = $(this).attr("title");
		$("#nowshowing").attr({ src: bigPath, alt: bigAlt });
		return false;
	});		
	$('.show_big_pic_with_largehref').click(function show_big_pic_with_largehref()
	{
		var bigPath = $(this).attr("href");
		var bigAlt = $(this).attr("title");
		var largePath = $(this).attr("largehref");
		$("#nowshowing_a").attr('href', largePath);		
		$("#nowshowing").attr({ src: bigPath, alt: bigAlt });
		return false;
	});	
});
