// JavaScript Document

var txt = 1;

function zahradni_centrum() {
	change = setInterval("switchtext()",4000);
	switchtext();
}

function switchtext() {
	if (txt==1)  { text = "<a href='../zahradni-centrum'>IMPULS otevřel <br /><span>10. května 2010</span><br />nové zahradní centrum</a>"; txt = 2; }
		else { text = "<br /><a href='../zahradni-centrum'>IMPULS pro Vaši zahradu...</a>"; txt = 1; }
		
	document.getElementById('top_bubbletext').innerHTML = text;
}

function showdiv( str, el, width, height){
    //pokud neni vytvoreny div pridany v HTML
		if( !document.getElementById('capacities'))
			//pridame div do stranky
			document.body.appendChild(divElement);
		//nastavime pozadovanou sirku pro div
		divElement.style.width = width + 'px';
		divElement.style.height = height + 'px';
		divElement.style.visibility = 'visible';
		//divElement.innerHTML = "<a href='javascript:close_capacities()'><img src='pics/"+pic+"' width='600' height='400' alt='Voln� kapacity od 1.1.2011' /></a>";
}
	
	function showit() {
		blankscr = document.createElement('div');
		blankscr.setAttribute('id', 'blankscreen');
		blankscr.style.visibility = 'visible';
		blankscr.style.position = 'fixed';
		blankscr.style.left = '0px';
		blankscr.style.top = '0px';
		blankscr.style.height = document.documentElement.clientHeight + 'px';
		if( !document.getElementById('blankscreen')) document.body.appendChild(blankscr);
	
		divElement = document.getElementById('capacities');
		/*divElement = document.createElement('div');
		divElement.setAttribute('id', 'capacities');
		divElement.style.visibility = 'hidden';*/
		divElement.style.position = 'fixed';
		divElement.style.left = ((document.documentElement.clientWidth/2)-250)+'px';
		divElement.style.top = ((document.documentElement.clientHeight/2)-325)+'px';
		showdiv('capacities',this,500,650);	
	}
	
	function closeit() {
			obj = document.getElementById("capacities");
			document.body.removeChild(obj);
			obj = document.getElementById("blankscreen");
			document.body.removeChild(obj);
	}
	
	function checkit() {
		txt = "";
		if (document.getElementById('jmeno').value == "") { txt += "- Jméno a příjmení\n";}
		if (document.getElementById('telefon').value == "") { txt += "- Telefonní kontakt\n";}
        format = /^[_a-zA-Z0-9.-]+@[_a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/
		if (format.test(document.getElementById('email').value) == false) { txt += "- Platnou emailovou adresu\n";}
		if (document.getElementById('druh_vstupenky').value == 0) { txt += "- Druh vstupenky\n";}
		if (document.getElementById('pocet').value == "") { txt += "- Počet vstupenek\n";}

		if (txt != "") { 
			alert("Je potřeba doplnit následující údaje: \n"+txt);
			return false;
		}
		else return true;
	}
