//global jquery functions

$(document).ready(function() {
	
	//Tabs
	if ($("#tablist")) {
	 	//init tabs
		$("#tablist").tabs();
		
		//preselect a tab via ?tabselect=x
		if(gup("tabselect")){
			var $tabs = $('#tablist').tabs(); // first tab selected
			$tabs.tabs('select', gup("tabselect")); // switch to third tab
		}
		
		
	}
	
		
	//Reccode von URL Parameter / Cookie an Order URL anhaengen
	$(".orderlink").each(function(event){
		if((Get_Cookie("reccode2")!=null) && (Get_Cookie("reccode2")!="")){
			var recccodeVar = "&reccode="+Get_Cookie("reccode2");
			var newHREF = $( this ).attr('href') + recccodeVar;
	    	$(this).attr('href', newHREF);
		}	
		if((Get_Cookie("zanpid2")!=null) && (Get_Cookie("zanpid2")!="")){
			var zanpidVar = "&zanpid="+Get_Cookie("zanpid2");
			var newHREF = $( this ).attr('href') + zanpidVar;
			$(this).attr('href', newHREF);
		}
	});		

	
	
	//Tooltip
	$("a[title].tooltiplink").tooltip({ tipClass: 'tooltip_container_s' }).dynamic(); 
	$("img[title].tooltiplink").tooltip({ tipClass: 'tooltip_container_s' }).dynamic(); 
	$(".tooltiplinkbig").tooltip().dynamic(); 
	
	$("a.nolinkaction").click(function(event){
		event.preventDefault();
	});
	

	//Accordion select
	if (gup("slide")) {
		var a = gup("slide");
		var b = a.split(",");

		for (var i=0, j=b.length; i<j; ++i ) {
			//slide(gup("slide"));
			slide(b[i]);
		}
	}


});
