function on_body_load(){
    StartFunction();
}
var t_town=false;var t_mp2=false;var ON_START_FUNCTION=new Array();var ON_START_FUNCTION_WORK=false;ON_START_FUNCTION.push('preloadimages()');ON_START_FUNCTION.push('t0()');
function StartFunction(){
    while(ON_START_FUNCTION.length>0){
        if(!ON_START_FUNCTION_WORK){
            setTimeout('execute_('+ON_START_FUNCTION.pop()+');',1);
        }
    }
}
function execute_(fun){
    ON_START_FUNCTION_WORK=true;fun();ON_START_FUNCTION_WORK=false;
}
function add_fromswiss_to_kropka(id){}
function setbg(){
    if(document.body){
        document.body.style.backgroundImage='url('+bURL+'/css/bg.gif)';
    }
}
function back() {    
    history.back();
}
function is_numeric(n){
    return n>''&&isFinite(n)
}
function preloadimages(){

    preloadctrl(bURL+"menu/newbutton_ph.png");
    preloadctrl(bURL+"menu/newbutton_h.png");
    preloadctrl(bURL+"menu/newbutton.png");
    preloadctrl(bURL+"css/main/kropka.png");
    preloadctrl(bURL+"css/main/kropka1.png");
    preloadctrl(bURL+"css/button/h/rejestruj.png");
    preloadctrl(bURL+"css/button/h/zaloguj.png");
    preloadctrl(bURL+"css/top/ar.png");
    preloadctrl(bURL+"css/top/zaloguj.png");
    preloadctrl(bURL+"css/top/zaloguj2.png");
    preloadctrl(bURL+"css/top/wyloguj.png");
    preloadctrl(bURL+"css/top/wyloguj2.png");
    preloadctrl(bURL+"css/top/zwin.png");
    preloadctrl(bURL+"css/top/zwin2.png");
    preloadctrl(bURL+"css/top/rozwin.png");
    preloadctrl(bURL+"css/top/rozwin2.png");
    preloadctrl(bURL+"css/top/selbg.gif");
}

function t0(){
    if(Vmp){
        t1();
    }
    t4(true);
}
function t1(){
    t_mp2=!t_mp2;setTimeout("t2()",t_mp2?Hmp*2:15);t1A=new Tween(document.getElementById('mp2').style,'height',Tween.strongEaseOut,(t_mp2?0:Hmp),(t_mp2?Hmp:0),1,'px');t1A.start();
}
function t2(){
    document.getElementById('mp2div').style.display=(!t_mp2?'none':'block');document.getElementById('span3').style.backgroundImage='url('+bURL+(!t_mp2?'css/top/ar.png':"")+')';t3(true);
}
function t3(hover){    
    document.getElementById('span2').style.backgroundImage='url('+bURL+'css/top/'+(t_mp2?'zwin'+(hover?"2":"")+'.png':'rozwin'+(hover?"2":"")+'.png')+')';t4(true);
}
function t4(hover){    
    document.getElementById('span1').style.backgroundImage='url('+bURL+'css/top/'+(t_log?(!t_mp2?'zaloguj':'')+(hover?"2":"")+'.png':'wyloguj'+(hover?"2":"")+'.png')+')';
}
function t5(){
    t_town=!t_town;document.getElementById('seltown0').style.display=(!t_town?'none':'block');document.getElementById('seltown2').style.backgroundImage='url('+bURL+'css/top/select'+(!t_town?'a':'b')+'.png)';
}
function t6(etx){
window.scroll(0,0);
    var tx = "";
    if(!t_mp2) {
        t1();        
    }
    if (etx==1) {
        tx = "GALERIĘ";
    }
    if (etx==2) {
        tx = "MEDIA";
    }
    document.getElementById('error_login').innerHTML = "<p>Aby zobaczyć "+tx+" - musisz się zalogować !</p>";
    document.getElementById('access_login').innerHTML = "Dostęp Ograniczony!<br> TYLKO dla zarejestrowanych";
    
}
var tx_status = new Array();
function tx(id) {       
    tx_status[id]=!tx_status[id];    
    document.getElementById(id+'0').style.display = (!tx_status[id]?'none':'block');
    document.getElementById(id+'1e').style.display = (!tx_status[id]?'none':'block');
    //document.getElementById(id+'2').style.backgroundImage = 'url('+bURL+'css/top/select'+(!t_town?'a':'b')+'.png)';
}
function change_acapulcotv(code,title,user,avatar) {
    code = "http://www.youtube.com/v/"+code;
    var acapulcotv_atr = Array();
    acapulcotv_atr['bgcolor'] = "transparent";
    acapulcotv_atr['wmode'] = "transparent";
    acapulcotv_atr['flashvars'] = "yid="+code+"&";
    if (title.length>0) {acapulcotv_atr['flashvars']+= "ti="+title+"&";}
    if (user.length>0) {acapulcotv_atr['flashvars']+= "u="+user+"&";}
    if (avatar.length>0) {acapulcotv_atr['flashvars']+= "av="+avatar+"&"; }
    swfobject.embedSWF(bURL+"css/flash/tvacapulco.swf", "acapulcotv", "600", "311", "2.1.0", bURL+"css/expressInstall.swf","","",acapulcotv_atr);
}
function change_startgalery(mini,large,l1,l2,l3,l4) {
    document.getElementById('mainGalery2').style.backgroundImage = "url("+mini+")";
    document.getElementById('mainGalery1').href = large;
    document.getElementById('mgalery_1').innerHTML = l1;
    document.getElementById('mgalery_2').innerHTML = l2;
    document.getElementById('mgalery_3').innerHTML = l3;
    document.getElementById('mgalery_4').innerHTML = l4;
}

var hover_startgalery_buttn_stat = null;
function hover_startgalery(element,status,setto,imgurl) {
    var cl = "mask_n";
    if (hover_startgalery_buttn_stat ==element && status==0 ) {
        cl = "mask_p";
    }
    
    if (status==1) {
        cl = "mask_h";
    }
    if (status==2) {
        cl = "mask_p";
        if (hover_startgalery_buttn_stat!=null) {
            hover_startgalery_buttn_stat.setAttribute("class","mask_n");
            hover_startgalery_buttn_stat.setAttribute("className","mask_n");
            
        }
        hover_startgalery_buttn_stat = element;
    }
    element.setAttribute("class",cl);
    element.setAttribute("className",cl);
    if (setto!=null) {
        preloadctrl(imgurl);
        document.getElementById('galshow_'+setto).style.backgroundImage = 'url('+imgurl+')';
    }
}
var hover_startuser_buttn_stat = null;
function hover_startuser(element,status) {
    var cl = "usersmask_n";
    if ( status==1 ) {
        cl = "usersmask_p";
    }
    element.setAttribute("class",cl);
    element.setAttribute("className",cl);
    
    
}
function kropki_start(p) {
    myslide1.gostop();
}

var http_request = false;
function makeRequest(url,onready) {
    if (window.XMLHttpRequest) {
        http_request = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    http_request.onreadystatechange = onready;
    http_request.open('GET', url, true);
    http_request.send(null); // query string!
}

function captcha_refresh() {    
    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            document.getElementById('captcha').innerHTML = http_request.responseText;                        
        } else {
            alert('Problem z internetem? Spróbuj później!');
        }
    }
}

function get_hash() {
    var h=window.location.hash;
    h = (h.length>1) ? h.substr(1, h.length) : 0;
    return parseInt(h);
}

function uri_encode(unencoded) {
    return encodeURIComponent(unencoded);
}
function uri_decode(encoded) {
    return decodeURIComponent(encoded.replace(/\+/g,  " "));
}

