var qDefault = false;

$(document).ready(function()
{
    $('#q').focus(function() {
        if (qDefault) {
            $('#q').val('');
	    $('#q').css('background', 'white');
            qDefault = false;
        }
    });
    $('#q').blur(function() {
        if ($('#q').val() == '') {
            $('#q').val('Vyhledávat...');
	    $('#q').css('background', 'white url(/images/lupe.gif) no-repeat 313px center');
            qDefault = true;
        }

    });
    $('#q').trigger('blur');
    $("#homepagePopupFlash").dialog({
	autoOpen: false,
	position: "center",
	modal: "true",
	resizable: "false",
	draggable: "false",
	width: 1012,
	height: 600,
	close: function() { $('.topFlash').show(); }
    });
});

/**
 * zoomovací okno s obrázkem
 */
function zoom(url, w, h)
{
	var ww = w;
	var wh = h;
	var scrl = 'no';
	if (ww > 1000){ww = 1000; scrl = 'yes';};
	if (wh > 700){wh = 700; scrl = 'yes';};
	var l = screen.width/2-ww/2;
	var t = screen.height/2-wh/2-50;
	if (l<0) l = 0;
	if (t<0) t = 0;

	var title = 'Allianz » Obrázek';
	var alt = 'Kliknutím zavřete okno...';

	var o = window.open('','zoomwin','status=no,width='+ww+',height='+wh+',resizable=no,menubar=no,location=no,scrollbars='+scrl+',toolbar=no,left='+l+',top='+t+'');

	d = o.document;
	d.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
	d.writeln('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">');
	d.writeln('<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>');
	d.writeln('<title>'+title+'</title>');
	d.writeln('<style type="text/css" media="screen">');
	d.writeln('BODY{margin: 0px; padding: 0px;}');
	d.writeln('IMG{margin: 0px; padding: 0px; border: 0px solid black; display:block;}');
	d.writeln('</style>');
	d.write('<body >');
	d.write  ('<a href="javascript:close()">');
	d.write  ('<img src="'+url+'" width="'+w+'" height="'+h+'" border="0" hspace="0" vspace="0" alt="" title="'+alt+'">');
	d.write('</a>');
	d.write('</body>')
	d.writeln('</html>');
	d.close();
	d.title = title;
	o.focus();
}


function fotoWindow(url)
{
    //lefti = (window.screen.width / 2) - (width / 2);
    //topi = (window.screen.height / 2) - (height / 2);

    window.open(url, 'fotowindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=1,dependent=no,width=600,height=600');

    return false;
}

function HelpWindow(w)
{
	window.open("","help","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + w + ",height=400,left=20,top=20");
}

function isEmail(s)
///{{{
{
	s += "";
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)");
	var r2 = new RegExp("^[a-zA-Z0-9\\-\\.]+\\@[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,4}$");
	if (r1.test(s) || !r2.test(s))
		return false;
	return true;
}
///}}}

function doporucit_krok2(frm)
///{{{
{
	if (!isEmail(frm.email_adresat.value)) {
		window.alert('Vyplňte prosím správně adresu příjemce zprávy.');
		frm.email_adresat.focus();
		return false;
	}

	if (!isEmail(frm.email_odesilatel.value)) {
		window.alert('Vyplňte prosím správně adresu odesílatele zprávy.');
		frm.email_odesilatel.focus();
		return false;
	}

	return true;
}

function popup_content(fenstername,fensterlink,breite,hoehe,scrolling,resizablevar){
        eval("var "+fenstername+" = window.open('"+fensterlink+"','"+fenstername+"','scrollbars="+scrolling+",width="+breite+",height="+hoehe+",resizable="+resizablevar+",top=116,left=116,status=yes')");
}


function showPopupFlash()
{
   $('.topFlash').hide();
   $('#homepagePopupFlash').dialog('open');

}

function hidePopupFlash()
{
    $('#homepagePopupFlash').dialog('close');
    $('.topFlash').show();
}

///}}}


