// functions
var hideHelp = function() {
    if(!this.label) this.label = this.value;
    if(this.value == this.label) this.value = '';
}

var showHelp = function() {
    if(this.value == '') this.value = this.label;
}


// start
window.addEvent('load', function() {
    $$('#nav').setStyle('overflow', 'visible'); // IE jinak zobrazi podsebou vsechny tri stavy navigace
});

window.addEvent('domready', function() {

/* cufon START */
if (typeof Cufon!='undefined' )
{
if (Cufon && Cufon.replace) {
	Cufon.replace('div#news h4');
	/* -- all the changes? -- */
}
}
/* cufon END */

    // slimbox init
    $$(document.links).filter(function(el) {
		return el.rel && el.rel.test(/^lightbox/i);
	}).slimbox({/* Put custom options here */}, null, function(el) {
		return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
	});
    
    // target blank
    $$('a.targetblank').addEvent('click', function(event){
        if(typeof window.open(this.href)=='object') event.stop();
    });

    // form validator
    var form_validation = new FormValidation({
        default_border : '1px solid #a3a3a3'
    });
    /*
    // napovedy inputu
    $$('#f_search').addEvent('click', hideHelp).addEvent('blur', showHelp);
    $$('#f_user_name').addEvent('click', hideHelp).addEvent('blur', showHelp);
    $$('#f_user_password').addEvent('click', hideHelp).addEvent('blur', showHelp);
    */
	// napovedy inputu -UPRAVIL HLADIK 20090818
    $$('#f_search').addEvent('focus', hideHelp).addEvent('blur', showHelp);
    $$('#f_user_name').addEvent('focus', hideHelp).addEvent('blur', showHelp);
    $$('#f_user_password').addEvent('focus', hideHelp).addEvent('blur', showHelp);
    
    // nav
    tmp = $('nav');
    if(tmp) {
        for(var i=0,len=tmp.childNodes.length; i < len; i++) {
            $$(tmp.childNodes[i]).addEvent('mouseover', function() {
                if(this.childNodes[1]) this.childNodes[1].style.visibility = 'visible';
            });
            $$(tmp.childNodes[i]).addEvent('mouseout', function() {
                if(this.childNodes[1]) this.childNodes[1].style.visibility = 'hidden';
            });
        }
    }
});

