
	$(document).ready(function() {

		 $("a[rel]").overlay({ 
			 
		        effect: 'apple', 
		 
		        onBeforeLoad: function() { 
		 
		            // grab wrapper element inside content 
		            var wrap = this.getContent().find(".contentWrap"); 
		 
		            // load the page specified in the trigger 
		            wrap.load(this.getTrigger().attr("href")); 
		        } 
		 
		  }); 
		 
		 
		$.listen( 'click', '.details-link', function(){
				$(".details_img").html("<a><img src=\""+ this +"\" alt=\"\" style=\"max-height: 320px; vertical-align: middle; \"  /></a>"); 
				$(".details-link").children('img').css("border","none");
				$(this).children('img').css("padding","5px");
				$(this).children('img').css("border","solid #ccc 1px");
				return false;
		});
		 
		
		$(".tabs-button").hover(
						function(){
							$(this).stop().fadeTo("fast", 0.9); // This should set the opacity to 100% on hover
						},
						function(){
							$(this).stop().fadeTo("slow", 0.6); // This should set the opacity back to 30% on mouseout
					});
		
		
		$(".contentWrap").ajaxSuccess(function(){
				Cufon.replace('.finishes-title');
				Cufon.now();
				 });
		
		
		if(tabs){ 
		
			$('.tabs-button').click(function(){
				
				if ($('.current').attr('id') == 'tab-button-1') {
					var ypos = '-57px'; 
					$('.menu_bottom').css('background-position',  '0 -27px');
				}else{
					var ypos = '0';					
				}
					
					$('.current').fadeTo("slow", 0.6);
					$('.current').hover(
					function(){
							$(this).stop().fadeTo("fast", 0.9); // This should set the opacity to 100% on hover
						},
					function(){
						$(this).stop().fadeTo("slow", 0.6);
					} // This should set the opacity back to 30% on mouseout
					);
					$('.current').parent().css('background-position', '0 '+ypos);
					$('.current').parent().parent().children('.left').css('background-position',  '0 '+ypos);
					$('.current').parent().parent().children('.left2').css('background-position', '0 '+ypos);
					$('.current').parent().parent().children('.right1_continous').css('background-position',  '0 '+ypos);
					$('.current').parent().parent().children('.right2').css('background-position',  '0 '+ypos);
					$('.current').parent().parent().children('.right2_continous').css('background-position',  '0 '+ypos);
								
				if ($(this).attr('id') == 'tab-button-1') {
					var ypos = '0'; 
					$('.menu_bottom').css('background-position',  '0 '+ypos);
				}else{
					var ypos = '-57px';					
				}
				$(this).hover(
					function(){
							$(this).stop().fadeTo(0, 0.9); // This should set the opacity to 100% on hover
						},
					function(){
						$(this).stop().fadeTo(0, 0.9);
					} // This should set the opacity back to 30% on mouseout
				);
				$(this).parent().css('background-position', '0 '+ypos);
				$(this).parent().parent().children('.left').css('background-position', '0 '+ypos);
				$(this).parent().parent().children('.left2').css('background-position', '0 '+ypos);
				$(this).parent().parent().children('.right1_continous').css('background-position', '0 '+ypos);
				$(this).parent().parent().children('.right2').css('background-position', '0 '+ypos);
				$(this).parent().parent().children('.right2_continous').css('background-position', '0 '+ypos);
			});
		
			$("ul#menu").tabs("div#content_left", {effect: 'ajax'});
			
			
						
			$("div#content_left").ajaxSuccess(function(){
				Cufon.replace('h1');
				Cufon.replace('h2');
				Cufon.replace('h3');
				Cufon.replace('span');
				Cufon.now();
				 });
			
			$.listen( 'click', '.pagelist-item', function(){
				$('div#content_left').load($(this).attr('href'));
				return false;
			});
			
		}
		if(menu){
		$("#acc1").accordion({
				alwaysOpen: false,
				autoheight: false,
				header: 'a.acc1',
				clearStyle: false,
				active: acc1
			});
		var i = 0;
		var accreal = -1;
		while(i<accMax+2){
			
			if(acc1 == i-2){
		
				accreal = acc2;
				
			}
			else accreal = -1;	
			
		$("#acc"+i).accordion({
				alwaysOpen: false,
				autoheight: false,
				header: 'a.acc'+i,
				clearStyle: false,
				active: accreal
				
			});
		i++;
		}
		
		}
		
		var flashvars = {
			src: "flashmenu.php?param2="+param2,
			search: "search/"
			
		};
		var params = {
			menu: "false",
			scale: "noScale",
			bgcolor: "#dfdfdf",
			wmode: "transparent"
		};

		if(bfl)	swfobject.embedSWF("ui.swf", "altContent", "100%", "380", "9.0.0", "expressInstall.swf", flashvars, params);
		else swfobject.embedSWF("ui2.swf", "altContent", "100%", "320", "9.0.0", "expressInstall.swf", flashvars, params);
	
		
	});	
	
	
