
// superfish dropdown menu
//-------------------------------------------------------------------		
$(document).ready(function() {
    $('ul.sf-menu').superfish({
		//pathClass: 'current',
		pathLevels	: 5,
		delay:       300,                            	// one second delay on mouseout 
		animation:   {opacity:'show',height:'show'},  	// fade-in and slide-down animation 
		speed:       'fast',                          	// faster animation speed 
		autoArrows:  true,                           	// disable generation of arrow mark-up 
		dropShadows: false                            	// disable drop shadows 
    	}).find('li.current').showSuperfishUl();
   
});

// inchidem meniul curent deschis
$(window).load(function() {
        setTimeout(function() {
        $('ul.sf-menu li.current > ul').hide('fast');
		//$('ul.sf-menu li.current').hideSuperfishUl();
    },2000);
});


	
// round corners
//-------------------------------------------------------------------
$(document).ready(function() { 
	$('.sec_list_item').corner("3px");
	$('.foto_mare_sec').corner("3px");
	$('.foto_mare_art').corner("3px");
}); 


// create CLEAR div after FLOAT columns
//-------------------------------------------------------------------
$(document).ready(function(){
	$(document.createElement('div')).css({'clear': 'both'}).insertAfter(".left_site_container");
});	


// TOOLTIP
//-------------------------------------------------------------------
$(function() {
	$('.tooltip').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " - ",
		fade: 100
	});
});



// Increase Font Size
//-------------------------------------------------------------------
$(document).ready(function(){

  // originalFontSize
 var originalFontSize = $('.increase_fontsize').css('font-size');
 var maxFontSize = '20';
 // originalLineHeight
 var originalLineHeight = $('.increase_fontsize').css('line-height');
 
  //$("#font_size_t").click(function(){ 
  $('#font_size_t').live("click", function(){	
	// increase font size
	var currentFontSize = $('.increase_fontsize *').css('font-size');
	var currentFontSizeNum = parseFloat(currentFontSize, 10);
	var newFontSize = currentFontSizeNum*1.2;
	$('.increase_fontsize *').css('font-size', newFontSize);
	// increase line-height
	var currentLineHeight = $('.increase_fontsize *').css('line-height'); 	
	var currentLineHeightNum = parseFloat(currentLineHeight, 10);   
	var newLineHeight = 2;
	$('.increase_fontsize *').css('line-height', newLineHeight);	
	
	// reset
	if (newFontSize >= maxFontSize) {
			$('.increase_fontsize *').css('font-size', originalFontSize);
			$('.increase_fontsize *').css('line-height', originalLineHeight);
		}
		
	return false;	
  });
  
});


// Add to fav
//-------------------------------------------------------------------
$(document).ready(function(){
	$('#add_fav_t').jFav();
});








// mousewheel - Whell suport
//-------------------------------------------------------------------
$(document).ready(function() { 
    $('.clasa_div_cu_scroll.....').bind('mousewheel', function(e, delta)  { 
			var dir = delta > 0 ? '-=20px' : '+=20px';
			$(this).scrollTo( dir, 30, {axis:'x'}  );
			return false;

        });
});


// external links open in new window
//-------------------------------------------------------------------
$(document).ready(function(){
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr({target: "_blank", title: "Open in new window"}).append(' [^]');
});


// Scroll to topLink
//-------------------------------------------------------------------
$(function(){$.fn.scrollToTop=function(options){if(options){var speed=options.speed;var ease=options.ease;}else{var speed="slow";var ease="jswing";}var scrollDiv=$(this);$(this).hide().removeAttr("href");if($(window).scrollTop()!="0"){$(this).fadeIn("slow");}$(window).scroll(function(){if($(window).scrollTop()=="0"){$(scrollDiv).fadeOut("slow");}else{$(scrollDiv).fadeIn("slow");}});$(this).click(function(event){$("html, body").animate({scrollTop:"0px"},speed,ease);});}});
$(function() {
	$("#toTop").scrollToTop({
		speed:500
		//ease:"easeOutBounce"
	});
});
			
			
			

// MODULE:
// #######################################################


// TABS module
// ==========================================
$(document).ready(function() {
   
   $('.modul_title_tab').parent().parent().parent().tabs({ 
   		//selected: 1 ,
		cookie: { expires: 30 } ,
		cache: true,
		collapsible: true,
		fx: { height: 'toggle'}				
	});
   
});


// TOGGLE module
// ==========================================
$(document).ready(function(){  
	$('.modul_title_toggle',this).toggle(  
		function () {
			
			var modul_id = $(this).attr('id');
			var modul_title = $(this).attr('title');
			var modul_url = $(this).attr('rel');
			if (modul_url == null) {
				modul_url = '';
			};
			
			
			// LA DESCHIDERE:
			//-----------------------------
			// la prima incarcare...
			if($('#container_'+modul_id).text() == '') {  
					
				$(this).html(modul_title+" <span title='inchide'>[-]</span>").append("<img class='loading_mod_img' src='../res_img/utils/loading6.gif'>");
				if (modul_url != '') { // daca avem modul_url ... il incarcam
					$('#container_'+modul_id).load(""+modul_url+"").slideDown(500); 
				} else { // altfel.. deschidem restrictNote
					$('#container_'+modul_id).slideDown(500); 
				};
				$(".loading_mod_img").fadeTo(1000, 0);
				$.cookie('#container_'+modul_id, 'expanded');  // write COOKIES

			// daca a mai fost incarcat odata ...
			} else { 
				$(this).html(modul_title+" <span title='inchide'>[-]</span>");  
				$('#container_'+modul_id).slideDown(500); 
				$.cookie('#container_'+modul_id, 'expanded');  // write COOKIES
			}  
		},  
		
		// LA INCHIDERE:
		//-----------------------------
		function () {  
			var modul_id = $(this).attr('id');
			var modul_title = $(this).attr('title');
			$(this).html(modul_title+" <span title='deschide'>[+]</span>");  
			$("#container_"+modul_id).slideUp(500); 
			$.cookie('#container_'+modul_id, 'collapsed');  // write COOKIES
		}  
	);

	// READ COOKIES
	//-----------------------------
	$(".modul_title_toggle").each(function(i) {
		var modul_id = $(this).attr('id');
		var modul_title = $(this).attr('title');
		var modul_url = $(this).attr('rel');
		if (modul_url == null) {
				modul_url = '';
			};

		if ($.cookie('#container_'+modul_id) == 'expanded') {
			$(this).html(modul_title+" <span title='inchide'>[-]</span>").append("<img class='loading_mod_img' src='../res_img/utils/loading6.gif'>");
			if (modul_url != '') { // daca avem modul_url ... il incarcam
				$('#container_'+modul_id).load(""+modul_url+"").slideDown(500); 
			} else { // altfel.. deschidem restrictNote
				$('#container_'+modul_id).slideDown(500); 
			};
			$(".loading_mod_img").fadeTo(1000, 0);
		}
	});
	
});  


// thickbox
//-------------------------------------------------------------------
$(document).ready(function(){
	$(".linkopengal").each(function() {	//deschide galerie multimedia
		$(this).attr("href", $(this).attr("href") + "&KeepThis=true&TB_iframe=true&height=530&width=850");
	});
});




// thickbox live in module
//-------------------------------------------------------------------
$('.linkopengal').live("click", function () {
		$(this).addClass("thickbox");
		$(this).attr("href", $(this).attr("href") + "&KeepThis=true&TB_iframe=true&height=530&width=850");
		var t = this.title || this.name || null;
		var a = this.href || this.alt;
		var g = this.rel || false;
		tb_show(t,a,g);
		this.blur();
		return false;
});

$('.linkopenimg').live("click", function () {
		var t = this.title || this.name || null;
		var a = this.href || this.alt;
		var g = this.rel || false;
		tb_show(t,a,g);
		this.blur();
		return false;
});


// /END MODULE:
// #######################################################

