/************** fülcsekés doboz *********************/
function readyInitSetActiveContentInTabbedBox()
{
    initSetActiveContentInTabbedBox();
    $('a.tabChLink').click(function() {
        var contextId = $(this).parents('.tabBoxWrap')[0].id;
        boxNum = parseInt(contextId.replace('tabBox',''));
        tabNum = parseInt($(this)[0].id.replace('tabLink_'+boxNum+'_',''));
        setTabInfo(boxNum,tabNum);

        $('#'+contextId+' .tabChLink').removeClass('tabAct');
        $('#'+contextId+' .tabChLink').addClass('tabInact');
        $(this).removeClass('tabInact');
        $(this).addClass('tabAct');
        setActiveContentInTabbedBox(contextId);
        return false;
    });
}
function initSetActiveContentInTabbedBox()
{
    $('.tabBoxWrap').each(function(index) {
        setActiveContentInTabbedBox($(this)[0].id);
    });
}
function setActiveContentInTabbedBox(contextId)
{
    $('#'+contextId+' .tabChLink').each(function(index) {
        var helpid = $(this)[0].id;
        if ($(this).hasClass('tabAct')) {
            boxNum = parseInt(contextId.replace('tabBox',''));
            var contentid = helpid.replace('tabLink_'+boxNum+'_','tabContent');
            $('#'+contextId+' .tabContent').hide();
            $('#'+contextId+' .'+contentid).show();
            $('#'+contextId+' #'+helpid+' img').each(function(index) {
                if ($(this).attr('src')=='/i/tabbox/inactbal.gif') $(this).attr('src','/i/tabbox/actbal.gif');
                else if ($(this).attr('src')=='/i/tabbox/inactjobb.gif') $(this).attr('src','/i/tabbox/actjobb.gif');
            });
        }
        else {
            $('#'+contextId+' #'+helpid+' img').each(function(index) {
                if ($(this).attr('src')=='/i/tabbox/actbal.gif') $(this).attr('src','/i/tabbox/inactbal.gif');
                else if ($(this).attr('src')=='/i/tabbox/actjobb.gif') $(this).attr('src','/i/tabbox/inactjobb.gif');
            });
        }
    });
}
/************** számocskás doboz *********************/
function readyInitSetActiveContentInNumTabbedBox()
{
    initSetActiveContentInNumTabbedBox();
    $('a.tabNumChLink').click(function() {
        var contextId = $(this).parents('.tabNumBoxWrap')[0].id;
        boxNum = parseInt(contextId.replace('tabNumBox',''));
        tabNum = parseInt($(this)[0].id.replace('tabNumLink_'+boxNum+'_',''));
        setTabInfo(boxNum,tabNum);

        $('#'+contextId+' .tabNumChLink').removeClass('tabNumAct');
        $('#'+contextId+' .tabNumChLink').addClass('tabNumInact');
        $(this).removeClass('tabNumInact');
        $(this).addClass('tabNumAct');
        setActiveContentInNumTabbedBox(contextId);
        return false;
    });
}
function initSetActiveContentInNumTabbedBox()
{
    $('.tabNumBoxWrap').each(function(index) {
        setActiveContentInNumTabbedBox($(this)[0].id);
    });
}
function setActiveContentInNumTabbedBox(contextId)
{
    $('#'+contextId+' .tabNumChLink').each(function(index) {
        var helpid = $(this)[0].id;
        if ($(this).hasClass('tabNumAct')) {
            boxNum = parseInt(contextId.replace('tabNumBox',''));
            var contentid = helpid.replace('tabNumLink_'+boxNum+'_','tabNumContent');
            $('#'+contextId+' .tabNumContent').hide();
            $('#'+contextId+' .'+contentid).show();
        }
        else {
        }
    });
}
/************** zászlós doboz *********************/
function readyInitSetActiveContentInZaszloBox()
{
    initSetActiveContentInZaszloBox();
    $('.tabZaszloChLink').click(function() {
        var contextId = $(this).parents('.tabZaszloBoxWrap')[0].id;
        boxNum = parseInt(contextId.replace('tabNumBox',''));
        tabNum = parseInt($(this)[0].id.replace('tabNumLink_'+boxNum+'_',''));
        setTabInfo(boxNum,tabNum);

        $('#'+contextId+' .tabZaszloChLink').removeClass('tabZaszloAct');
        $('#'+contextId+' .tabZaszloChLink').addClass('tabZaszloInact');
        $(this).removeClass('tabZaszloInact');
        $(this).addClass('tabZaszloAct');
        setActiveContentInZaszloBox(contextId);
        return false;
    });
}
function initSetActiveContentInZaszloBox()
{
    $('.tabZaszloBoxWrap').each(function(index) {
        setActiveContentInZaszloBox($(this)[0].id);
    });
}
function setActiveContentInZaszloBox(contextId)
{
    $('#'+contextId+' .tabZaszloChLink').each(function(index) {
        var helpid = $(this)[0].id;
        if ($(this).hasClass('tabZaszloAct')) {
            boxNum = parseInt(contextId.replace('tabNumBox',''));
            var contentid = helpid.replace('tabNumLink_'+boxNum+'_','tabNumContent');
            $('#'+contextId+' .tabNumContent').hide();
            $('#'+contextId+' .'+contentid).show();
        }
        else {
        }
    });
    $('img.tabZaszloInact').css('opacity','0.5');
    $('img.tabZaszloAct').css('opacity','1');
}
/************** scrollos doboz *********************/
var animLeft = new Array;
var animWidth=138;
function readyInitAdjustArrowImgInScrollerBox()
{
        //var animHiddenNum = new Array;
        //animHiddenNum[1]=2;
        //animHiddenNum[2]=1;
        initAdjustArrowImgInScrollerBox();
        $('.scrollerArrowRight').click(function() {
            var contextId = $(this).parents('.scrollerDiv')[0].id;
            var id = parseInt(contextId.replace('scrollerDiv',''));
            if (animLeft[id]===undefined) animLeft[id]=0;
            if (animLeft[id]-animWidth<-animWidth*animHiddenNum[id]) return false;
            animLeft[id]-=animWidth;
            animHelp=animLeft[id];
            $('#'+contextId+' .scrollerInner').animate({left: animHelp }, 500);
            adjustArrowImgInScrollerBox(contextId);
        });
        $('.scrollerArrowLeft').click(function() {
            var contextId = $(this).parents('.scrollerDiv')[0].id;
            var id = parseInt(contextId.replace('scrollerDiv',''));
            if (animLeft[id]===undefined) animLeft[id]=0;
            if (0<animLeft[id]+animWidth) return false;
            animLeft[id]+=animWidth;
            animHelp=animLeft[id];
            $('#'+contextId+' .scrollerInner').animate({left: animHelp }, 500);
            adjustArrowImgInScrollerBox(contextId);
        });

}
function initAdjustArrowImgInScrollerBox()
{
    $('.scrollerDiv').each(function(index) {
        adjustArrowImgInScrollerBox($(this)[0].id);
    });
}
function adjustArrowImgInScrollerBox(contextId)
{
    var id = parseInt(contextId.replace('scrollerDiv',''));
    if (animLeft[id]===undefined) animLeft[id]=0;
    if (0<animLeft[id]+animWidth) {
        $('#'+contextId+' .scrollerArrowLeft').css('cursor','default');
        $('#'+contextId+' .scrollerArrowLeft').attr('src','/i/tabbox/left_inact.gif');
    }
    else {
        $('#'+contextId+' .scrollerArrowLeft').css('cursor','pointer');
        $('#'+contextId+' .scrollerArrowLeft').attr('src','/i/tabbox/left.gif');
    }
    if (animHiddenNum===undefined) animHiddenNum = new Array;
    if (animHiddenNum[id]===undefined) animHiddenNum[id]=1;
    if (animLeft[id]-animWidth<-animWidth*animHiddenNum[id]) {
        $('#'+contextId+' .scrollerArrowRight').css('cursor','default');
        $('#'+contextId+' .scrollerArrowRight').attr('src','/i/tabbox/right_inact.gif');
    }
    else {
        $('#'+contextId+' .scrollerArrowRight').css('cursor','pointer');
        $('#'+contextId+' .scrollerArrowRight').attr('src','/i/tabbox/right.gif');
    }
}
function adverticumCallback(zoneId,zoneWidth)
{
    id = zoneId.replace('advertSi69Id','');
    adWrap = '.adverticumAdWrap'+id;
    if (!$('#'+zoneId).html()) {
        if (zoneWidth==250) {
            $(adWrap).hide();
            $(adWrap).prev('div.adsep').hide();
            $('#'+zoneId).hide();
        }
        else if(zoneWidth==728) {
            $('#'+zoneId).html($('#adv728HiddenDiv').html());
        }
    }
}
function adverticum728Callback()
{
    console.log('itt');
    //$('#advert728Div').html($('#adv728HiddenDiv').html());
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function setTabMask(mask,posNum,posVal)
{
    mod = mask % Math.pow(10,posNum);
    ertek = Math.floor(mod / Math.pow(10,posNum-1));
    clearedMask = mask - ertek * Math.pow(10,posNum-1);
    newMask = clearedMask + posVal * Math.pow(10,posNum-1);
    return newMask;
}
function setTabInfo(boxNum,tabNum)
{
    origTabCook = parseInt(readCookie('tabinfocookie'));
    if (!origTabCook) origTabCook=1111111111;//10 jegyű
    newMask = setTabMask(origTabCook,boxNum,tabNum);
    createCookie('tabinfocookie',newMask,14);
}
function getSelTabIdx(mask,posNum)
{
    mod = mask % Math.pow(10,posNum);
    ertek = Math.floor(mod / Math.pow(10,posNum-1));
    return ertek;
}
function selectTabFromCookie()
{
    origTabCook = parseInt(readCookie('tabinfocookie'));
    if (!origTabCook) return;
    $('.tabBoxWrap').each(function(index) {
        var contextId = $(this)[0].id;
        boxNum = parseInt(contextId.replace('tabBox',''));
        tabNum = getSelTabIdx(origTabCook,boxNum);
        $('#'+contextId+' .tabAct').removeClass('tabAct').addClass('tabInact');
        $('#'+contextId+' #tabLink_'+boxNum+'_'+tabNum).removeClass('tabInact').addClass('tabAct');
        setActiveContentInTabbedBox(contextId);
    });
    $('.tabNumBoxWrap').each(function(index) {
        var contextId = $(this)[0].id;
        boxNum = parseInt(contextId.replace('tabNumBox',''));
        tabNum = getSelTabIdx(origTabCook,boxNum);
        $('#'+contextId+' .tabNumAct').removeClass('tabNumAct').addClass('tabNumInact');
        $('#'+contextId+' #tabNumLink_'+boxNum+'_'+tabNum).removeClass('tabNumInact').addClass('tabNumAct');
        setActiveContentInNumTabbedBox(contextId);
    });
    $('.tabZaszloBoxWrap').each(function(index) {
        var contextId = $(this)[0].id;
        boxNum = parseInt(contextId.replace('tabNumBox',''));
        tabNum = getSelTabIdx(origTabCook,boxNum);
        $('#'+contextId+' .tabZaszloAct').removeClass('tabZaszloAct').addClass('tabZaszloInact');
        $('#'+contextId+' #tabNumLink_'+boxNum+'_'+tabNum).removeClass('tabZaszloInact').addClass('tabZaszloAct');
        setActiveContentInZaszloBox(contextId);
    });
}
$(document).ready(function() {
    $('#printpop_0').click(function() {
        var newWin = window.open('/norobot/printinfo/','printpop','status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,width=600,height=400');
        newWin.focus();
        return false;

    });
});
var isSlideMenuOpen = false;
var initSlideMenuHeight = 0;
$(document).ready(function() {
    $('#slideMenuOpener').click(function() {
        if ($('#slideMenuContent a').css('display')=='none') {
            $('#slideMenuContent a').css('display','block');
            $('#slideMenuOpener').html('Bezár');
            $('#portal3ColLeft').css('padding-top',180);
        }
        else {
            $('#slideMenuContent a').css('display','none');
            $('#slideMenuOpener').html('Kinyit');
            $('#portal3ColLeft').css('padding-top',0);
        }
    });
    $('a[href^="http"]').click(function() {
        var url = $(this).attr('href');
        if (!url.match(/^http:\//)) return;
        if (url.match(/^http:\/\/localsi/)) return;
        if (url.match(/^http:\/\/sielok.hu/)) return;
        if (url.match(/^http:\/\/www.sielok.hu/)) return;

        if (typeof(_gaq) != "undefined") _gaq.push(['_trackEvent', 'outgoing', 'click', url]);

        $.get('/outgoing/'+url);
    });
});
$(document).ready(function() {
   $(".imgHoverable").hover( function() {
       var hoverImg = HoverImgOf($(this).attr("src"));
       $(this).attr("src", hoverImg);
     }, function() {
       var normalImg = NormalImgOf($(this).attr("src"));
       $(this).attr("src", normalImg);
     }
   );
});
function HoverImgOf(filename)
{
   var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1_hover.$2");
}
function NormalImgOf(filename)
{
   var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1.$2");
}
$(document).ready(function() {
    $('.multiida').click(function() {
        var partr = $(this).closest('tr');
        partr.children('td').each(
            function() {
                if ($(this).attr('class')=='multiidact') {
                    $(this).attr('class','cell');
                }
                else {
                    $(this).attr('class','multiidact');
                }
        }); 
    });
});
$(document).ready(function() {
    function addMega(){
        $(this).addClass("hovering");
    }
    function removeMega(){
        $(this).removeClass("hovering");
    }
    var megaConfig = {
         interval: 0,
         sensitivity: 7,
         over: addMega,
         timeout: 0,
         out: removeMega
    };
    $(".megamenu_wrap").hoverIntent(megaConfig);
});
$(document).ready(function() {
    var zIndexNumber = 1000;
    function add2Mega(){
        if (zIndexNumber==1000) {
            $('#headWrap_hu div').each(function() {
                $(this).css('zIndex', zIndexNumber);
                zIndexNumber -= 10;
            });
        }
                
        $(this).addClass("hovering");
        $(this).css('zIndex',1000);
    }
    function remove2Mega(){
        $(this).removeClass("hovering");
    }
    var mega2Config = {
         interval: 0,
         sensitivity: 7,
         over: add2Mega,
         timeout: 0,
         out: remove2Mega
    };
    $(".mega2menu_wrap").hoverIntent(mega2Config);
});
$(document).ready(function() {
    var zIndexNumber = 1000;
    function add3Mega(){
        if (zIndexNumber==1000) {
            $('#headWrap_hu div').each(function() {
                $(this).css('zIndex', zIndexNumber);
                zIndexNumber -= 10;
            });
        }
        $(this).addClass("hovering");
        $(this).css('zIndex',1000);
    }
    function remove3Mega(){
        $(this).removeClass("hovering");
    }
    var mega3Config = {
         interval: 0,
         sensitivity: 7,
         over: add3Mega,
         timeout: 0,
         out: remove3Mega
    };
    $(".profilmega_wrap").hoverIntent(mega3Config);
});
/*<table class='gorumTable1' style='width: 100%;'>*/

$(document).ready(function() {
   $("tr.gorumDataRowClass").hover( function() {
       $(this).children('td').addClass('gorumtrhover');
     }, function() {
       $(this).children('td').removeClass('gorumtrhover');
     }
   );
});
$(document).ready(function() {
   $("tr.gorumDataRowClass").click( function() {
       if ($(this).hasClass('tractivated')) {
            $(this).removeClass('tractivated');
            $(this).children('td').removeClass('gorumtractive');
       }
       else {
            $(this).addClass('tractivated');
            $(this).children('td').addClass('gorumtractive');
       }
   });
});

