﻿	$(document).ready(function(){  
        $("area.eszak").mouseover(function() {
		//key account manager
		$("div.eszak").stop(true, true).animate({opacity: "show", left: "-70"}, "slow");
        });
        $("area.regio").mouseout(function() {
        $("div.eszak").animate({opacity: "hide", left: "-90"}, "fast");
        });

        $("area.kelet").mouseover(function() {
        $("div.kelet").stop(true, true).animate({opacity: "show", left: "-70"}, "slow");
        });
        $("area.regio").mouseout(function() {
        $("div.kelet").animate({opacity: "hide", left: "-90"}, "fast");
        });

        $("area.nyugat").mouseover(function() {
        $("div.nyugat").stop(true, true).animate({opacity: "show", left: "-70"}, "slow");
        });
        $("area.regio").mouseout(function() {
        $("div.nyugat").animate({opacity: "hide", left: "-90"}, "fast");
        });
        
		$("area.dtul").mouseover(function() {
        $("div.dtul").stop(true, true).animate({opacity: "show", left: "270"}, "slow");
        });
        $("area.regio").mouseout(function() {
        $("div.dtul").animate({opacity: "hide", left: "290"}, "fast");
        });		
		
        $("area.regio").click(function(){return false;});
        $("div.kam_map img").attr("usemap","#map");
        $("div.map_image").html('<img src="resource.aspx?resourceID=kam_hungary_map" width="520" height="294" border="0" usemap="#map" />');
		$("div.map_image_en").html('<img src="resource.aspx?resourceID=kam_hungary_map_en" width="520" height="294" border="0" usemap="#map" />');
		
		//SITE
        //$("a").removeAttr("target");
		//$("div.centerIt").css("text-align","center");
		
		//SPLASHV2
		//$("div.TigazWhiteBox img, div.TigazMarketingBox img, div.TigazWhiteBoxButtons img").css("margin","0");
		
		
		
		//30percent
		$("div.percent a").click(function() {
			var index;
			index = $(this).attr("rel");
			//$("span.info").text("URL:" + index);
			
			
			$("div.percent_containers>div").animate({opacity: "hide"}, "slow");
			$("div.percent_containers>div."+index).animate({opacity: "show"}, "fast");


			return false;
		});
		
		var savings = -560;
		var no = 0;

			function winner() {
				$("div.percent_containers>div").animate({opacity: "hide"}, 700);
				$('div.percent_winbox').animate({opacity: "show"}, "fast");
				$('div.percent_winbox a').click(function() {
					no=0;
					savings = -560;
					$(".eni30val").removeClass("percent_savings_set").text("megfogad");
					$("span.totalsavings").text(no);
					$(".energybar").animate({backgroundPosition: savings+'px 0px'},'slow','swing');
				});
			}		
			
		
		$(".eni30val").text("megfogad")
		$(".eni30val").click(function() {
		if (this.innerHTML=='megfogad') {
			no = no+1;
			savings = savings+parseInt(528/24); //parseInt(this.name);
			$(this).addClass("percent_savings_set");
			$(this).text("OK");
			//$("span.totalsavings").animate({opacity: "0.5"}, "fast").text(savings).animate({opacity: "1"}, "fast");
			$("span.totalsavings").text(no);
			$(".energybar").animate({backgroundPosition: savings+'px 0px'},'slow','swing');
			
			if (no == 24) {
				winner();
			}
		} else {
			no = no-1;
			savings = savings-parseInt(528/24); //parseInt(this.name);
			$(this).removeClass("percent_savings_set");
			$(this).text("megfogad");
			//$("span.totalsavings").animate({opacity: "0.5"}, "fast").text(savings).animate({opacity: "1"}, "fast");
			$("span.totalsavings").text(no);
			$(".energybar").animate({backgroundPosition: savings+'px 0px'},'slow','swing');
		}
		});
		
		$("div.percent_containers img").css("margin","0");
		
		//counter
		var loc = window.location.href;
		var arr = new Array();
		arr = loc.split("=");
		if (arr[1] == 'Tigazhazt_reklamaciok') {

		$.fn.delay = function(duration) {
		    $(this).animate({ donothing: 1 }, duration);
    		return this;
		};

		$("textarea[name='ZLEIRAS'][rows='10'][cols='40']").after('<div><span class="Tigaz_IUDesc">Karakterek száma: </span><span class="Tigaz_IUDesc" id="comp_counter" style="font-weight:bold;">0</span><span class="Tigaz_IUDesc">&nbsp;(max. 500)</span><br/><span id="comp_counter_msg"></span></div>').bind("focus keyup", function(){
			var n = this.value.length;
			if (n>500) {
				this.value = this.value.slice(0,500);
				var n = this.value.length;
				
				$("#comp_counter_msg").hide().html("<span class='Tigaz_IUTitle'>Kedves Ügyfelünk!</span><br/><span class='Tigaz_IUDesc'>Ön elérte az <em>500 karakteres határt</em>! Kérjük fogalmazza át üzenetét, szorítkozzon csak a tényekre.Amennyiben üzenetének megfogalmazása nagyobb terjedelmet igényel, úgy küldje azt az <a href='mailto:ugyfelszolgalat@tigaz.hu'>ugyfelszolgalat@tigaz.hu</a> e-mail címünkre.<br/>Köszönjük!</span>").slideDown().delay(7000).slideUp();
				$("#comp_counter").text(n);
				//return false;
			}
			$("#comp_counter").text(n);
		});
	}
		
	});  
