    $(window).load(function() {
    $('#slider').nivoSlider({
        effect: 'slideInLeft,slideInRight,fade', // Specify sets like: 'fold,fade,sliceDown'
        slices: 25, // For slice animations
        boxCols: 18, // For box animations
        boxRows: 14, // For box animations
        animSpeed: 50, // Slide transition speed
        pauseTime: 4500, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: true, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: true, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
	

function popitup(url) {

newwindow=window.open(url,'name','height=900,width=360');

if (window.focus) {newwindow.focus()}

return false;

}



function validate_email(field,alerttxt)

{

with (field)

  {

  apos=value.indexOf("@");

  dotpos=value.lastIndexOf(".");

  if (apos<1||dotpos-apos<2)

    {alert(alerttxt);return false;}

  else {return true;}

  }

}



function validate_form(thisform)

{

with (thisform)

  {

  if (validate_email(email,"Adresa de email introdusa nu este valida!")==false)

    {email.focus();return false;}

  }

}



/* ==== Sitemap ==== */



this.sitemapstyler = function(){

	var sitemap = document.getElementById("sitemap")

	if(sitemap){

		

		this.listItem = function(li){

			if(li.getElementsByTagName("ul").length > 0){

				var ul = li.getElementsByTagName("ul")[0];

				ul.style.display = "block";

				var span = document.createElement("span");

				span.className = "expanded";

				span.onclick = function(){

					ul.style.display = (ul.style.display == "none") ? "block" : "none";

					this.className = (ul.style.display == "none") ? "collapsed" : "expanded";

				};

				li.appendChild(span);

			};

		};

		

		var items = sitemap.getElementsByTagName("li");

		for(var i=0;i<items.length;i++){

			listItem(items[i]);

		};

		

	};	

};



window.onload = sitemapstyler;



/* ==== Egalare coloane ==== */



var ddequalcolumns=new Object()

ddequalcolumns.columnswatch=["continut-left", "continut-center", "continut-right"]



ddequalcolumns.setHeights=function(reset){

var tallest=0

var resetit=(typeof reset=="string")? true : false

for (var i=0; i<this.columnswatch.length; i++){

if (document.getElementById(this.columnswatch[i])!=null){

if (resetit)

document.getElementById(this.columnswatch[i]).style.height="auto"

if (document.getElementById(this.columnswatch[i]).offsetHeight>tallest)

tallest=document.getElementById(this.columnswatch[i]).offsetHeight

}

}

if (tallest>0){

for (var i=0; i<this.columnswatch.length; i++){

if (document.getElementById(this.columnswatch[i])!=null)

document.getElementById(this.columnswatch[i]).style.height=tallest+"px"

}

}

}



ddequalcolumns.resetHeights=function(){

this.setHeights("reset")

}



ddequalcolumns.dotask=function(target, functionref, tasktype){ 

var tasktype=(window.addEventListener)? tasktype : "on"+tasktype

if (target.addEventListener)

target.addEventListener(tasktype, functionref, false)

else if (target.attachEvent)

target.attachEvent(tasktype, functionref)

}



ddequalcolumns.dotask(window, function(){ddequalcolumns.setHeights()}, "load")

ddequalcolumns.dotask(window, function(){if (typeof ddequalcolumns.timer!="undefined") clearTimeout(ddequalcolumns.timer); ddequalcolumns.timer=setTimeout("ddequalcolumns.resetHeights()", 200)}, "resize")



/* ==== Jquery ==== */



$(function(){

	

	// Tab-uri pagina produs

	$('#tabs').tabs();


	$('#cerere-float').colorbox({width:"730", height:"440", iframe:true});
    $('#contact-f').colorbox({width:"730", height:"440", iframe:true});
	$('#contact-m').colorbox({width:"890", height:"700", iframe:true});

	// Form Filtre produse

	$("select.multiselect").multiSelect();

	

	// Tooltip

	$('.bubbleInfo').each(function () {

    // options

    var distance = 10;

    var time = 250;

    var hideDelay = 100;



    var hideDelayTimer = null;



    // tracker

    var beingShown = false;

    var shown = false;

    

    var trigger = $('.trigger', this);

    var popup = $('.popup', this).css('opacity', 0);



    // set the mouseover and mouseout on both element

    $([trigger.get(0), popup.get(0)]).mouseover(function () {

      // stops the hide event if we move from the trigger to the popup element

      if (hideDelayTimer) clearTimeout(hideDelayTimer);



      // don't trigger the animation again if we're being shown, or already visible

      if (beingShown || shown) {

        return;

      } else {

        beingShown = true;



        // reset position of popup box

        popup.css({

          top: -50,

          left: -40,

          display: 'block' // brings the popup back in to view

        })



        // (we're using chaining on the popup) now animate it's opacity and position

        .animate({

          top: '-=' + distance + 'px',

          opacity: 1

        }, time, 'swing', function() {

          // once the animation is complete, set the tracker variables

          beingShown = false;

          shown = true;

        });

      }

    }).mouseout(function () {

      // reset the timer if we get fired again - avoids double animations

      if (hideDelayTimer) clearTimeout(hideDelayTimer);

      

      // store the timer so that it can be cleared in the mouseover if required

      hideDelayTimer = setTimeout(function () {

        hideDelayTimer = null;

        popup.animate({

          top: '-=' + distance + 'px',

          opacity: 0

        }, time, 'swing', function () {

          // once the animate is complete, set the tracker variables

          shown = false;

          // hide the popup entirely after the effect (opacity alone doesn't do the job)

          popup.css('display', 'none');

        });

      }, hideDelay);

    });

  });



});



/* ==== Meniu orizontal ==== */

function mainmenu(){



$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});



$(".a-link").hover(function(){

		

		$(this).children('.meniu-hover-top').css({visibility: "visible",display: "none"}).show();



		},function(){

		$(this).children('.meniu-hover-top').css({visibility: "hidden"});

});



$(".hide-menu").hover(function(){

		

		$(this).parent().parent().parent().parent('.meniu-hover-top').css({visibility: "hidden"});



		},function(){

		$(this).parent().parent().parent().parent('.meniu-hover-top').css({visibility: "hidden"});

});



}







function egaleaza_coloane(){



	var h1 = $("#continut-left").height(); 

	var h2 = $("#continut-center").height(); 

	var h3 = $("#continut-right").height(); 

	

	k =  new Array();

	k = [h1, h2, h3];

 

	k = maxValue(k);

	

	$("#continut-left").css("min-height",k);

	$("#continut-center").css("min-height",k);

	$("#continut-right").css("min-height",k);



}





maxValue = function (array) {



    mxm = array[0];

    for (i=0; i<array.length; i++) {



    if (array[i]>mxm) {



    mxm = array[i];



    }



    }

    return mxm;

};





$(document).ready(function(){

	

	$("#continut-right .bg-continut:last-child").attr('id','continut-right-last'); 

	$('#reseller_submit').live('click', function() {
			
		var $link = $(this);
		var $dialog = $('<div></div>')
			.html('<br /><b>Firma distribuie la nivel national prin intermediul resellerilor. <br />Daca sunteti interesati de distributie va rugam sa ne contactati prin intermediul formularului de mai jos:</b><br /><br /><br /><br /><form method="post" action="reselleri.php"><table><tr><td>Nume / Prenume:</td><td><input type="text" name="nume_prenume" size="25"></td></tr><tr><td>Email:</td><td><input name="email" type="text" size="25"></td></tr><tr><td>Telefon:</td><td><input name="telefon" type="text" size="25"></td></tr><tr><td>Interesat de:</td><td><select name="gama_produse"><option value="Echipamente format mare">Echipamente format mare</option><option value="Echipamente productia publicitara">Echipamente productia publicitara</option><option value="Echipamente digitizare">Echipamente digitizare</option><option value="Materiale advertising">Materiale advertising</option><option value="Consumabile">Consumabile</option></select></td></tr><tr><td>Alte detalii:</td><td><textarea cols="40" rows="5" name="detalii"></textarea></td></tr><tr><td colspan="2" align="right"><input type="submit" value="Trimite !"></td></tr></table></form><br /><br />')
			.dialog({
				dialogClass : 'modal',
				title: 'Cautam reselleri',
				width: 450,
				height: 400
			});

		$link.click(function() {
			$dialog.dialog('open');

			return false;
		});
		
	});

	$(document).pngFix(); 
	//$("img").lazyload();
	

	$("#cerere_oferta_btn").click(function() {



		$("#tabs-1").addClass('ui-tabs-hide'); 

		$("#tabs-2").addClass('ui-tabs-hide');

		$("#tabs-3").addClass('ui-tabs-hide');

		$("#tabs-4").addClass('ui-tabs-hide');

		$("#tabs-5").addClass('ui-tabs-hide');

		$("#tabs-6").removeClass('ui-tabs-hide'); 

		

		$(".hf").removeClass('ui-tabs-selected ui-state-active');

		$(".hx").addClass('ui-tabs-selected ui-state-active');

		

		$('html, body').animate({ scrollTop: $("#jump").offset().top }, 500);

		

		return false;

	});

	

	

	//Harta

	$("#zoom-harta").gzoom({sW: 700,

                    sH: 512,

                    lW: 1037,

                    lH: 758, 

                    lighbox : false

                    });





    //Tabel culori

	$(".z-color").click(function() {

   

		var culoare = $(this).css('background-color');

		$("#culoare").css('background-color', culoare);

		

		var cod_culoare = $(this).attr('title');

		$("#cod_culoare").val(cod_culoare);

    

	});

	

	$("[id^=dep_]").click(function() {

		var sZ = $(this).attr('id')

		$('#show_' + sZ).slideToggle("fast");

		egaleaza_coloane();

	});

	

	$("[id^=maincat_]").click(function() {

		var sZ = $(this).attr('id')

		$('#show_' + sZ).slideToggle("fast");

		egaleaza_coloane();

	});



	mainmenu();

	

	$('.slideshowicons').cycle({

		fx: 'fade' 

	});

	

	$('.testimonials').cycle({

	   fx: 'scrollRight', 

	   timeout: 5000, 

       delay: 5000,

       pause: 1	   

	});

	

});
