// <!-- This makes sure that the page is displayed in the top frame. Begin
if (window != top) top.location.href = location.href;
// End -->


//Is used so that the search fields can be placed anywhere on the page.
function post_to_url_global(theAction) { 
	var form = document.createElement('form'); 
	form.action = theAction; 
	form.method = 'POST'; 

	var input = document.createElement('input'); 
	input.type = 'hidden'; 
	input.name = 'search'; 
	input.value = document.getElementById('txtSearch').value; 

	form.appendChild(input); 
	document.body.appendChild(form); 
	form.submit(); 
} 
		
$(document).ready(function() {


	//This is so that a search should be made when pressing enter in the search field.
	$("#txtSearch").keyup(function(event){ 
	  if(event.keyCode == 13){ 
		//$("#id_of_button").click(); 
		post_to_url();
	  } 
	}); 

$('#promoteProductSlide').cycle({ 
    fx:     'scrollLeft'

});


	$(".carouselMain").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		visible: 1,
		auto: 6500,	//org:2500
		speed: 750,	//org:500	
		pauseOnHover: true 
	});
});
		
		
//This function runs at each page render, also after ajax postback.
function pageLoad()
{
	/* This is basic - uses default settings */
	$("a.group").fancybox({
	   'titlePosition' 	: 'inside',
	   'overlayOpacity'	: 0.7,
	   'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
	   return '' +  (currentIndex + 1) + ' / ' + currentArray.length + '';
			}
	});

			$("a.iframe").fancybox();

			
			//$(".SCproduct_cart_button_buy").simpletip({ persistent: true, content:'Varan lagd i kundvagnen!' });
			
	$(".SCtooltip_link").simpletip({fixed: false,offset:[30,-60],
		   onBeforeShow: function(){
		var description;
		var header;
		description=this.getParent().attr('name');
		header=this.getParent().attr('id');
		this.update("<div class='SCtooltipHeader'>"+header+"</div><div class='SCtooltipDescription'>"+description+"</div>");
   }});
}
		

