
function setResolution(){
    if (screen.width > 1024 || screen.height > 768) {
        document.write("<style>body{ background-image: url(ImagesNews/BgrVersion_7_1280x1024.png);  background-position: top left; background-repeat: repeat; background-attachment:fixed; }</style>");
    }
    
}

/**
 * @ Infovip jsparser v 1.01
 * @ Egyszeru parser ertelmezo felhasznalok altal szerkesztett menuk
 * @ headerjenek kicserelese
 * @ Lehetseges ertekek : (String)  magazinMenuHeaderLink, klubMenusHeader, blogMenusHeader
 **/
function JS_SignalReady(){
    var ob_Main_Parse_Data = document.getElementsByTagName("jsParseSignal");
    var parse_Length = ob_Main_Parse_Data.length - 1;
    var swf_data = new String();
    var lwidth;
    var lheight;
    var is_Exists = false;
    var div_Name = new String();
    var ltds;
    var exists_Td = false;
    for (var i = 0; i <= parse_Length; i++) {
        if (ob_Main_Parse_Data[i].getAttribute('type')) {
            if (ob_Main_Parse_Data[i].getAttribute('type') == 'head') {
                if (ob_Main_Parse_Data[i].getAttribute('getId') && ob_Main_Parse_Data[i].getAttribute('width') && ob_Main_Parse_Data[i].getAttribute('height') && ob_Main_Parse_Data[i].getAttribute('swfurl')) {
                    if (ob_Main_Parse_Data[i].getAttribute('getId') == 'magazinMenuHeaderLink') {
                        lwidth = ob_Main_Parse_Data[i].getAttribute('width').toString();
                        lheight = ob_Main_Parse_Data[i].getAttribute('height').toString();
                        lurl = ob_Main_Parse_Data[i].getAttribute('swfurl').toString();
                        swf_data = '<object width="' + lwidth + '" height="' + lheight + '">';
                        swf_data += '<param name="movie" value="' + lurl + '">';
                        swf_data += '<embed src="' + lurl + '" width="' + lwidth + '" height="' + lheight + '">';
                        swf_data += '</embed>';
                        swf_data += '</object>';
                        is_Exists = true;
                        div_Name = "magazinMenuHeaderLink";
                    }
                    
                    else 
                        if (ob_Main_Parse_Data[i].getAttribute('getId') == 'klubMenusHeader') {
                            lwidth = ob_Main_Parse_Data[i].getAttribute('width').toString();
                            lheight = ob_Main_Parse_Data[i].getAttribute('height').toString();
                            lurl = ob_Main_Parse_Data[i].getAttribute('swfurl').toString();
                            swf_data = '<object width="' + lwidth + '" height="' + lheight + '">';
                            swf_data += '<param name="movie" value="' + lurl + '">';
                            swf_data += '<embed src="' + lurl + '" width="' + lwidth + '" height="' + lheight + '">';
                            swf_data += '</embed>';
                            swf_data += '</object>';
                            is_Exists = true;
                            div_Name = "klubMenusHeader";
                        }
                        
                        else 
                            if (ob_Main_Parse_Data[i].getAttribute('getId') == 'blogMenusHeader') {
                                lwidth = ob_Main_Parse_Data[i].getAttribute('width').toString();
                                lheight = ob_Main_Parse_Data[i].getAttribute('height').toString();
                                lurl = ob_Main_Parse_Data[i].getAttribute('swfurl').toString();
                                swf_data = '<object width="' + lwidth + '" height="' + lheight + '">';
                                swf_data += '<param name="movie" value="' + lurl + '">';
                                swf_data += '<embed src="' + lurl + '" width="' + lwidth + '" height="' + lheight + '">';
                                swf_data += '</embed>';
                                swf_data += '</object>';
                                is_Exists = true;
                                div_Name = "blogMenusHeader";
                            }
                }
                
                
            }
            
            if (ob_Main_Parse_Data[i].getAttribute('type') == 'text') {
                if (ob_Main_Parse_Data[i].getAttribute('menu')) {
                    if (ob_Main_Parse_Data[i].getAttribute('menu') == 'blog') {
                        menusElements = ob_Main_Parse_Data[i].getElementsByTagName('text');
                        for (var x = 0; x <= (menusElements.length - 1); x++) {
                        
                        }
                    }
                }
            }
            
        }
    }
    
    if (is_Exists == true) {
        /** ha nincs table **/
        
        ltds = document.getElementsByTagName("td");
        for (var i = 0; i <= (ltds.length - 1); i++) {
            if (ltds[i].getAttribute('id') == div_Name) {
                ob_Is = ltds[i];
                ob_Is.innerHTML = swf_data;
                exists_Td = true;
            }
        }
        
        /** ha van tabla **/
        if (exists_Td == false) {
            ltds = document.getElementsByTagName("table");
            for (var i = 0; i <= (ltds.length - 1); i++) {
                if (ltds[i].getAttribute('id') == div_Name) {
                    if (ltds[i].getElementsByTagName("td")) {
                        ob_Is = ltds[i].getElementsByTagName("td");
                        ob_Is[0].innerHTML = swf_data;
                    }
                }
            }
        }
        
        
        /** ha nincs se tabla id se td id akkor csak class van **/
        
        ltds = document.getElementsByTagName("table");
        for (var i = 0; i <= (ltds.length - 1); i++) {
            if (ltds[i].getAttribute('class') == div_Name) {
                if (ltds[i].getElementsByTagName("td")) {
                    ob_Is = ltds[i].getElementsByTagName("td");
                    ob_Is[0].innerHTML = swf_data;
                }
            }
        }
        
        
    }
}


function reSetGlobalTablesFonts(){
    $(document).find("table").each(function(){
        if ($(this).attr('class') != null) {
            if ($(this).attr('class') == 'mainPageHeader') {
                $(this).find('tr').find('td').each(function(){
                
                    if ($(this).attr('class') != null) {
                        if ($(this).attr('class') == 'mainHeader') {
                            if ($(this).attr('style') != null) {
                                if ($(this).attr('style').indexOf('ImagesNews/box_head_1.gif') == -1) {
                                    $(this).attr('style', 'color:#FFFFFF;font-family:Arial,Sans-Serif;font-size:14px;font-weight:bold;padding-left:10px;');
                                }
                            }
                            else {
                                $(this).attr('style', 'color:#FFFFFF;font-family:Arial,Sans-Serif;font-size:14px;font-weight:bold;padding-left:10px;');
                            }
                        }
                    }
                });
            }
        }
    });
    
    
    
    $(document).find("table").each(function(){
        if ($(this).attr('id') != null) {
            if ($(this).attr('id') == 'listHeader') {
                $(this).find('tr').find('td').each(function(){
                
                    if ($(this).attr('class') != null) {
                        if ($(this).attr('class') == 'mainHeader') {
                            $(this).attr('style', 'font-size:15px;font-weight:bold;');
                        }
                    }
                });
            }
        }
    });
    
    
    $(document).find("table").each(function(){
    
        if ($(this).attr('style') != null) {
            if ($(this).attr('style').indexOf('ImagesNews/header/tbar_bg.png') != -1) {
                $(this).find('tr').find('td').each(function(){
                    if ($(this).attr('style') != null) {
                        if ($(this).attr('style').indexOf('ImagesNews/box_head_1.gif') == -1) {
                            $(this).attr('style', 'color:#FFFFFF;font-family:Arial,Sans-Serif;font-size:14px;font-weight:bold;padding-left:10px;');
                        }
                    }
                    else {
                        $(this).attr('style', 'color:#FFFFFF;font-family:Arial,Sans-Serif;font-size:14px;font-weight:bold;padding-left:10px;');
                    }
                });
            }
        }
    });
}

function reSetSubmitButton(){
    $("input[type='submit']").attr('class', 'buttonS');
    $("input[type='button']").attr('class', 'buttonS');
    
    $(document).find("input").each(function(){
        if ($(this).attr("type")) {
            if ($(this).attr("type") == "button") {
                if ($(this).attr("style")) {
                    //if ( $(this).attr('style').indexOf('background-image') == -1 ) 
                    //{
                    //$(this).attr('style','margin-top: 2px; margin-bottom: 2px; border: 1px dotted black; font-size: 12px; background-color: white; margin: 2px;');
                    if ($(this).attr('value') != null) {
                        if ($(this).attr('value').indexOf('+') == -1) {
                            if ($(this).attr('value').length < 10) {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button1_v3.png); background-color: transparent; width: 90px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5; ');
                            }
                            else {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button2large_v3.png); background-color: transparent; width: 140px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5; ');
                            }
                        }
                        
                        if ($(this).attr('value').length > 25) {
                            $(this).attr('value', 'Mentés');
                        }
                    }
                    //}
                }
                else {
                    //$(this).attr('style','margin-top: 2px; margin-bottom: 2px; border: 1px dotted black; font-size: 12px; background-color: white; margin: 2px;');
                    if ($(this).attr('value') != null) {
                        if ($(this).attr('value').indexOf('+') == -1) {
                            if ($(this).attr('value').length < 10) {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button1_v3.png); background-color: transparent; width: 90px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5;');
                            }
                            else {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button2large_v3.png); background-color: transparent; width: 140px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5;');
                            }
                        }
                        
                        if ($(this).attr('value').length > 20) {
                            $(this).attr('value', 'Mentés');
                        }
                    }
                }
            }
            
            if ($(this).attr("type") == "submit") {
                if ($(this).attr("style")) {
                    //if ( $(this).attr('style').indexOf('background-image') == -1 ) 
                    //{
                    //$(this).attr('style','margin-top: 2px; margin-bottom: 2px; border: 1px dotted black; font-size: 12px; background-color: white; margin: 2px;');
                    if ($(this).attr('value') != null) {
                        if ($(this).attr('value').indexOf('+') == -1) {
                            if ($(this).attr('value').length < 10) {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button1_v3.png); background-color: transparent; width: 90px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5;');
                            }
                            else {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button2large_v3.png); background-color: transparent; width: 140px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5;');
                            }
                        }
                        
                        if ($(this).attr('value').length > 20) {
                            $(this).attr('value', 'Mentés');
                        }
                    }
                    //}
                }
                else {
                    //$(this).attr('style','margin-top: 2px; margin-bottom: 2px; border: 1px dotted black; font-size: 12px; background-color: white; margin: 2px;');
                    if ($(this).attr('value') != null) {
                        if ($(this).attr('value').indexOf('+') == -1) {
                            if ($(this).attr('value').length < 10) {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button1_v3.png); background-color: transparent; width: 90px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5;');
                            }
                            else {
                                $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button2large_v3.png); background-color: transparent; width: 140px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #D1D5D5; ');
                            }
                        }
                        
                        if ($(this).attr('value').length > 20) {
                            $(this).attr('value', 'Mentés');
                        }
                    }
                }
            }
            
        }
    });
    
    
    if (navigator.userAgent.indexOf('MSIE') != -1) {
    
        //$("input[type='button']").attr('style','margin-top: 2px; margin-bottom: 2px; border: 1px dotted black; font-size: 12px; background-color: white; margin: 2px;');
        //$("input[type='submit']").attr('style','margin-top: 2px; margin-bottom: 2px; border: 1px dotted black; font-size: 12px; background-color: white; margin: 2px;');
        //$("input[type='button']").attr('style','margin-top: 2px; border: 0px hidden black; margin-bottom: 2px;  font-size: 12px; background-image: url(images/button/button1.png); width: 120px; height: 30px; margin: 2px;');
        //$("input[type='submit']").attr('style','margin-top: 2px; border: 0px hidden black; margin-bottom: 2px;  font-size: 12px; background-color: url(images/button/button1.png); width: 120px; height: 30px; margin: 2px;');
        if ($(this).attr('value') != null) {
            if ($(this).attr('value').indexOf('+') == -1) {
                if ($(this).attr('value') != null && $(this).attr('value').length < 10 && $(this).attr('value').indexOf('+') == -1) {
                    $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button1_v3.png); background-color: transparent; width: 90px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #BBBBBB;');
                }
                else {
                    if ($(this).attr('value').indexOf('+') == -1) {
                        $(this).attr('style', 'margin-top: 0px; margin-bottom: 0px; border: 0px hidden black;  background-image: url(images/button/button2large_v3.png); background-color: transparent; width: 140px; height: 23px; font-size: 12px; margin: 2px;margin-top: 0px; margin-bottom: 0px; border: 1px solid #BBBBBB;');
                    }
                }
            }
            
            if ($(this).attr('value').length > 20) {
                $(this).attr('value', 'Mentés');
            }
        }
    }
    
    
    
}




/******************************
 *  @Input gombok beallitasa
 ******************************/
$(document).ready(function(){
    reSetSubmitButton();
    JS_SignalReady();
    reSetGlobalTablesFonts();
});


/** 
 * @ Button changer
 **/
function changeClassForInputs(){
}



function getElementPosition(elem){
    var position = new Object();
    position.x = position.y = 0;
    if (elem.style.position == 'absolute' && elem.style.posWidth >= 0) {
        position.width = parseInt(elem.style.posWidth);
        position.height = parseInt(elem.style.posHeight);
    }
    else {
        position.width = parseInt(elem.offsetWidth);
        position.height = parseInt(elem.offsetHeight);
    }
    
    while (elem) {
        if (elem.style.position == 'absolute' && elem.style.posLeft >= 0) {
            position.x += parseInt(elem.style.posLeft);
            position.y += parseInt(elem.style.posTop);
        }
        else {
            position.x += parseInt(elem.offsetLeft);
            position.y += parseInt(elem.offsetTop);
        }
        elem = elem.offsetParent;
    }
    return position;
}


function closeUserImage(){
    var elem1 = document.getElementById('userImageJs1');
    var elem2 = document.getElementById('userImageJs2');
    $("userImageJs1").fadeOut('slow');
    $("userImageJs2").fadeOut('slow');
    elem1.style.visibility = 'hidden';
    elem2.style.visibility = 'hidden';
    
}


var mouseX = 0;
var mouseY = 0;

var alertWindowIsExists = false;

function getMouseXY(e){
    if (alertWindowIsExists == true) {
        var IE = document.all ? true : false;
        if (!IE) 
            document.captureEvents(Event.MOUSEMOVE);
        if (IE) {
            mouseX = event.clientX + document.body.scrollLeft;
            mouseY = event.clientY + document.body.scrollTop;
        }
        else {
            mouseX = e.pageX;
            mouseY = e.pageY;
        }
        if (mouseX < 0) {
            mouseX = 0;
        }
        if (mouseY < 0) {
            mouseY = 0;
        }
        return true;
    }
}


if (alertWindowIsExists) {

}

//onmousemove='showAlertWindow(\"abcde\");'  onmouseout='hideAlertWindow();'
function hideAlertWindow(){
    if (document.getElementById("showAlertWindow")) {
        document.onmousmove = function(){
            return null;
        }
        alertWindowIsExists = false;
        document.getElementById("showAlertWindow").style.visibility = 'hidden';
        document.getElementById("alertWindow").innerHTML = "";
        
    }
}

function showAlertWindow(data){

    alertWindowIsExists = true;
    if (alertWindowIsExists == true) {
        document.onmousemove = getMouseXY;
    }
    if (data) {
        if (document.getElementById("showAlertWindow")) {
            document.getElementById("showAlertWindow").style.display = "block";
            document.getElementById("showAlertWindow").style.top = mouseY + "px";
            document.getElementById("showAlertWindow").style.left = mouseX + 20 + "px";
            document.getElementById("showAlertWindow").style.visibility = 'visible';
            document.getElementById("alertWindow").innerHTML = data;
        }
    }
}



function showUserImage(obj, imageData){
    if (imageData && obj) {
    
        var position = getElementPosition(obj);
        if (position.x < (document.body.clientWidth / 2)) {
        
            var divO = document.getElementById('userImageJs1');
            var divUsImage = document.getElementById('userShowImage1');
            divUsImage.style.display = "none";
            divUsImage.innerHTML = imageData;
            //alert(position.y);
            //alert(position.x);
            divO.style.left = position.x + position.width + 20 + "px";
            divO.style.top = position.y - 10 + "px";
            divO.style.visibility = 'visible';
            $("#userShowImage1").fadeIn("slow");
            
        }
        else {
        
            var divO = document.getElementById('userImageJs2');
            var divUsImage = document.getElementById('userShowImage2');
            divUsImage.style.display = "none";
            divUsImage.innerHTML = imageData;
            //divO.style.left = position.x + position.width - parseInt(divO.offsetWidth) - 20 ;
            divO.style.left = position.x + position.width + 20;
            divO.style.top = position.y;
            divO.style.visibility = 'visible';
            $("#userShowImage2").fadeIn("slow");
            
        }
        
        
        
    }
    
}


var bgrIs = new Object();
bgrIs = function(typeIs, Value){
    if (!typeIs) 
        return;
    if (typeIs) {
        if (typeIs == 'color') {
            document.body.style.background = Value;
            if (document.getElementById("MainTableDivCss")) 
                document.getElementById("MainTableDivCss").style.background = Value;
        }
        else 
            if (typeIs == 'image') {
                document.body.style.background = "beige url(" + Value + ")";
                if (document.getElementById("MainTableDivCss")) 
                    document.getElementById("MainTableDivCss").style.background = "beige url(" + Value + ")";
                
            }
        
    }
    
}


function isConfirm(question, paramet){
    if (question && paramet) {
        var isConf = confirm(question);
        if (isConf == true) {
            window.location = paramet;
        }
    }
}


function open_smiley_box(area_id){
    window.open("function/toolbox.php?menu=toolbox&area=" + area_id, "Toolbox", "width=340,height=600,resizable=yes,scrollbars=yes");
}

function picture_src(picture_name, src_id){
    document.getElementById(src_id).src = picture_name;
}

function gotoIs(location_is){
    if (!location_is) 
        return;
    self.location = location_is;
}

function back(){
    history.back(-1);
}




$(document).ready(function(){
    //$("input[type='checkbox']").attr('style','background-color:white;border:1px solid black;');	
    $('a[rel=lightbox]').lightBox();
});




