// JavaScript Document
//	Vyměna barvy pozadí
function setBgColor (id, color) {

	if (document.layers)
		document[id].bgColor = color == 'transparent' ? null : color;
	else if (document.all)
		document.all[id].style.backgroundColor = color;
	else if (document.getElementById)
		document.getElementById(id).style.backgroundColor = color;

}

//	Vyměna obrázku pozadí
function setBgImage (id, imageURL) {

	if (document.layers)
		document[id].background.src = imageURL == 'none' ? null : imageURL;
	else if (document.all)
		document.all[id].style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
	else if (document.getElementById)
		document.getElementById(id).style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';

}

function nahledx(aaa, bbb, wi, he) {

	prewiev = window.open('',aaa,'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width='+ wi +',height='+ he +',left=10,top=10');
	prewiev.document.open();
	prewiev.document.write("<html><head>");
	prewiev.document.write("<title>IZOTECH</title></head>");
	prewiev.document.write("<BODY bgcolor=#FFFFFF marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 bottommargin=0 framespacing=0 frameborder=0>");
	prewiev.document.write("<a href=javascript:onClick=window.close()><img src="+aaa+"/"+bbb+".jpg border=0 alt='Kliknutím obrázek zavřete'></a>");
	prewiev.document.write("</body></html>");
	prewiev.document.close();

}

function nahledobr(ID, soubor) {
	prewiev2 = window.open('obrazek.asp?ID='+ID+'&obrazek='+soubor,'fotogalerie','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=200,height=100,left=10,top=10');
	prewiev2.window.focus();
}


function nahled(aaa,bbb,title) {
	if(title == "") title = "Náhled";
	prewiev = window.open(aaa+'/obrazek.html?'+bbb,title,'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=200,height=100,left=10,top=10');
	prewiev.window.focus();
}

function nahled2(aaa, bbb, wi, he) {

	prewiev = window.open('',aaa,'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width='+ wi +',height='+ he +',left=10,top=10');
	prewiev.document.open();
	prewiev.document.write("<html><head>");
	prewiev.document.write("<title>IZOTECH</title></head>");
	prewiev.document.write("<BODY bgcolor=#FFFFFF marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 bottommargin=0 framespacing=0 frameborder=0>");
	prewiev.document.write("<a href=javascript:onClick=window.close()><img src="+aaa+"/"+bbb+".gif border=0 alt='Kliknutím obrázek zavřete'></a>");
	prewiev.document.write("</body></html>");
	prewiev.document.close();

}

function nahled3(aaa, bbb, popis, wi, he) {
prewiev = window.open('',bbb,'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width='+ wi +',height='+ he +',left=10,top=10');
prewiev.document.open();
prewiev.document.write("<html><head>");
prewiev.document.write("<title>IZOTECH</title>");
prewiev.document.write("<LINK href=styles.css type=text/css rel=stylesheet></head>");
prewiev.document.write("<BODY bgcolor=#ffffff marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 bottommargin=0 framespacing=0 frameborder=0>");
prewiev.document.write("<center><table cellpadding=0 cellspacing=0 border=0><tr><td height=20><b style=\"color: #FFFFFF;\">"+popis+"</b></td></tr></table></center>");
prewiev.document.write("<a href=javascript:onClick=window.close()><img src="+aaa+"/"+bbb+".jpg border=0 alt='Kliknutím obrázek zavřete'></a>");
prewiev.document.write("</body></html>");
prewiev.document.close();

}

function check_email(adresa) {
	re = /^([a-zA-Z0-9._-]+)@([a-zA-Z0-9._-]+)\.([a-zA-Z]{2,5})$/;
	return adresa.search(re) == 0;
}

function addNewsletter() {

	if(document.newsletter.email.value == "") {
		alert("Vyplňte, prosím, Vaši emailovou adresu!");
		document.newsletter.email.focus();
		return false;
	}
	if (!check_email(document.newsletter.email.value) ) {
	   alert("Vaše emailová adresa není vyplněna správně!");
	   document.newsletter.email.focus();
	   return false;
	}
	document.newsletter.submit();

}

function addPoptavka() {

	if(document.poptavka.jmeno.value == "") {
		alert("Vyplňte, prosím, Vaše jméno!");
		document.poptavka.jmeno.focus();
		return false;
	}
	if(document.poptavka.prijmeni.value == "") {
		alert("Vyplňte, prosím, Vaše příjmení!");
		document.poptavka.prijmeni.focus();
		return false;
	}
	if(document.poptavka.email.value == "") {
		alert("Vyplňte, prosím, Vaši emailovou adresu!");
		document.poptavka.email.focus();
		return false;
	}
	if (!check_email(document.poptavka.email.value) ) {
	   alert("Vaše emailová adresa není vyplněna správně!");
	   document.poptavka.email.focus();
	   return false;
	}
	if(document.poptavka.tel.value == "") {
		alert("Vyplňte, prosím, Váš telefon!");
		document.poptavka.tel.focus();
		return false;
	}
	if(document.poptavka.poznamka.value == "") {
		alert("Vyplňte, prosím, předmět poptávky!");
		document.poptavka.poznamka.focus();
		return false;
	}
	document.poptavka.submit();

}

function sendmail() {

	if(document.napiste.jmeno.value == "") {
		alert("Vyplňte, prosím, Vaše jméno a příjmení!");
		document.napiste.jmeno.focus();
		return false;
	}
	if(document.napiste.email.value == "") {
		alert("Vyplňte, prosím, Vaši emailovou adresu!");
		document.napiste.email.focus();
		return false;
	}
	if (!check_email(document.napiste.email.value) ) {
	   alert("Vaše emailová adresa není vyplněna správně!");
	   document.napiste.email.focus();
	   return false;
	}
	if(document.napiste.zprava.value == "") {
		alert("Teď už nám jen něco napište! :-)");
		document.napiste.zprava.focus();
		return false;
	}
	document.napiste.submit();

}

// toolTip preview fotky //

var offsetx = 12;
var offsety =  8;

function newelement(newid)
{ 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e)
{
	if(document.getElementById)
	{
		var iebody=(document.compatMode && 
			document.compatMode != 'BackCompat') ? 
				document.documentElement : document.body;
		pagex = (isapple == 1 ? 0 : (ie5)?iebody.scrollLeft:window.pageXOffset);
		pagey = (isapple == 1 ? 0 : (ie5)?iebody.scrollTop:window.pageYOffset);
		mousex = (ie5)?event.clientX:(ns6)?clientX = e.clientX:false;
		mousey = (ie5)?event.clientY:(ns6)?clientY = e.clientY:false;

		var lixlpixel_tooltip = document.getElementById('tooltip');
		lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
		lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
	}
}
function tooltip(adresarImg,previewImg,popis)
{
    if(!document.getElementById('tooltip')) newelement('tooltip');
    var lixlpixel_tooltip = document.getElementById('tooltip');
    if(!popis) {popis='<br />'} else {popis='<br />'+popis;}
    if(!previewImg) {previewImg=''} else {previewImg='<img src="'+previewImg+'" alt="" />';}
    lixlpixel_tooltip.innerHTML = previewImg+popis;
    lixlpixel_tooltip.style.display = 'block';
    document.onmousemove = getmouseposition;
}
function exit()
{
    document.getElementById('tooltip').style.display = 'none';
}

