/******************* képernyő koordinátáinak meghatározása *****************/
function f_clientWidth() {
    return f_filterResults (
        window.innerWidth ? window.innerWidth : 0,
        document.documentElement ? document.documentElement.clientWidth : 0,
        document.body ? document.body.clientWidth : 0
    );
}
function f_clientHeight() {
    return f_filterResults (
        window.innerHeight ? window.innerHeight : 0,
        document.documentElement ? document.documentElement.clientHeight : 0,
        document.body ? document.body.clientHeight : 0
    );
}
function f_scrollLeft() {
    return f_filterResults (
        window.pageXOffset ? window.pageXOffset : 0,
        document.documentElement ? document.documentElement.scrollLeft : 0,
        document.body ? document.body.scrollLeft : 0
    );
}
function f_scrollTop() {
    return f_filterResults (
        window.pageYOffset ? window.pageYOffset : 0,
        document.documentElement ? document.documentElement.scrollTop : 0,
        document.body ? document.body.scrollTop : 0
    );
}
function f_filterResults(n_win, n_docel, n_body) {
    var n_result = n_win ? n_win : 0;
    if (n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
/******************* light view ablak *****************/
function show_lw(param) {
    lw_bg = 'lw_bg'+param;
    lightview = 'lightview'+param;

    yScroll = f_scrollTop();

    ySize = f_clientHeight();
    yCenter = ySize/2+yScroll;
    xSize = f_clientWidth();
    xCenter = xSize/2;
    
    //hack
    if(!yScroll){
        h1 = window.innerHeight ? window.innerHeight : 0;
        h2 = document.documentElement ? document.documentElement.clientHeight : 0;
        h3 = document.body ? document.body.clientHeight : 0;
            
        if(h1>=h2 && h1>=h3){
            lwh = h1;     
        }else if(h2>=h1 && h2>=h3){
            lwh = h2;     
        }else if(h3>=h1 && h3>=h2){
            lwh = h3;     
        }
    }else{
        lwh = (ySize+yScroll<document.getElementById('main').offsetHeight) ? document.getElementById('main').offsetHeight : ySize+yScroll;
    }

    document.getElementById(lw_bg).style.display = 'block';
    document.getElementById(lightview).style.display = 'block';
    
    xSizeDiv = document.getElementById(lightview).offsetWidth;
    ySizeDiv = document.getElementById(lightview).offsetHeight;     
    
    x = parseInt(xCenter-(xSizeDiv/2));
    y = parseInt(yCenter-(ySizeDiv/2));
    
    
    document.getElementById(lw_bg).style.top = 0;
    document.getElementById(lw_bg).style.left = 0;
    document.getElementById(lw_bg).style.width = xSize+'px';
    document.getElementById(lw_bg).style.height = lwh+'px';   
    
    document.getElementById(lightview).style.left = x+'px';
    document.getElementById(lightview).style.top = y+'px';
    //document.getElementById(lightview).style.width = '600px';
    
    new Draggable('lightview'+param, {handle : 'drag'});
}

function close_lw(param){
    lw_bg = 'lw_bg'+param;
    lightview = 'lightview'+param;

    displaynone(lw_bg);
    displaynone(lightview);
}
function displayblock(div){
    document.getElementById(div).style.display = "block" ;
}
function displaynone(div){
    document.getElementById(div).style.display = "none" ;
}
function showflash(file,width,height,bgcolor){
    document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+width+'\" height=\"'+height+'\">');
    document.write('<param name=\"allowScriptAccess\" value=\"always\" />');
    document.write('<param name=\"movie\" value=\"'+file+'\" />');
    document.write('<param name=\"quality\" value=\"high\" />');
    document.write('<param name=\"bgcolor\" value=\"'+bgcolor+'\" />');
    document.write('<param name=\"swliveconnect\" value=\"true\" />');
    document.write('<param name=\"menu\" value=\"false\" />');
    document.write('<param name="wmode" value="transparent">');
    document.write('<embed src=\"'+file+'\" wmode=\"transparent\" quality=\"high\" bgcolor=\"'+bgcolor+'\" width=\"'+width+'\" height=\"'+height+'\" wmode=\"transparent\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\"  swliveconnect=\"true\" menu=\"false\"/>');
    document.write('</object>');    
}
function open_window(url) {
    window.open(url, "Help", "top=0,left=0,width=540,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0");
}
function open_claim() {
    window.open("claim.php", "Help", "top=0,left=0,width=800,height=500,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0");
}
function open_help() {
    document.getElementById('open_help').style.display = "none" ;
    document.getElementById('help_content').style.display = "block" ;
    document.getElementById('help_box').style.height = '230px' ;
    document.getElementById('main').style.background = "url(style/pics/main_bg.gif) left top repeat-x" ;
    document.getElementById('close_help').style.display = "block" ;
}
function close_help() {
    document.getElementById('close_help').style.display = "none" ;
    document.getElementById('help_content').style.display = "none" ;
    document.getElementById('help_box').style.height = '30px' ;
    document.getElementById('main').style.background = "url(style/pics/main_mini_bg.gif) left top repeat-x" ;
    document.getElementById('open_help').style.display = "block" ;
}

function show_template(img) {
    value = (img) ? '<img alt="" src="'+img+'" />' : '';
    window.setTimeout("document.getElementById('showbox').innerHTML = value",100);
}

var t = null;
var s = 0;
function step(active_step, stop){
    if(stop!=s) return false;
    for(i=1; i<=5; i++){
        document.getElementById('step_'+i).style.display = (i==active_step ? 'block' : 'none');        
        document.getElementById('mm'+i).className = (i==active_step ? 'active' : 'inactive');        
    }
    if(s!=1){
        active = (active_step == 5) ? 1 : active_step+1 ;
        t = setTimeout('step('+active+',0)',8000);
    }
}

