function bookmark(url,title){
	if(url=='self')	url=window.location.href;
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}


function go_saveas() {
    if (!!window.ActiveXObject) {
        document.execCommand("SaveAs");
    } else if (!!window.netscape) {
        var r=document.createRange();
        r.setStartBefore(document.getElementsByTagName("head")[0]);
        var oscript=r.createContextualFragment('<script id="scriptid" type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"><\/script>');
        document.body.appendChild(oscript);
        r=null;
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            saveDocument(document);
        } catch (e) {
            //no further notice as user explicitly denied the privilege
        } finally {
            var oscript=document.getElementById("scriptid");    //re-defined
            oscript.parentNode.removeChild(oscript);
        }
    }
}


function checkSearchSetup()
{
  var sSearch = document.getElementById( 'search_right' ).value;
  sSearch = sSearch.replace( / /gi, "" );
  var iManufacturer = document.getElementById( 'where_manufacturer' ).value;
  var rForm = document.getElementById( 'frm_search' );

  if( !sSearch.length && !iManufacturer )
  {
    window.alert("Zadejte hledanÃ½ text nebo vyberte vÃ½robce !");
  }
  else
  {
    rForm.submit();
  }
}

function manageNewsletterDependence(clicked)
{
  var newsletterRequired = document.getElementById('newsletterRequired');
  var registerMe = document.getElementById('registerMe');

  switch(clicked)
  {
    case 'newsletter':
      if(newsletterRequired.checked)
      {
        registerMe.checked = true;
      }
    break;
    case 'registration':
      if(!registerMe.checked)
      {
        newsletterRequired.checked = false;
      }
    break;
  }
}

function isNotEmpty( checkedVar )
{
	if(checkedVar)
	{
	   return new Array(true, "");
	}
	else
	{
	  return new Array(false, "nenÃ­ vyplnÄ?no");
	}
}

function isPostalCode( checkedVar )
{
	if( (parseInt(checkedVar) || parseInt(checkedVar) == 0) && checkedVar.length == 5 )
	{
	   return new Array(true, "");
	}
	else
	{
	  return new Array(false, "nenÃ­ platnÃ? PSÄ¦");
	}
}

function isEmail( email )
{
	var regStr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if( !regStr.test(email)){
		return new Array(false, "nemÃ· platnÃ½ formÃ·t");
	}
	return new Array(true, "");
}

function validateUserData(sFormId, aExceptions)
{
  if(aExceptions == undefined) aExceptions = new Array();
  var minPwdLength = 5;
	var maxResultInfoRows = 4;
	var form = document.getElementById(sFormId);
  var requiredFieldsIds = new Array(
		new Array('firstname', 'jmÃ?no', 'isNotEmpty'),
		new Array('surname', 'pÅ?Ã­jmenÃ­', 'isNotEmpty'),
		new Array('street', 'ulice, Ä«.p.', 'isNotEmpty'),
		new Array('city', 'mÄ?sto', 'isNotEmpty'),
		new Array('postalCode', 'PSÄ¦', 'isNotEmpty;isPostalCode'),
		new Array('email', 'e-mail', 'isNotEmpty;isEmail'),
		new Array('phone', 'telefon', 'isNotEmpty')
	);

	// legal form
  var legalFormCompany = document.getElementById('legalFormCompany');
  if(legalFormCompany.checked)
  {
    legalForm = "company";
    requiredFieldsIds.push(
			new Array('company', 'firma', 'isNotEmpty'),
			new Array('ic', 'IÄ¦', 'isNotEmpty')
		);
	}
	else
	{
	  legalForm = "person";
	}
	// delivery enabled
  var deliveryDisabled = document.getElementById('deliveryDisabled');
  if(deliveryDisabled.checked)
  {
    deliveryDiffers = false;
	}
	else
	{
	  deliveryDiffers = true;
	  requiredFieldsIds.push(
			new Array('daFirstname', 'jmÃ?no (dodacÃ­ adresa)', 'isNotEmpty'),
			new Array('daSurname', 'pÅ?Ã­jmenÃ­ (dodacÃ­ adresa)', 'isNotEmpty'),
			new Array('daStreet', 'ulice, Ä«.p. (dodacÃ­ adresa)', 'isNotEmpty'),
			new Array('daCity', 'mÄ?sto (dodacÃ­ adresa)', 'isNotEmpty'),
			new Array('daPostalCode', 'PSÄ¦', 'isNotEmpty;isPostalCode')
		);
	}

	if( deliveryDiffers && legalForm == "company" )
	{
		requiredFieldsIds.push(
			new Array('daCompany', 'firma (dodacÃ­ adresa)', 'isNotEmpty')
		);
	}
	// kontrola poli
	var result = true;
	var resultInfo = new Array();
	for(i = 0; i < requiredFieldsIds.length; i ++)
	{
	  var fieldId = requiredFieldsIds[i][0];
	  var fieldName = requiredFieldsIds[i][1];
	  var fieldRef = document.getElementById(fieldId);
	  var fieldValue = fieldRef.value;
	  var fieldChecks = (requiredFieldsIds[i][2].indexOf(";") != -1) ? requiredFieldsIds[i][2].split(";") : new Array(requiredFieldsIds[i][2]);

    fieldRef.className = 'rqd'; // reset border color na default

	  for(j = 0; j < fieldChecks.length; j ++) // projede vsechny typy kontrol pro kazde pole
	  {
			aCheckResults = eval(fieldChecks[j] + "(fieldValue);");
			checkResult = aCheckResults[0];
			checkInfo = aCheckResults[1];
	    if( !checkResult )// nalezena chyba pri jedne z def. kontrol pole
			{
				result = false;
				resultInfo.push('Pole <strong>' + fieldName + '</strong> ' + checkInfo + '.');
				fieldRef.className = 'rqd incorrectlyFilled';
				fieldRef.value = "";
				break;
			}
		}
	}
	// EXCEPTIONS
	for(i = 0; i < aExceptions.length; i ++)
	{
    sException = aExceptions[i];

//	alert (sException);

    switch(sException)
    {
      case 'regPwd':
        var pwd = document.getElementById('regPwd');
        var pwdConfirmation = document.getElementById('regPwdConfirmation');
        pwd.className = 'rqd';
        pwdConfirmation.className = 'rqd';
        // equal pwds
        if( pwd.value != pwdConfirmation.value )
        {
          result = false;
          resultInfo.push( "<strong>Hesla</strong> nejsou shodnÃ·." );
          pwdConfirmation.className = 'rqd incorrectlyFilled';
          pwdConfirmation.value = "";
        }
        // min length
        if( pwd.value.length < minPwdLength )
        {
          result = false;
          pwd.className = 'rqd incorrectlyFilled';
          pwdConfirmation.className = 'rqd incorrectlyFilled';
          resultInfo.push( "<strong>Heslo</strong> musÃ­ bÃ½t minimÃ·lnÄ? " + minPwdLength + " znakÅ¯ dlouhÃ?." );
          pwd.value = "";
          pwdConfirmation.value = "";
        }
      break;
      case 'legalAgreement':
        var legalAgreement = document.getElementById('legalAgreement');
        if( !legalAgreement.checked )
        {
          result = false;
          resultInfo.push( "<strong>Souhlas s obchodnÃ­mi podmÃ­nkami</strong> je vyÅµadovÃ·n." );
        }
      break;
    }
  }


	// RESULT
	if(!result)
	{
	  if(resultInfo.length > 4)// oseknuti na max 4 prvky pole
	  {
	    resultInfo = resultInfo.slice(0, maxResultInfoRows);
	    resultInfo.push("<em>... poÄ«et chyb je vÄ?tÅ·Ã­ neÅµ dovoluje zobrazenÃ­ ...</em>");
		}
		resultInfo.push("<strong>ChybnÄ? vyplnÄ?nÃ· pole byla pro pÅ?ehlednost zvÃ½raznÄ?na.</strong>");
	  changeErrContent('warning', 'Dopustil/a jste se chyb !', resultInfo);
	  switchErr("show");
	}
	else
	{
	  form.submit();
	}
}

function switchDeliveryAddressBox(action)
{
	// legal form
  var legalFormCompany = document.getElementById('legalFormCompany');
  if(legalFormCompany.checked)
  {
    legalForm = "company";
	}
	else
	{
	  legalForm = "person";
	}
	// delivery enabled
  var deliveryDisabled = document.getElementById('deliveryDisabled');
  if(deliveryDisabled.checked)
  {
    deliveryDiffers = 0;
	}
	else
	{
	  deliveryDiffers = 1;
	}

	// fields, rows, boxes
	var deliveryAddressBox = document.getElementById('deliveryAddressBox');
	var daCompany = document.getElementById('daCompany');
	var daCompanyRow = document.getElementById('daCompanyRow');
  var daFirstname = document.getElementById('daFirstname');
  var daSurname = document.getElementById('daSurname');
  var daStreet = document.getElementById('daStreet');
  var daCity = document.getElementById('daCity');
  var daPostalCode = document.getElementById('daPostalCode');

  // actions
	switch(action)
	{
	  case 'disable':
	    // hide box
	    deliveryAddressBox.style.display = "none";
	    // reset fields
	    daCompany.value = "";
  		daFirstname.value = "";
  		daSurname.value = "";
  		daStreet.value = "";
  		daCity.value = "";
  		daPostalCode.value = "";
	  break;
	  case 'enable':
	    // show box
	    deliveryAddressBox.style.display = "block";
	    // conditional COMPANY DISPLAY
	    daCompanyRow.style.display = (legalForm == "company" ? 'block' : 'none');
	  break;
	}
}

function switchLegalForm()
{
	// legal form
  var legalFormCompany = document.getElementById('legalFormCompany');
  if(legalFormCompany.checked)
  {
    legalForm = "company";
	}
	else
	{
	  legalForm = "person";
	}
	// fields adn divs to manage
  var company = document.getElementById('company');
  var companyRow = document.getElementById('companyRow');
  var daCompany = document.getElementById('daCompany');
  var daCompanyRow = document.getElementById('daCompanyRow');
  var ic = document.getElementById('ic');
  var icRow = document.getElementById('icRow');
  var dic = document.getElementById('dic');
  var dicRow = document.getElementById('dicRow');

  // actions
	switch(legalForm)
	{
	  case 'person':
	    // hide rows
	    companyRow.style.display = "none";
	    daCompanyRow.style.display = "none";
	    icRow.style.display = "none";
	    dicRow.style.display = "none";
	    // reset fields
	    company.value = "";
	    daCompany.value = "";
  		ic.value = "";
  		dic.value = "";
	  break;
	  case 'company':
	    // show rows
	    companyRow.style.display = "block";
	    daCompanyRow.style.display = "block";
	    icRow.style.display = "block";
	    dicRow.style.display = "block";
	  break;
	}
}

function checkIntegerOnly(inputToCheckId, defaultValue)
{
	var inputToCheck = document.getElementById(inputToCheckId);

	if(!isNaN(parseInt(inputToCheck.value)))
  {
    inputToCheck.value = parseInt(inputToCheck.value);
  }
  else
  {
    inputToCheck.value = defaultValue;
  }
}

function showInformation(str)
{
  window.alert(str);
}

function helpAvailabilityIcon(str)
{
  window.alert(str);
}

function setCatalogueView(view)
{
	var frmView = document.getElementById('frm_catalogueView');
	var inputView = document.getElementById('catalogueView');

	inputView.value = view;
	frmView.submit();
}

function setCatalogueOrderByDirection(orderByDirection)
{
	var frmOrderBy = document.getElementById('frm_orderBy');
	var direction = document.getElementById('catalogueOrderByDirection');

	direction.value = orderByDirection;
	frmOrderBy.submit();
}

function pd_checkVariant(variantStamp)
{
	var selectedVariant = document.getElementById('pd_variant_' + variantStamp);
	var selectedRow = document.getElementById('pd_variant_row_' + variantStamp);
	var variantTable = document.getElementById('pd_tbl_variants');
	//variantTable.rows[0].style.border = "10px solid #000000";
	var variantRows = variantTable.getElementsByTagName('tr');
	var numVariantRows = variantRows.length;

	for(i = 1; i < numVariantRows; i ++)
	{
		var variantRow = variantRows[i];
		var rowClass = variantRow.className;
		if(rowClass.indexOf("odd") == -1)
		{
			variantRow.className = "noClass";
		}
		else
		{
			variantRow.className = "odd";
		}
	}

	selectedVariant.checked = "checked";
	var selectedRowClass = selectedRow.className;
	if(selectedRowClass.indexOf("odd") == -1)
	{
		selectedRow.className = "checked";
	}
	else
	{
		selectedRow.className = "odd checked";
	}
}

function loading(){

	var data = this.req.responseXML.documentElement;
	var iCount = data.getElementsByTagName('ITEM')[0].firstChild.nodeValue;
	var btnDisplayResults = document.getElementById('btn_displayCatalogueFilterResults');
	var numFilterResults = document.getElementById('numFilterResults');
	var numCatalogueTotal = document.getElementById('numCatalogueTotal').value;

	// CSS reaction
	if(iCount != numCatalogueTotal)
	{
		numFilterResults.style.background = "#BC2C1E";
		numFilterResults.style.color = "#DDD4CE";
		if(iCount == 0)
		{
		  btnDisplayResults.style.textDecoration = "line-through";
		}
		else
		{
			btnDisplayResults.style.textDecoration = "none";
		}
	}
	else
	{
		numFilterResults.style.background = "#DDD4CE";
		numFilterResults.style.color = "#BC2C1E";
		btnDisplayResults.style.textDecoration = "none";
	}


	numFilterResults.innerHTML = iCount;
}

function checkFilterSetup()
{
  var categoryId = document.getElementById('categoryId').value;
  var manufacturerId = document.getElementById('manufacturerId').value;
  var userType = document.getElementById('userType').value;

  var numFilterResults = document.getElementById('numFilterResults');
  var btnDisplayResults = document.getElementById('btn_displayCatalogueFilterResults');
  var enableAjaxQuestion = true;
  var filterManufacturerCollection = document.getElementsByName('filterManufacturer[]');
  var filterAvailabilityCollection = document.getElementsByName('filterAvailability[]');
  var priceFrom = document.getElementById('filterPriceFrom');
  var priceTo = document.getElementById('filterPriceTo');
  var filters = document.getElementById('frm_filters');

  // filter manufacturers
  var filterManufacturerValues = new Array();
  for(var i = 0; i < filterManufacturerCollection.length; i ++)
  {
    eval("var manufacturerChecked = document.getElementById('manufacturer_" + filterManufacturerCollection[i].value + "').checked;");
    if(manufacturerChecked) filterManufacturerValues.push(filterManufacturerCollection[i].value);
  }
  if(!filterManufacturerValues.length) enableAjaxQuestion = false;

  // filter availability
  var filterAvailabilityValues = new Array();
  for(var i = 0; i < filterAvailabilityCollection.length; i ++)
  {
    eval("var availabilityChecked = document.getElementById('availability_" + filterAvailabilityCollection[i].value + "').checked;");
    if(availabilityChecked) filterAvailabilityValues.push(filterAvailabilityCollection[i].value);
  }
  if(!filterAvailabilityValues.length) enableAjaxQuestion = 0;

  // filter prices
  if(!isNaN(parseInt(priceFrom.value)))
  {
    priceFrom.value = parseInt(priceFrom.value);
  }
  else
  {
    priceFrom.value = "";
  }
  if(!isNaN(parseInt(priceTo.value)))
  {
    priceTo.value = parseInt(priceTo.value);
  }
  else
  {
    priceTo.value = "";
  }

  if(!enableAjaxQuestion) {
  	btnDisplayResults.style.textDecoration = "line-through";
		numFilterResults.style.background = "#BC2C1E";
		numFilterResults.style.color = "#DDD4CE";
  	numFilterResults.innerHTML = "0";
  }

  else{
      //document.getElementById('test').innerHTML = "/ajax/catalogueFiltr.php?iManufacturers="+filterManufacturerValues+"&iAvailability="+filterAvailabilityValues+"&iPriceFrom="+priceFrom.value+"&iPriceTo="+priceTo.value+"&categoryId="+categoryId+"&manufacturerId="+manufacturerId+"&userType="+userType;
    	var ajax = new net.ContentLoader("/ajax/catalogueFiltr.php?iManufacturers="+filterManufacturerValues+"&iAvailability="+filterAvailabilityValues+"&iPriceFrom="+priceFrom.value+"&iPriceTo="+priceTo.value+"&categoryId="+categoryId+"&manufacturerId="+manufacturerId+"&userType="+userType, loading);

  }

  return enableAjaxQuestion;

}

function submitFilters()
{

  var passed = checkFilterSetup();
  if(passed)
  {

    if (document.getElementById('numFilterResults').innerHTML == 0) {

    	window.alert("VÃ·mi nastavenÃ½ filtr vracÃ­ nulovÃ½ poÄ«et vÃ½sledkÅ¯.");
     	return false;
	} else return true;
  }
  else
  {
  	window.alert("VÃ·mi nastavenÃ½ filtr vracÃ­ nulovÃ½ poÄ«et vÃ½sledkÅ¯. Zkuste snÃ­Åµit omezenÃ­ filtrÅ¯.");
    return false;
  }
}

function manageProductCompare(productId, action)
{
	var productCompareForm = document.getElementById('productCompareRequest');
	var productCompareId = document.getElementById('productCompareId');
	var productCompareAction = document.getElementById('productCompareAction');

	productCompareId.value = productId;
	productCompareAction.value = action;
	productCompareForm.submit();
}

function compareDisabledNotice()
{
	window.alert(" V jednu chvÃ­li je moÅµnÃ? srovnÃ·vat pouze 4 produkty. chcete-li nÄ?kterÃ½ z jiÅµ vybranÃ½ch vymÄ?nit za jinÃ½, odstraÅ?te nejdÅ?Ã­ve tento vybranÃ½ produkt ze seznamu k porovnÃ·nÃ­.");
}

function switchCssIconCompare(id, cssClass)
{
	var element = document.getElementById(id);
	element.className = "cssClass";
}

function changeDeliveryOption() {

	var rInput = document.getElementById("doAction"); // jde o klasicke "do", ale kvuli ... IE se to musi jmenovat jinak (konfrontace nekolika name="do" a jednoho id="do")
	rInput.value = 'changeDeliveryOption';

	var rForm = document.getElementById("frm_payment");
	rForm.submit();

}

function manageQtyWidth(id, action)
{
	var widthExtended = 30;
	var widthContracted = 16;
	var elementQty = document.getElementById(id);
	switch(action)
	{
	  case 'extend':
	    elementQty.style.width = widthExtended + 'px';
	  break;
	  case 'contract':
	  	elementQty.style.width = widthContracted + 'px';
	  break
	  default:
	  break;
	}
}

function switchElementLoading()
{
	var data = this.req.responseXML.documentElement;
	var elementAlert = data.getElementsByTagName('ALERT')[0].firstChild.nodeValue;
	var action = data.getElementsByTagName('ACTION')[0].firstChild.nodeValue;
	var viewAlert = Number(data.getElementsByTagName('VIEW_ALERT')[0].firstChild.nodeValue);

	if(viewAlert == "1" && action == "hide")
	{
		window.alert(elementAlert + " jsou skrytÃ?. Chcete-li je opÄ?t zobrazit, klepnÄ?te na stejnÃ? tlaÄ«itko.");
	}
}

function switchElement(id)
{
  var element = document.getElementById(id);
  var elementBtmHsep = document.getElementById(id + "Hsep");
  var elementDisplayStatus = element.style.display;

  if(elementDisplayStatus == "none" || elementDisplayStatus == undefined)
  {
    var action = "unhide";
    element.style.display = "block";
    elementBtmHsep.style.background = "none";
  }
  else
  {
  	var action = "hide";
    element.style.display = "none";
    elementBtmHsep.style.background = "url('/bg/hsep_line_lightocher.gif') repeat-x";
  }
  var url = "../ajax/switch_element.php?element="+ id + "&action=" + action;
  //window.alert(url);
	var ajax = new net.ContentLoader(url, switchElementLoading);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setPayment(choice){
	var element = document.getElementById('payment');
	if(choice == 4 && element.value == 1){
	  element.value = 2;
	  window.alert("Pro tento zpÅ¯sob dopravy je moÅµnost platby pouze hotovÄ?. ZpÅ¯sob platby byl automaticky nastaven.");
	}else if (choice != 4 && element.value == 2){
	  element.value = 1;
	  window.alert("Pro tento zpÅ¯sob dopravy je moÅµnost platby pouze dobÃ­rkou. ZpÅ¯sob platby byl automaticky nastaven.");
	}
}

function setShipping(choice){
	var element = document.getElementById('shipping');
	if(choice == 1 && element.value == 4){
	  element.value = 1;
	  window.alert('ZpÅ¯sob platby dobÃ­rkou nenÃ­ moÅµnÃ½ v pÅ?Ã­padÄ? osobnÃ­ho odbÄ?ru. ZpÅ¯sob dopravy byl automaticky zmÄ?nÄ?n na "Ä¦eskÃ· poÅ·ta - obyÄ«ejnÃ½ balÃ­k".');
	}else if (choice == 2 && element.value != 4){
	  element.value = 4;
	  window.alert("V hotovosti lze platit pouze pÅ?i osobnÃ­m odbÄ?ru. ZpÅ¯sob dopravy byl automaticky nastaven.");
	}
}

function cartadd(frm, session_id, currency, user_type){

	if(user_type == '') user_type = '1';
	var url = "../ajax/cart_add.php?currency="+currency+"&user_type="+user_type+"&session_id="+session_id+"&productStamp="+frm.productStamp.value+"&qty="+frm.qty.value;
	//window.location=url;
	var ajax = new net.ContentLoader(url, cartloading);

}

function zmenaHledani() {

	var element = document.getElementById('hledani');

	if (element.value == 'hledat...') {
		element.value = '';
	}

}

function cartloading(){
	var elmnt = document.getElementById('cart-ajax');
	var data = this.req.responseXML.documentElement;
	var ks = Number(data.lastChild.firstChild.nodeValue);
	var cena = data.firstChild.firstChild.nodeValue;
	if(!isNaN(ks)){
		elmnt.innerHTML = ks + "<br />"+cena;
		alert("VybranÃ? zboÅµÃ­ bylo pÅ?idÃ·no do koÅ·Ã­ku. DÄ?kujeme.");
	}
}


function watchDog(e, productId){
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX + document.documentElement.scrollLeft;
		posy = e.clientY + document.documentElement.scrollTop;
	}


	var frm = document.getElementById('frm_watchDog');
	frm.wdProductId.value = productId;
	var wdBox = document.getElementById('watchDog');

	wdBox.style.top = (posy + 5) + "px";
	wdBox.style.left = (posx +5) + "px";
	wdBox.style.display = 'block';
}

function addItem(box, id) {
   var sel = document.getElementById(box);
   var opt = document.createElement("OPTION");
   opt.value = id;

	var txt = document.createTextNode(id);
	opt.appendChild(txt);
   sel.appendChild(opt);
}


function ValidateEmail( email){
	var regStr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if( !regStr.test(email)){
		alert("VÃ·mi zadanÃ· e-mailovÃ· adresa nemÃ· platnÃ½ formÃ·t.");
		return false;
	}
	return true;
}

function ValidateEmailNotStrict( email){
	if(email == '') return true;
	var regStr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if( !regStr.test(email)){
		alert("VÃ·mi zadanÃ· e-mailovÃ· adresa nemÃ· platnÃ½ formÃ·t.");
		return false;
	}
	return true;
}

function ValidateNotEmpty( values){
	for(var i=0; i<values.length; i++){

		if(values[i] == ''){
			alert("VyplÅ?te prosÃ­m poÅµadovanÃ? Ãºdaje.");
			return false;
		}
	}
	return true;
}

function ValidateAreNumbers( values  ){
	var regStr = /^(\d)+$/;
	for(var i=0; i<values.length; i++){
		if(!regStr.test(values[i])){
			alert("Do Ä«Ã­selnÃ½ch polÃ­ prosÃ­m vloÅµte nezÃ·pornÃ? celÃ? Ä«Ã­slo.");
			return false;
		}
	}
	return true;
}

function ShowTooltip(e, tip)
{
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX + document.documentElement.scrollLeft;
		posy = e.clientY + document.documentElement.scrollTop;
	}

	var tooltipBox = document.getElementById('tooltip');
	tooltipBox.innerHTML = tip;

	tooltipBox.style.top = (posy + 5) + "px";
	tooltipBox.style.left = (posx +5) + "px";
	tooltipBox.style.display = 'block';

}

function HideTooltip(){

	var tooltipBox = document.getElementById('tooltip');

	tooltipBox.style.display = 'none';
}

