function red_www() { //v2.0
  location.href="../index.php";
}

function red_www_nauczyciela() { //v2.0
  location.href="http://www.mydlandia.pl";
}

function red_www_walentynki() { //v2.0
  location.href="http://www.mydlandia.pl";
}

function red_www_aromaterapia() { //v2.0
  location.href="http://www.mydlandia.pl";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function newsletter(plec, imie, email)
{
	if (plec[0].checked) plec='M'; else plec = 'K';
	MM_openBrWindow('pop_newsletter.php?plec='+plec+'&imie='+imie+'&email='+email,'','width=330,height=200, scrollbars=yes');
	return false;
}

function changeColor(color){
  var el=event.srcElement
  if (el.tagName=="INPUT"&&el.type=="submit")
  event.srcElement.style.backgroundColor=color
}

function setBgImage(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#002E46";
}

function setBgImageOver(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#000000";
}

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no' );
}

function setCheckboxes(the_form, do_check)
{

    var elts      = document.forms[the_form].elements;
    var elts_cnt  = elts.length;

	for (var i = 0; i < elts_cnt; i++) {
		if (elts[i].type=="checkbox") elts[i].checked = do_check;
    } // end for

    return true;
}

/**
 * Sets/unsets the pointer in browse mode
 *
 * @param   object   the table row
 * @param   object   the color to use for this row
 * @param   object   the background color
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;

    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') return false;
    if (typeof(document.getElementsByTagName) != 'undefined') theCells = theRow.getElementsByTagName('td');
    else if (typeof(theRow.cells) != 'undefined') theCells = theRow.cells; 
    else return false;

    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} // end of the 'setPointer()' function



function zmien_prezent()
{
	if(document.getElementById)
	{
		var element = document.getElementById("zrob_prezent"); 
		if(element.style.display != "block") element.style.display = "block";
			else element.style.display = "none";

		var element = document.getElementById("zrob_prezent"); 
		if(element.style.display != "block") element.style.display = "block";
			else element.style.display = "none";
			
	}
}

function pop_zdjecie(foto){
	var plik = "pop_kartka.php?foto="+foto;
	var Win = window.open(plik, "kartka","menubar=0,location=0,status=0,toolbar=0,directories=0,alwaysRaised=1,scrollbars=0,titlebar=0,resizable=0");
}

function sprawdz_wymagane_pola_prezent(){
	if (document.listaproduktow.czy_prezent.checked){ 
		if (document.listaproduktow.firstname.value.length<1){ 
			alert("Należy podać \"Imię\" adresata!");
			return false;
		}
		if (document.listaproduktow.lastname.value.length<1){ 
			alert("Należy podać \"Nazwisko\" adresata!");
			return false;
		}
		if (document.listaproduktow.street.value.length<1){ 
			alert("Należy podać \"Ulicę\" adresata!");
			return false;
		}
		if (document.listaproduktow.postcode.value.length<1){ 
			alert("Należy podać \"Kod pocztowy\" adresata!");
			return false;
		}
		if (document.listaproduktow.city.value.length<1){ 
			alert("Należy podać \"Miasto\" adresata!");
			return false;
		}
		if (document.listaproduktow.tresc_do_kartki.value.length<1){ 
			alert("Należy podać \"Życzenia\" do kartki!");
			return false;
		}
	}
	return true;		
}

function sprawdz_czy_prezent(przesylka){
	var mozna_prezent;
	var element = document.getElementById("zrob_prezent"); 
	if (document.listaproduktow.czy_prezent.checked)
	{
		mozna_prezent = 0;
		if(przesylka == 'platna')
		{
			if(document.listaproduktow.transport[0].checked || document.listaproduktow.transport[1].checked) mozna_prezent = 1;
		}
		else if(przesylka == 'gratis')
		{
			if(document.listaproduktow.transport[0].checked || document.listaproduktow.transport[1].checked) mozna_prezent = 1;
		}

		if(mozna_prezent == 1)
		{	
				if(element.style.display == "none") element.style.display = "block";
//				else if(element.style.display == "block") element.style.display = "none";
		}
		else
		{
			alert("Opcja \"zrób prezent\" dostępna jest\ntylko przy przedpłacie przelewem i przy płatności kartą !");
			document.listaproduktow.czy_prezent.checked = false;
			element.style.display = "none";
		}
	}
	else
	{
		if(element.style.display == "block") element.style.display = "none";
	}
}
					

function jak_w_nazwie_wlasnej(ciag)
{
var fraza=ciag;
var frazaTab=fraza.split(' ')
for(var i=0;i<frazaTab.length;i++){
	frazaTab[i]=frazaTab[i].substr(0,1).toUpperCase()+frazaTab[i].substr
(1).toLowerCase();
}
fraza=frazaTab.join(' ');
return(fraza);
}

spml_a = "sklep";
spml_b = "%40";
spml_c = "mydlandia.pl";
