$(function()
{
	$().piroBox({
      my_speed: 300, //animation speed
      bg_alpha: 0.5, //background opacity
      slideShow : 'true', // true == slideshow on, false == slideshow off
      slideSpeed : 3, //slideshow
      close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox
      });

	var tabContainers = $('div.tabs > div');
	tabContainers.hide().filter(':first').show();
	
	$('div.tabs ul.tabNavigation a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('div.tabs ul.tabNavigation a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).filter(':first').click();
	
	$("#quickcontact input").labelify();
	$("#quickcontact textarea").labelify();
	
	var  put_size=function(result)
	{
		$("form[name=wizard] [name=size]").html(result);
	};
	
	$("form[name=wizard] [name=cat]").change(function()
	{
		id=this.value;
		
		$.get("/js/get_subcats.php", {parent_id: id},
		function(result)
		{
			$("form[name=wizard] [name=door]").html(result);
		});
		
		$.get("/js/get_sizes.php", {catid: id}, put_size);
	});
	
	$("form[name=wizard] [name=door]").change(function()
	{
		id=this.value;
		$.get("/js/get_sizes.php", {catid: id}, put_size);
	});
	
	$("#caphelp").click(function()
	{
		window.open("/captcha.php","Window1", "menubar=no,width=430,height=360,toolbar=no,scrollbars=yes");
	});
	
	$("#terms").click(function()
	{
		window.open("/terms.php","Window1", "menubar=no,width=430,height=360,toolbar=no,scrollbars=yes");
	});
});

function flashFixer(ffile,fwidth,fheight)
{
	var flash = "<embed src=\"/flash/"+ffile+"\" quality=\"high\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" menu=\"false\" width=\""+fwidth+"\" height=\""+fheight+"\"></embed>";
	document.write(flash);
}