/******** vertikalni podmenu **********/
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
// --------------------------------->
jQuery(document).ready(function()
{
        //### NAPOMENA ###//
        /* U CSS datoteci "gortan.css" dodati:
         p.blue_arrow {background: url('../../img/site/BKG_sub_menu_blue.gif') 0px 0px no-repeat; }
         p.white_arrow {background: url('../../img/site/BKG_sub_menu_white.gif') 0px 0px no-repeat; }
        */
        //### NAPOMENA - KRAJ ###//

        //***** NOVO *****//
	jQuery("p.menu_head").addClass("white_arrow");// stavlja bijelu strelicu na sve "p.menu_head" elemente
  jQuery(".menu_head a.on").parent().toggleClass("white_arrow").toggleClass("blue_arrow").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");// stavlja plavu strelicu na aktivni link 
        //***** NOVO - KRAJ *****//

        //slides the element with class "menu_body" when paragraph with class "menu_head" is clicked
	jQuery("#firstpane p.menu_head").click(function()
    {
        //***** UKLONITI *****//
	//jQuery(this).css({backgroundImage:"url(img/site/BKG_sub_menu_blue.gif)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
      	//jQuery(this).siblings().css({backgroundImage:"url(img/site/BKG_sub_menu_white.gif)"});
        //***** UKLONITI - KRAJ *****//

      //***** NOVO *****//
      jQuery(this).toggleClass("white_arrow").toggleClass("blue_arrow").next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
      jQuery(this).siblings().removeClass("blue_arrow").addClass("white_arrow");
      jQuery(".menu_head a.on").parent().toggleClass("white_arrow").toggleClass("blue_arrow");// stavlja plavu strelicu na aktivni link
      /*
       Ova posljednja linija coda je potrebna ako npr. link "O projektu" mora ostati aktivan i kada klikneš na "Etaže",
       a ako status aktivnog linka preuzima link "Etaže", onda tu liniju možeš ukloniti.
      */
      //***** NOVO - KRAJ *****//
     // NEMA DRUGIH PROMJENA U OVOJ DATOTECI //
	});


  
          jQuery(".biglinks_sub a").hover(function() {
            jQuery(this).stop().animate({backgroundColor: "#AFAFAF", borderTopColor: "#CFCFCF",borderBottomColor: "#CFCFCF",borderLeftColor: "#CFCFCF",borderRightColor: "#CFCFCF"}, 600);

            },function() {
            jQuery(this).stop().animate({backgroundColor: "#fff",borderTopColor: "#DFDFDF",borderBottomColor: "#DFDFDF",borderLeftColor: "#DFDFDF",borderRightColor: "#DFDFDF"}, 400);

             });


	//slides the element with class "menu_body" when mouse is over the paragraph
	jQuery("#secondpane p.menu_head").mouseover(function()
    {
	     jQuery(this).css({backgroundImage:"url(img/site/BKG_sub_menu_blue.gif)"}).next("div.menu_body").slideDown(500).siblings("div.menu_body").slideUp("slow");
         jQuery(this).siblings().css({backgroundImage:"url(img/site/BKG_sub_menu_white.gif)"});
	});
});


/******** Rotator **********/
      var elRotator = function(opts) {
                                                opts = jQuery.extend({
                                                                time : 8000
                                                }, opts);

                                                var _this = this;
                                                var grp = jQuery(opts.rotGrp);
                                                var els = jQuery(opts.rotEls);
                                                var anc = jQuery(opts.rotAnc);

                                                anc.click(function() {
                                                                var ndx = anc.index(this);
                                                                _this.fix(ndx);
																 /* added By Mani for active Slide */ 
																	anc.removeClass(opts.ancOn).eq(ndx).addClass(opts.ancOn);
																 /* Added */
                                                                return false;
																
                                                });

                                                _this.start = function(ndx) {
                                                                if(ndx === undefined) {
                                                                                grp.data("rotate", true);
                                                                }

                                                                if(!grp.data("rotate")) {
                                                                                return;
                                                                }

                                                                if(!grp.length || !els.length) {
                                                                                return;
                                                                }

                                                                ndx = ndx || 0;
                                                                if(ndx >= els.length) {
                                                                                ndx = 0;
                                                                }

                                                                grp.queue(function() {
                                                                                var $el = jQuery(els[ndx]);
                                                                                anc.removeClass(opts.ancOn).eq(ndx).addClass(opts.ancOn);
																				$el.fadeIn("slow");
                                                                                $el.queue(function() 
																				{
                                                                                     grp.queue(function()
																					  {
                                                                                              setTimeout(function()
																							   {
                                                                                                    if(grp.data("rotate"))
																									 {
                                                                                                             $el.fadeOut("slow");
																											   _this.start(ndx + 1); 
																											   
                                                                                                      }
                                                                                                     }, opts.time);
                                                                                                 grp.dequeue();
                                                                                                });
                                                                                                $el.dequeue();
                                                                                });

                                                                                grp.dequeue();
                                                                });
                                                };

                                                _this.fix = function(ndx) {
                                                                grp.data("rotate", false);
                                                                grp.queue(function() {
                                                                                els.hide();
                                                                                jQuery(els[ndx]).show();
                                                                                grp.dequeue();
                                                                });
															
                                                };
                                };

                                var rotator1;
                                var rotator2;
                                var rotator3;
                                jQuery(function() {
                                                rotator1 = new elRotator({
                                                                rotGrp : "#gsBillboardContainer1",
                                                                rotEls : ".gsBillboardSlide1",
                                                                rotAnc : ".rotateNav1",
                                                                ancOn : "ancOn1",
                                                                time : 6000
                                                });
                                                
                                                rotator2 = new elRotator({
                                                                rotGrp : "#gsBillboardContainer2",
                                                                rotEls : ".gsBillboardSlide2",
                                                                rotAnc : ".rotateNav2",
                                                                ancOn : "ancOn2",
                                                                time : 6000
                                                });
                                                
                                                rotator3 = new elRotator({
                                                                rotGrp : "#gsBillboardContainer3",
                                                                rotEls : ".gsBillboardSlide3",
                                                                rotAnc : ".rotateNav3",
                                                                ancOn : "ancOn3",
                                                                time : 6000
                                                });
											
  				
                                                rotator1.start();
                                                rotator2.start();
                                                rotator3.start();
                                });                                                               
