﻿
var clickedLi; //local variable for setTimeout function that can use temp variables.
var didIReach = 0;
var doubleOver = false;
//counter for catching loops
var loopCounter = 0;
//if (document.documentMode == "5")
//	engine = 7;


$(function(){
	
	//Changing the Contact form fields color when they get focus and changing it back if they are left empty (return to default values)
	$(".feedback .row input, .feedback textarea").focus(function(){
		if (($(this).val() == firstName) || ($(this).val() == lastName) || ($(this).val() == email) || ($(this).val() == company) || ($(this).val() == message)) { 
			$(this).css("color", "#000");
		}
	});
	$(".feedback .row input, .feedback textarea").blur(function(){
		if ($(this).val() == "")
		{
			$(this).css("color", "#999");
		}
	});
	$(".clearButton").click(function(){
		$(".feedback .row input, .feedback textarea").css("color", "#999");
	});

	    
	    // Ading AmPie english
	    if ((window.location + "").indexOf("tabid/912") > 0)
	    {
	    // <![CDATA[		
			var so = new SWFObject("/portals/gaon holdings/skins/gaon holdings/ampie_1.6.4.1/ampie/ampie.swf", "ampie", "520", "380", "8", "#FFFFFF");
			so.addVariable("path", "/portals/gaon holdings/skins/gaon holdings/ampie_1.6.4.1/ampie/");
			so.addVariable("settings_file", encodeURIComponent("/Portals/Gaon Holdings/Skins/Gaon Holdings/ampie_1.6.4.1/examples/donut/ampie_settings.xml"));
			so.addVariable("data_file", encodeURIComponent("/Portals/Gaon Holdings/Skins/Gaon Holdings/ampie_1.6.4.1/examples/donut/ampie_data.txt"));
			so.write("chartDiv");
			// ]]>
	    }
	    // Ading AmPie hebrew
	    if ((window.location + "").indexOf("/tabid/1316") > 0)
	    {
	    // <![CDATA[		
			var so = new SWFObject("/portals/gaon holdings/skins/gaon holdings/ampie_1.6.4.1/ampie/ampie.swf", "ampie", "520", "380", "8", "#FFFFFF");
			so.addVariable("path", "/portals/gaon holdings/skins/gaon holdings/ampie_1.6.4.1/ampie/");
			so.addVariable("settings_file", encodeURIComponent("/Portals/Gaon Holdings/Skins/Gaon Holdings/ampie_1.6.4.1/examples/donut/ampie_settings.xml"));
			so.addVariable("data_file", encodeURIComponent("/Portals/Gaon Holdings/Skins/Gaon Holdings/ampie_1.6.4.1/examples/donut/ampie_data.txt"));
			so.write("chartDiv");
			// ]]>
	    }
    //-------------------------- END Sifr
    
    //adding class and children for Contact Item on lower footer ---------
    $(".upperFooter li.item-1018").addClass("has-children");
    $(".upperFooter li.item-1018").append("<ul class='level-2 contactList'> <li style=''>6 Kaufman St.</li> <li >Gaon House, 14th Fl.</li> <li>Tel Aviv 68012, Isreal</li> <li><b>Tel:</b> +972 3 7954100</li> <li><b>Fax:</b> +972 3 7954103</li> <li><b>Email:</b><a href='mailto:info@gaon.com'>info@gaon.com</a></li> </ul>");
    //hebrew
    $(".upperFooter li.item-1319").addClass("has-children");
    $(".upperFooter li.item-1319").append("<ul class='level-2 contactList'> <li style=''>רח' קויפמן 6</li> <li >בית גאון, קומה 14</li> <li>ת" + '"' + "א 68012, ישראל</li> <li><b>טל:</b> 03-7954100</li> <li><b>פקס:</b> 03-7954103</li> <li><b>דוא" + '"' + "ל: </b><a href='mailto:info@gaon.com'>info@gaon.com</a></li> </ul>");
    //----------------------------- End adding to footer
    
    //Making sure that clicked item (even if click was not directly on <a> element) will get to their location.
    $(".topMenu li.level-0").not(".topMenu li.level-0.current").click( function(){
    	window.location = $(this).children("a:first").attr("href");
    });
    
    //Menu item child ul slideDown and FadeOut
    $(".topMenu li.level-0").hover(
      //using didIReach and doubleOver to check if the user hovered over the li by mistake and didnt 
      //intent to open the dropdown menu or he just moved too fast with the cursor so 
      //he got out of the dropdown menu borders before the menu was fully opened which is soppused to fadeout the menu.
	        function(){		
		    var hiddenUL = $(this).children("ul.level-1").not(".topMenu li.item-1016 ul.level-1");	
		    if (doubleOver == true && hiddenUL == clickedLi.children("ul.level-1")) //user meant for the dropdown menu to open but went too fast with the cursor and got out of the dropdown menu borders before the menu was opened completly.
		    {
		    	doubleOver = false;
			$(".topMenu li.level-0").removeClass("hover");			
			$(this).addClass("hover");		
		    }
		    else //this is the First click
		    { 
		        $(this).addClass("hover");
			didIReach = 1;	//setting didIReach to 1 until the slideDown function is complete giving us a way to indicate in the HoverOut mouse function if the dropdown list is fully opened    
		    	if ($(hiddenUL).attr("class") == null)
				didIReach = 0;					
				hiddenUL.slideDown(200, function(){
				didIReach = 0;		    			
		    	});
		     }	
	        }, 
	        function(){
		    if (didIReach == 0) //the dropdown menu was fully opened before the user hovered out the dropdown menu
		    {	    
			    $(this).removeClass("hover");
		            $(this).children("ul.level-1").fadeOut(100);
   
			    doubleOver = false;
		    }
		    else //the dropdown menu was not fully opened when the user hovered out the dropdown menu.
		    {
		    	doubleOver = true; //if the hoverIn function is called in the next 300 miliseconds it means that the user just moved too fast with cursor and went out the dropdown menu borders before it was fully opened. if not, the dropdown menu will fade after 300 miliseconds.
			setTimeout('doubleOver = false;', 250);
		    	clickedLi = $(this);
			isOver();		    	
		    }
	        }
    );
	
	//on CompanyPage page there are 3 UDT's. this code shows the correct UDT and hides the other 2 occording to the querystring
	if ((((window.location + "").indexOf("tabid/1135") > 0) || (window.location + "").indexOf("tabid/1332") > 0 ) && (GetQueryStringWithSeperator("udt", 2, "_") > 0))
	{		
		var udtNo = GetQueryStringWithSeperator("udt", 2, "_");
		var currentUdt = 0;		
		switch (udtNo)
		{
			case "1999":
				currentUdt = 0;				
				break;
			case "2000":
				currentUdt = 1;
				break;
			case "2001":
				currentUdt = 2;			
				break;
			case "2407":
				currentUdt = 0;
				break;
			case "2409":
				currentUdt = 1;
				break;
			case "2410":
				currentUdt = 2;
				break;			
		}
		var pic;
		switch (currentUdt)
		{
			case 0:
				pic = "Retail and Trading";
				break;
			case 1:
				pic = "Agro";
				break;
			case 2:
				pic = "Financial Services";
				break;
		}
		$(".imagePane div div div img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/" + pic + ".jpg");
		$(".DNN_UserDefinedTableContent:eq(" + currentUdt + ")").show();
		$(".DNN_UserDefinedTableContent").not(".DNN_UserDefinedTableContent:eq(" + currentUdt + ")").hide();
	}
	
	//This code is for Showing the correct Tab occording to the querystring------------------
	if (((window.location + "").indexOf("tabid/912") > 0) && (GetQueryString("tab", 2) > 0))
	{	
		
			switch(GetQueryString("tab", 2))
			{
				case "1":
				    switchTabs("firstTab", "secondTab", "thirdTab", "Company Profile");
				    break;
				case "2":
				    switchTabs("secondTab", "firstTab", "thirdTab", "Company History");
				    break;
				case "3":
				     switchTabs("thirdTab", "firstTab", "secondTab", "Management Team");
				     break;
			}
				
	}
	
	if (((window.location + "").indexOf("tabid/913") > 0) && (GetQueryString("tab", 2) > 0))
	{		
		
			switch(GetQueryString("tab", 2))
			{
				case "1":
				    switchTabs("firstTab", "secondTab", "thirdTab", "Retail and Trading");
				    break;
				case "2":
				    switchTabs("secondTab", "firstTab", "thirdTab", "Agro");
				    break;
				case "3":
				     switchTabs("thirdTab", "secondTab", "firstTab", "Financial Services");
				     break;
			}
				
	}
	//Hebrew part
	if (((window.location + "").indexOf("%D7%AA%D7%97%D7%95%D7%9E%D7%99%D7%A4%D7%A2%D7%99%D7%9C%D7%95%D7%AA") > 0) && (GetQueryString("tab", 2) > 0))
	{
			switch(GetQueryString("tab", 2))
			{
				case "1":
				    switchTabs("firstTab", "secondTab", "thirdTab", "קמעונאות וסחר");
				    break;
				case "2":
				    switchTabs("secondTab", "firstTab", "thirdTab", "קלינטק ומים");
				    break;
				case "3":
				     switchTabs("thirdTab", "secondTab", "firstTab", "שירותים פיננסיים");
				     break;
			}		
	}
	if (((window.location + "").indexOf("%D7%90%D7%95%D7%93%D7%95%D7%AA%D7%99%D7%A0%D7%95") > 0) && (GetQueryString("tab", 2) > 0))
	{		
			switch(GetQueryString("tab", 2))
			{
				case "1":
				    switchTabs("firstTab", "secondTab", "thirdTab", "אודות קבוצת גאון");
				    break;
				case "2":
				    switchTabs("secondTab", "firstTab", "thirdTab", "היסטוריה");
				    break;
				case "3":
				     switchTabs("thirdTab", "secondTab", "firstTab", "הנהלה");
				     break;
			}				
	}
	//------------------------------------ End Query tab selection
	
	//making the dropdown lists change tabs insted of redirecting.
	$("li.item-1023 a, li.item-1024 a, li.item-1025 a, li.item-1020 a, li.item-1021 a, li.item-1022 a, li.item-1325 a, li.item-1326 a, li.item-1327 a, li.item-1322 a, li.item-1323 a, li.item-1324 a").click(function(e){
		var isActivities = (window.location + "").indexOf("ACTIVITIES");
		var isAboutUs = (window.location + "").indexOf("ABOUTUS");
		var isHeActivities = (window.location + "").indexOf("%D7%AA%D7%97%D7%95%D7%9E%D7%99%D7%A4%D7%A2%D7%99%D7%9C%D7%95%D7%AA");
		var isHeAboutUs = (window.location + "").indexOf("%D7%90%D7%95%D7%93%D7%95%D7%AA%D7%99%D7%A0%D7%95");
		var parentLI = 	$(this).parent().parent().parent().html();
		if (( parentLI.indexOf("ACTIVITIES") >= 0 && isActivities > 0) || (parentLI.indexOf("ABOUTUS") > 0 && isAboutUs > 0) || (parentLI.indexOf("%D7%90%D7%95%D7%93%D7%95%D7%AA%D7%99%D7%A0%D7%95") > 0 && isHeAboutUs > 0) || (parentLI.indexOf("%D7%AA%D7%97%D7%95%D7%9E%D7%99%D7%A4%D7%A2%D7%99%D7%9C%D7%95%D7%AA") > 0 && isHeActivities > 0) )
		{	
			e.preventDefault();
			var parentUL;
			if (isActivities > 0)
			{
				parentUL = $(".item-913 ul:eq(0)");
			}
			else if (isAboutUs > 0)
			{
				parentUL = $(".item-912 ul:eq(0)");
			}
			else if (isHeActivities > 0)
			{
				parentUL = $(".item-1317 ul:eq(0)");
			}
			else if (isHeAboutUs > 0)
			{
				parentUL = $(".item-1316 ul:eq(0)");
			}
			if ($(this).attr("href") == parentUL.children("li:first").children().attr("href"))
			{
				var clicked = $("#secondTab");
				var current = $(".tabber a.current");
				var third = $(".tabber a").not(clicked).not(current);
				switchTabs(clicked.attr("id"), current.attr("id"), third.attr("id"), clicked.html());
			}
			else if ($(this).attr("href") == parentUL.children("li:first").siblings("li.level-1:eq(0)").children("a").attr("href"))
			{
				var clicked = $("#firstTab");
				var current = $(".tabber a.current");
				var third = $(".tabber a").not(clicked).not(current);
				switchTabs(clicked.attr("id"), current.attr("id"), third.attr("id"), clicked.html());
			}
			else if ($(this).attr("href") == parentUL.children("li:first").siblings("li.level-1:eq(1)").children("a").attr("href"))
			{
				var clicked = $("#thirdTab");
				var current = $(".tabber a.current");
				var third = $(".tabber a").not(clicked).not(current);
				switchTabs(clicked.attr("id"), current.attr("id"), third.attr("id"), clicked.html());
			}
			
		}
		else
		{
			
		}
	});
	
	//slide down text in Gaon in the News page
	$(".newsOpen").click(function(e){
		e.preventDefault();
		$("a.newsOpen.opened").not(this).each(function(){
			$(this).parent().find(".newsText").animate({
			    height: '49px'
			  }, 500, function() {
			    // Animation complete.
			});
			$(this).removeClass("opened");
			$(this).hide();
		});	
	
			
			if ($(this).attr("class").indexOf("opened") >= 0)
			{
				$(this).parent().find(".newsText").animate({
			    height: '49px'
			  }, 500, function() {
			    // Animation complete.
			});
				$(this).removeClass("opened");
			}
			else
			{
			var textHeight = $(this).parent().find(".newsTextHeight").height() + 15;
			$(this).parent().find(".newsText").animate({
			    height: textHeight
			  }, 500, function() {
			    // Animation complete.
			});
				$(this).addClass("opened");
				$(this).hide();
			}
	});
	$(".newsHeader a").click(function(e){
		e.preventDefault();
		var openNews = $(this).parent().parent().find("a.newsOpen");
		if ($(openNews).attr("class").indexOf("opened") > 0)
		{
			e.preventDefault();
			$(".newsOpen").removeClass("opened");
			$(".newsText").animate({
			    height: '49px'
			  }, 500, function() {
			    // Animation complete.
			});
			$("a.newsOpen").show();
		}
		else
		{
			$(openNews).hide();
			$(openNews).addClass("opened");
			var textHeight = $(openNews).parent().find(".newsTextHeight").height() + 15;
			$(openNews).parent().find(".newsText").animate({
			    height: textHeight
			  }, 500, function() {
			    // Animation complete.
			});
		}

	});
	$(".newsClose").click(function(e){
		e.preventDefault();
		$(".newsOpen").removeClass("opened");
		$(".newsText").animate({
			    height: '49px'
			  }, 500, function() {
			    // Animation complete.
		});
		$("a.newsOpen").show();
	});	
	
	
	//Tab Management
	$(".tabber a").click(function(){
		var clicked = $(this);
		var current = $(".tabber a.current");
		var third = $(".tabber a").not(clicked).not(current);
		switchTabs(clicked.attr("id"), current.attr("id"), third.attr("id"), clicked.html());
		return false;
	});
	
	//CompanyPage Gallery Management -----------------------------------
	$(".udtGaleeryThumbs li a").not(".current").click(function(e){
		e.preventDefault();
		var thisObj = $(this)
		$(".udtGaleeryThumbs li").removeClass("current");
		$(this).parent().addClass("current");
		$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").fadeOut(200,function(){
			$(".udtBigPic img").not(".udtBigPic a img").attr("src", "");
			$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").attr("src", $(thisObj).attr("href") + "&width=400&height=271&crop=true");
			$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").fadeIn(200);
		});
	
	});
	$(".galleryRightArrow").click(function(e){
		e.preventDefault();
		if ($(".udtGaleeryThumbs li.current").attr("class") != $(".udtGaleeryThumbs li:last").attr("class"))
		{
			var nextItem = $(".udtGaleeryThumbs li.current").next();
			$(".udtGaleeryThumbs li").removeClass("current");
			nextItem.addClass("current");
			$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").fadeOut(200, function(){
				$(".udtBigPic img").not(".udtBigPic a img").attr("src", "");
				$(".udtBigPic img").not(".udtBigPic a img").attr("src", $(nextItem).children("a").attr("href") + "&width=400&height=271&crop=true");
				$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").fadeIn(200);
			});
			
			
		}
	});	
	$(".galleryLeftArrow").click(function(e){
		e.preventDefault();
		if ($(".udtGaleeryThumbs li.current").attr("class") != $(".udtGaleeryThumbs li:first").attr("class"))
		{
			var prevItem = $(".udtGaleeryThumbs li.current").prev();
			$(".udtGaleeryThumbs li").removeClass("current");
			prevItem.addClass("current");
			$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").fadeOut(200, function(){
				$(".udtBigPic img").not(".udtBigPic a img").attr("src", "");
				$(".udtBigPic img").not(".udtBigPic a img").attr("src", $(prevItem).children("a").attr("href") + "&width=400&height=271&crop=true");
				$(".udtBigPic img.galleryBigPic").not(".udtBigPic a img").fadeIn(200);
			});
			
		}
	});
	
	$(".galleryLeftArrow").hover(function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-left_over.png");	
	},function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-left_up.png");
	});
	$(".galleryRightArrow").hover(function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-right_over.png");	
	},function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-right_up.png");
	});
	//-------------------------------------------------------- END Gallery management
	
	//adding FlowPlayer -----------------------------------------------------------
	if ((window.location + "").indexOf("tabid/1019") > 0 || (window.location + "").indexOf("tabid/1320") > 0)
	{
		flowplayer("bennyVideo", "/Portals/gaon holdings/Skins/gaon holdings/js/flowplayer-3.2.5.swf", {
		          plugins: 
			  {			// load one or more plugins
		            controls: 
			    {			// load the controls plugin
			            url: '/Portals/gaon holdings/Skins/gaon holdings/js/flowplayer.controls-3.2.3.swf',	// always: where to find the Flash object
			            playlist: true, // now the custom options of the Flash object
			            buttonColor: 'rgba(0, 0, 0, 0.9)',
				    buttonOverColor: '#000000',
				    backgroundColor: '#D7D7D7',
				    backgroundGradient: 'medium',
				    sliderColor: '#FFFFFF',			
				    sliderBorder: '1px solid #808080',
				    volumeSliderColor: '#FFFFFF',
				    volumeBorder: '1px solid #808080',			
				    timeColor: '#000000',
				    durationColor: '#535353',
				    tooltips: 
				    {	// this plugin object exposes a 'tooltips' object
			                buttons: true,
			                fullscreen: 'Enter Fullscreen mode'
			            }
		            }
		          } ,
			  clip: 
			  {
	    			autoPlay: false
			  }
	      	});
	}
	//-------------------------------------------End adding Flowplayer
	
    /* gallery */
    if ((window.location + "").indexOf("tabid/1019") > 0 || (window.location + "").indexOf("tabid/1320") > 0)
    {
            $(".gallery").addClass("BennyGallery");
	    $(".gallery").prepend('<a class="leftArrow" href="#" ><img src="/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-left_up.png" alt="" /></a> <a class="rightArrow" href="#" ><img src="/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-right_up.png" alt="" /></a>');		
	   	$(".rightArrow").click(function(e){
			e.preventDefault();
			if ($("ul.mezoo-basic-gallery-thumbnails li:last a").attr("class").indexOf("active") < 0)
			{			
				var nextItem = $("ul.mezoo-basic-gallery-thumbnails li a.active").parent().next();
				$("ul.mezoo-basic-gallery-thumbnails a").removeClass("active");
				nextItem.children("a").addClass("active");
				$(".gallery-big img").fadeOut(200, function(){
					$(".gallery-big img").attr("src", "");
					$(".gallery-big img").attr("src", $(nextItem).children("a").attr("href"));
					$(".gallery-big img").fadeIn(200);
				});
			}
		});	
    
	$(".leftArrow").click(function(e){
		e.preventDefault();
		if ($("ul.mezoo-basic-gallery-thumbnails li:eq(0) a").attr("class").indexOf("active") < 0)
		{			
			var prevItem = $("ul.mezoo-basic-gallery-thumbnails li a.active").parent().prev();
			$("ul.mezoo-basic-gallery-thumbnails li a").removeClass("active");
			prevItem.children("a").addClass("active");
			$(".gallery-big img").fadeOut(200, function(){
				$(".gallery-big img").attr("src", "");
				$(".gallery-big img").attr("src", $(prevItem).children("a").attr("href"));
				$(".gallery-big img").fadeIn(200);
			});
		}
	});
    	
	$(".leftArrow").hover(function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-left_over.png");	
	},function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-left_up.png");
	});
	$(".rightArrow").hover(function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-right_over.png");	
	},function(){
		$(this).children("img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-right_up.png");
	});
    
    $('.mezoo-basic-gallery-thumbnails').wrap('<div class=\'sideRoll\' ></div>');
    $('.mezoo-basic-gallery-thumbnails').wrap('<div class=\'thumbnails\'></div>');
    $("ul.mezoo-basic-gallery-thumbnails li a:first").addClass("active");
    $('.gallery-big').html('<img style="margin-bottom: 7px;" src="' + $("ul.mezoo-basic-gallery-thumbnails li:first a").attr("href") + '" class=\'imgme\'/>');
    
    var x = $('.mezoo-basic-gallery-thumbnails LI').length;
    var contentWidth = x * 72;
    var maxRight = 420 - contentWidth;
    $('.mezoo-basic-gallery-thumbnails').css("width", contentWidth + "px");
    $('ul.mezoo-basic-gallery-thumbnails a').not('.mezoo-basic-gallery-admin-links a')
        .click(function(e) {	
            e.preventDefault();
	    var picPath = $(this).attr("href");
            $('ul.mezoo-basic-gallery-thumbnails a.active').removeClass('active');
            $(this).addClass('active');
            
	    $('.gallery-big img').fadeOut(200, function(){
	    	//$(".gallery-big img").attr("src", "");
		$(".gallery-big img").attr("src", picPath);
		$(".gallery-big img").fadeIn(200);
	    }); 

            $('.gallery-big img').css({ cursor: 'pointer' }).click(function() {
                $('ul.mezoo-basic-gallery-thumbnails a.active').parent().next().find('a').trigger('click');
            });
            //$('.ul.mezoo-basic-gallery-thumbnails a').css({ cursor: 'pointer' }).click(function() {
                //$('ul.mezoo-basic-gallery-thumbnails a.active').parent().next().find('a').trigger('click');
            //});



        })
	
        //.filter(':first').trigger('click');
    }
    else
    {
		$(".gallery").addClass("Gallery");
    }
    
    //Photo Gallery
    
    if ($('.mezoo-basic-gallery-thumbnails').length != 0) {
        $(".mezoo-basic-gallery-thumbnails IMG").each(function() {
            x = $(this).attr("alt")
            $(this).parent().attr("title", x);
        })
    
        $('.Gallery .mezoo-basic-gallery-thumbnails a').not('.mezoo-basic-gallery-admin-links a').lightBox(); 
    }
    	
	//if (navigator.appName.indexOf("Internet Explorer") > 0 && (window.location + "").indexOf("?re=true") < 0 )
		//window.location = window.location + "?re=true";
	//Checking if Wrapper div height is less than body height, then changing the footers height to fit.
	var windowHeight = 0;
	var bodyHeight = $(".wrapper").height() + $(".innerUpperFooter").height();
	//if (navigator.appName.indexOf("Internet Explorer") > 0)
		
		//windowHeight = document.body.offsetHeight;
	if (navigator.appName=="Netscape")
	{
		windowHeight = window.innerHeight;
		if (windowHeight  > bodyHeight)
		{
			//var moreSize = (windowHeight - bodyHeight + $(".innerUpperFooter").height()) + "px";
			//$(".innerUpperFooter").css("height", moreSize);	
		}
	}
	$('#lightbox-nav-btnPrev').hover(function() {
		$(this).css({ 'background' : 'url(/portals/gaon holdings/skins/gaon holdings/gfx/gallery-pics-left_up.png) left 15% no-repeat' });
	},function() {
		$(this).css({ 'background' : 'transparent url() no-repeat' });
	});
	
	if ((window.location + "").indexOf("tabid/1600/") > 0)
	{
		$(".mezoo-basic-gallery-thumbnails li a, .mezoo-basic-gallery-thumbnails li a img").each(function(){
			$(this).attr("title", $(this).parent().find(".hiddenGalleryContent .Caption2").html());		
		});
	}
	
});
    
    
    
	
    //---------------------------------------------


function switchTabs(clicked, second, third, pic)
{
	if ($("." + clicked).css("display") == "none")
		{	
			$("." + second).css("display", "none");//fadeOut(1000, function(){
			$("." + third).css("display", "none");//fadeOut(1000, function(){	
			//});			
			$("." + clicked).css("display", "block");//fadeIn();
			$(".tabber a").removeClass("current").removeClass("beforeCurrent");
			$(".tabber a#" + clicked).addClass("current");
			if (!(clicked == "firstTab"))
			{
				var beforeCurrent = "";
				if (clicked == "secondTab")
				{
					beforeCurrent = "firstTab";
				}
				else
				{
					beforeCurrent = "secondTab";
				}
				$("a#" + beforeCurrent).addClass("beforeCurrent");
			}
			 $(".imagePane div div div img").attr("src", "/portals/gaon holdings/skins/gaon holdings/gfx/" + pic + ".jpg");	
			if ((window.location + "").indexOf("%D7%A2%D7%91%D7%A8%D7%99%D7%AA") > 0)
			{
				var futura = { src: 'http://www.gaon.com/portals/Gaon Holdings/skins/gaon holdings/sifr3-r436-rtl/heb1.swf' };
				sIFR.replace(futura, {
				 selector: 'h3',
				 css: '.sIFR-root { color: #17335C; }'
				});
			}
			else
			{		
			    var Aldine = { src: 'http://www.gaon.com/Portals/Gaon Holdings/Skins/Gaon Holdings/sifr3-r436/Aldine.swf' };
			    sIFR.replace(Aldine, {
			        selector: 'h3'
				,css: [
			    	'.sIFR-root { color: #17335c; text-align: left; font-size: 36px; }'

			    	],wmode: 'transparent' 
			    });
			}    
		}
}

function printPage(){
$('.topFooter, .copyrights, .topMenu, .footer').css("display","none");
	$(".middleDevider").css("top", "250px");
	print();
 	setTimeout ( "afterPrint()", 2000 );
	
}


function afterPrint()
{
	$(".middleDevider").css("top", "336px");
	$('.topFooter, .copyrights, .topMenu, .footer').css("display","block");

}

function isOver()
{
	setTimeout('if (doubleOver == true) { doubleOver = false; $(clickedLi).removeClass("hover"); $(clickedLi).children("ul.level-1").not(".topMenu li.item-1016 ul.level-1").fadeOut(100); }', 300);
}

//rotating photos play
jQuery.fn.mezooRotatePhotos = function() {
        return this.each(function() {
        var $active = $(this).find('.active');
        var $next = $active.next();
        if ($next.length == 0) $next = $active.parent().find('.captioned-photo:first');
        $active.fadeOut(1000, function() {
            $active.removeClass('active');
        });
        $next.addClass('active').fadeIn(1000)    
    });
}


function rotatePhotos() {
    $('.photo-rotator').mezooRotatePhotos();
}


function GetQueryString(request, method)
{
	var FullURL = (window.location + "");
        var NoDomain = FullURL.split("//");
    switch(method)
    {
        
        
        case 1:                    
            var Values = NoDomain[1].split("/");
            var i = 0;
            for (i=0;i<Values.length;i++)
            {
	            if (Values[i] == request)
	            {
		            return Values[i + 1];
	            }
	        }
	    break;
	    
	    case 2:
	        var FullQuery = NoDomain[1].split("?");
		if (FullQuery.length < 2)
			return false;
	        var QueryParts = FullQuery[1].split("&")
	        var i = 0;
	        var ItemCounter = 0;
            for (i=0;i<QueryParts.length;i++)
            {
                if (QueryParts[i].indexOf(request) >= 0)
                {
                    var QuerySplitter = QueryParts[i].split("=");
                    if (QuerySplitter[0] == request)
                    {
                        return QuerySplitter[1];
                    }
                }
            } 
    }
}
function GetQueryStringWithSeperator(request, method, seperator)
{
	var FullURL = (window.location + "");
        var NoDomain = FullURL.split("//");
    switch(method)
    {
        
        
        case 1:                    
            var Values = NoDomain[1].split("/");
            var i = 0;
            for (i=0;i<Values.length;i++)
            {
	            if (Values[i] == request)
	            {
		            return Values[i + 1];
	            }
	        }
	    break;
	    
	    case 2:
	        var FullQuery = NoDomain[1].split("?");
	        var QueryParts = FullQuery[1].split("&")
	        var i = 0;
	        var ItemCounter = 0;
            for (i=0;i<QueryParts.length;i++)
            {
                if (QueryParts[i].indexOf(request) >= 0)
                {
                    var QuerySplitter = QueryParts[i].split("=");
                    if (QuerySplitter[0].indexOf(request) >= 0)
                    {
                       var QuerySeperator = QuerySplitter[0].split(seperator);
		       for (i=0;i<QuerySeperator.length;i++)
		       {
		           if (QuerySeperator[i] == request)
			   	return QuerySeperator[i + 1];
		       }
                    }
                }
            } 
    }
}
