jQuery.noConflict();

	jQuery(document).ready(function(){
	
	var h1 = jQuery("#PT_Header1").html();
		if (h1)
		{
			h1 = h1.toLowerCase();
			if (h1.indexOf('<div') == -1)
			{
				jQuery("#PT_Header1").hide();
			}
			var h4 = jQuery("#PT_Header4").html();
			if (h4)
			{
				h4 = h4.toLowerCase();
				if (h4.indexOf('<div') == -1)
				{
					jQuery("#PT_Header4").hide();
				}			
			}
		}

jQuery(document).ready(function(){
	
	
		var href = window.location.href;
		var arg = "";
		if (href.indexOf("&Fotbredd") > -1)
		{
		
			var arrHref = new Array();
			
			arrHref = href.split("&");
			
			var Storlek = "";
			var Fotlangd = "";
			var Fotbredd= "";
			var Farg = "";
			var Varumarke = "";
			var Kategori = "";
			
			for (var i = 1; i < arrHref.length;i++)
			{
				
				var arrV = new Array();
				arrV = arrHref[i].split("=");
				
				if (arrV[0] == "Storlek")
				{
					Storlek = arrV[1];
				}
				if (arrV[0] == "Fotlangd")
				{
					Fotlangd = arrV[1];
				}
				if (arrV[0] == "Fotbredd")
				{
					Fotbredd = arrV[1];
				}
				if (arrV[0] == "Farg")
				{
					Farg = arrV[1];
				}
				if (arrV[0] == "Varumarke")
				{
					Varumarke = arrV[1];
				}				
				if (arrV[0] == "Kategori")
				{
					Kategori = arrV[1];
				}	
			}
			
			arg = "Storlek=" + Storlek + "&Fotlangd=" + Fotlangd + "&Fotbredd=" + Fotbredd + "&Farg=" + Farg + "&Varumarke=" + Varumarke + "&Kategori=" + Kategori + ""
			
		}
	
	
 		jQuery("a[rel*='lightbox']").fancybox({
			'overlayOpacity' : 0.6
		}); 
	
		jQuery(".film a").click(function() {
			jQuery.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
				'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
				}
			});

			return false;
		});	
		
		jQuery("#MatGuide a").each(function(){
		
			var href = jQuery(this).attr("href");
			if (href.indexOf("Ajax=J") == -1)
			{
				if (href.indexOf("?") == -1)
				{
					href = href + "?Ajax=J";
				}
				else
				{
					href = href + "&Ajax=J";
				}			
				jQuery(this).attr("href",href);
			}
			
		})
		
		jQuery("#MatGuide a").fancybox({
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none'			
		});	
		
		jQuery("#FBSearch").click(function (){
		
		if ((jQuery("#FBWidth").val() != '') && (jQuery("#FBHeigth").val() != ''))
		{
		
			if ((jQuery("#FBWidth").val() > 0) && (jQuery("#FBHeigth").val() > 0))
			{
				jQuery.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		: 420,
				'height'		: 370,
				'href'		: '/cgi-bin/ibutik/Fotbredd.pl?&FBWidth=' + jQuery("#FBWidth").val() + '&FBHeigth=' + jQuery("#FBHeigth").val(),
				'type'		: 'iframe'
				
				});
			}
		
		
		}
		
     
          return false;
			
		
		})
		
		jQuery("#Storlek").live("change",function(){
			if (jQuery(this).val() != '')
			{
				jQuery("#Fotlangd").attr("disabled","true");
				jQuery("#Fotlangd").css("background-color","#ccc");
				
			}
			else
			{
				jQuery("#Fotlangd").attr("disabled","");
				jQuery("#Fotlangd").css("background-color","#fff");
			}
		
		})
		
		jQuery("#Fotlangd").live("change",function(){
			if (jQuery(this).val() != '')
			{
				jQuery("#Storlek").attr("disabled","true");
		
			}
			else
			{
				jQuery("#Storlek").attr("disabled","");
			}
		
		})
		
		
	});

	});

