/**
 	* File: $Id$
 	*
 	* Funkce pro zobrazeni nahledu galerie v novem okne
 	*
 	*
 	* @package webpure
 	* @copyright (C) 2004 CL-NET s.r.o.
 	* @link http://www.clnet.cz
 	*
 	* @author CLNET
	*/

	/**
	 *
	 * @todo: zrusit... (neni potreba? ) .. pouziva se stejna funkce v htmlarea insert_image.html
	 */

	function showDetail(imgSrc) {

		imgDetail = new Image();
		imgDetail.src = imgSrc;

		wImgWidth = (imgDetail.width>screen.width-10)?(screen.width-40):eval(imgDetail.width)+30;
		wImgHeight = (imgDetail.height>screen.height-10)?(screen.height-40):eval(imgDetail.height)+45;

		Gnahled = window.open(imgSrc,"Gnahled",'toolbar=0,status=no,location=0,scrollbars=1,resizable=1');
		Gnahled.resizeTo(wImgWidth, wImgHeight);
		Gnahled.focus();

		nahledSrc = "<body topmargin=\"0\" leftmargin=\"0\" onClick=\"window.close();\" style=\"cursor:pointer;\">\n";
		nahledSrc += "<img src=\""+imgSrc+"\" alt=\"klikntim na obrazek se okno zavre\"/>\n";
		nahledSrc += "</body>\n";

		Gnahled.document.write(nahledSrc);
	} // openNahled()

	/**
	 *
	 *
	 */
	function openGNahled(galerie, dir, id, imgWidth, imgHeight) {

		wImgWidth = (imgWidth>screen.width-10)?(screen.width-40):eval(imgWidth)+30;
		wImgHeight = (imgHeight>screen.height-10)?(screen.height-40):eval(imgHeight)+35;

		imgSrc = "zobraz_detail.php?galerie=" +galerie+ "&dir=" +dir+ "&id=" +id+ "&width=" + imgWidth + "&height=" +imgHeight;

	    var Gnahled = window.open(imgSrc,"Gnahled","toolbar=0,location=0,status=0,menubar=0,scrollbars=yes,resizable=yes,copyhistory=0");
	    //var Gnahled = window.open(imgSrc,"Gnahled","height=100,width=100,directories=no,location=no,menubar=no,resizeable=no,toolbar=no,status=no");
		//Gnahled.resizeTo(wImgWidth, wImgHeight);
		Gnahled.focus();
	} // openGNahled()
/*
	function checkForm(){
		if (document.forms[0].firma.value == ""){
			document.forms[0].firma.focus();
			alert ("Nebylo vyplněno pole Jméno firmy");
			return false;
		}

		if (document.forms[0].adresa.value == ""){
			document.forms[0].adresa.focus();
			alert ("Nebylo vyplněno pole Adresa");
			return false;
		}

		if (document.forms[0].mesto.value == ""){
			document.forms[0].mesto.focus();
			alert ("Nebylo vyplněno pole Město");
			return false;
		}

		if (document.forms[0].psc.value == ""){
			document.forms[0].psc.focus();
			alert ("Nebylo vyplněno pole PSČ");
			return false;
		}

		if (document.forms[0].kontaktni_osoba.value == ""){
			document.forms[0].kontaktni_osoba.focus();
			alert ("Nebylo vyplněno pole Jméno kontaktní osoby");
			return false;
		}

		if (document.forms[0].email.value == ""){
			document.forms[0].email.focus();
			alert ("Nebylo vyplněno pole e-mail kontaktní osoby");
			return false;
		}

		if (document.forms[0].telefon.value == "" && document.forms[0].mobil.value == ""){
			document.forms[0].telefon.focus();
			alert ("Nebylo vyplněno jedno z polí Telefon nebo Mobil");
			return false;
		}

		if (document.forms[0].objednavka.value == "Zde napište vaši poptávku..."){
			document.forms[0].objednavka.focus();
			alert ("Nebylo vyplněno pole Poptávka");
			return false;
		}
	}
*/

function checkForm(){

	var ok = "";
	var first =	"";

	if(document.forms["eshopusersForm"]["firam"].value==""){	ok += 'Firma, ';	}
	if(document.forms["eshopusersForm"]["user_nick"].value==""){	ok += 'Přihlašovací jméno, ';	}
	if(document.forms["eshopusersForm"]["user_name"].value==""){	ok += 'Kontaktní osoba, ';	}
//	if(document.forms["eshopusersForm"]["adresa"].value==""){	ok += 'Ulice, ';	}
	//if(document.forms[0]["psc"].value==""){		ok += 'PSČ, ';		}
	if(document.forms["eshopusersForm"]["user_email"].value==""){	ok += 'E-mail, ';	}

	if(ok==""){
		document.forms["eshopusersForm"].submit();
	} else {
		var first = 'Uvedené položky musí být vyplněny.\n';
		alert(first+ok);
	}
}

	/**
	* Rozbali / zabali polozky menu ( submenu je v tagu mpolozka{id}, obrazek imgpolozka{id}
	* @subpackage zpravy, class skupinyMenu
	**/
	function rozbalZabal(idP) {
		blok = document.getElementById('mpolozka'+idP);
//		imag = document.getElementById('imgpolozka'+idP);

//		imag.className = ((blok.className!='rozbalene')?'rozbalene':'skryte');
		blok.className= ((blok.className!='rozbalene')?'rozbalene':'skryte');
	} // rozbalZabal()

function reloadEshoInfo(){
	MyIframe2 = document.getElementById('myIframe2');
	MySrc2 = "modules/webshop/ifrmbasker.inc.php?akce=info";
	MyIframe2.src = MySrc2;
}
	
function addToBasket(id){
	var MySrc = "";
	var MyID = "";
	MyID = document.getElementById( "comp" + id );
	MyID.value = ((parseInt(MyID.value)>0)?parseInt(MyID.value):0);
	MyIframe = document.getElementById('myIframe');
	MySrc = "modules/webshop/ifrmbasker.inc.php";
	MySrc += "?idcomp=" + id  + "&compsum=" + MyID.value;
	MyIframe.src = MySrc;
	timerID = setTimeout('reloadEshoInfo();',5);
}

function getPage(from){
	document.forms["searchForm"]["FROM"].value=from;
	document.forms["searchForm"].submit();
}
