
/* Lista produktów w koszyku z ilością dla Esensa.pl (basketedit - basketedit_productslist) [53348]*/

function countAnnuityZagiel(account, amount)
{ 
window.open('http://www.zagiel.com.pl/kalkulator/index_smart.php?action=getklientdet_si_rata&shopNo=' + account + '&goodsValue=' + amount, 'count_zagiel', 'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function validate_Zagiel()
{
var zagielconfirm = document.getElementById('zagiel_confirm');
  if (zagielconfirm.checked) {
    return true;
  } else {
    alert(zagielnotconfirmed)
    return false;
  }
}

/*eraty*/
function countAnnuityEraty(account, version, amount)
{ 
window.open('https://www.eraty.pl/symulator/oblicz.php?numerSklepu=' + account + '&wariantSklepu=' + version+ '&typProduktu=0&wartoscTowarow=' + amount, 'count_zagiel', 'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}
function validate_eraty()
{
  var zagielconfirm = document.getElementById('zagiel_confirm');
  if (!zagielconfirm) {
    return false;
  }
  if (zagielconfirm.checked) {
    return true;
  } else {
    alert(zagielnotconfirmed)
    return false;
  }
}
/* Wyszukiwarka ver. 3.5 (searching - searching) [53403]*/

function traitsList53403()
{
    var traitId;
    var traitsList = document.getElementsByName("traits[]");
    var traits = '';
    var element;
    for (i=0; i < traitsList.length; i++) {
        element = traitsList.item(i);
        traitId = element.value;
        element.disabled="disabled";
        if (traitId > 0) {
            if (traits != '') {
                traits = traits + ",";
            }
            traits = traits + traitId;
        }
    }
    if (traits != '') {
        traitsinput = document.getElementById("traitsinput").value= traits;
    }
}
/* Formularz dodawania nowego klienta 2 (client-new - client_new_form) [53475]*/

function clientnew_delivery_addr() {
    if (document.getElementById('deliver_to_billingaddr').checked) {
        document.getElementById('delivery_address_form').style.display = 'none';
    } else {
        document.getElementById('delivery_address_form').style.display = 'block';
    }
}
/* <span style="color:blue;font-weight:bold;">ZALECANY</span> Wybór płatność  - Formularz (order-newpayment - newpayment_form) [53474]*/

function orderpayment(id) {

document.getElementById('idle_payment').style.display = 'none';
    allDivs = document.getElementsByTagName("div");

    for (i = 0; i < allDivs.length; i++) {
        if ((/^newpayment_form_/).test(allDivs[i].id) == true) {
            allDivs[i].style.display = 'none';
        }
    }

    if (document.getElementById('newpayment_form_'+id) ) {
        document.getElementById('newpayment_form_'+id).style.display = 'block';
    }
}
/* Lista adresów dostawy klienta (client-addresses - client_addresses_list) [53417]*/

function client_addresses_list_confirmdelete() {
    return confirm('Are you sure you want to delete the selected delivery address?');
}
/* Order 1 Nowy z wyborem płatności ver 3.5 (order1 - order1) [53506]*/

function wite(description) {

desc.innerHTML = description;

}


function order1_shop_payformdiv(show, id)
{


var wartosc;
if (id.value){
wartosc = id.value;
}
else{
wartosc = id.innerHTML;
}

if (document.getElementById('comment_cont'))
{
document.getElementById('comment_cont').innerHTML = document.getElementById(wartosc).innerHTML;
}
else
{
//setTimeout('order1_shop_payformdiv('+show+', ''+id+'')', 2000);
}


    if (show) {
        document.getElementById('payform_div').style.display = 'block';
    } else {
        document.getElementById('payform_div').style.display = 'none';
        document.getElementById('payform_id').selectedIndex = 0;

        allDivs = document.getElementsByTagName("div");
        for (i = 0; i < allDivs.length; i++) {
            if ((/^newpayment_form_/).test(allDivs[i].id) == true) {
                allDivs[i].style.display = 'none';
            }
        }
    }
}

function order1_changepayform()
{
    selVal = document.getElementById('payform_id').value;
    allDivs = document.getElementsByTagName("div");

    for (i = 0; i < allDivs.length; i++) {
        if ((/^newpayment_form_/).test(allDivs[i].id) == true) {
            allDivs[i].style.display = 'none';
        }
    }

    if (document.getElementById('newpayment_form_'+selVal) ) {
        document.getElementById('newpayment_form_'+selVal).style.display = 'block';
    }
}
/* Detale produktu Praktyczna.pl (kopia) (projector - projector_details) [57177]*/

/**
  Popup
*/

var ns6=document.getElementById&&!document.all;
var ie=document.all;
var html = document.getElementsByTagName("html");
var Popup = {
	link   : '',
	width  : 0,
	height : 0,
        loaded : 0,
	show : function (link,x,y) {
		Popup.link = link;
		Popup.width = x;
		Popup.height = y;
                Popup.loaded = 1;
		if (document.getElementById('big_photo')) {
			document.getElementById('big_photo').style.display = "none";
			document.getElementById('big_photo').src = Popup.link;
		}
		if (!ns6) {Popup.hideSelects(1);}
		Popup.creatLayers();
	},
        reload : function () {
              if (Popup.loaded) {
                     Popup.show(Popup.link,Popup.width,Popup.height);
              }
        },
	hide : function () {
		var edit = document.getElementById('show_popup_photo');
		var cover = document.getElementById('cover');
                //var flashyk = document.getElementById('flash');
                //flashyk.style.visibility= 'visible';
		edit.style.display = "none";
		cover.style.display = "none";
                Popup.loaded = 0;
		if (!ns6) {Popup.hideSelects(0);}
	},
	creatLayers : function () {

//document.getElementById('flash').style.visibility= 'hidden';

var edit = document.getElementById('show_popup_photo');
		edit.style.position = 'absolute';
	        edit.style.display = "block";
		edit.style.width = (Popup.width + 10) + "px";
		edit.style.height = (Popup.height + 40) + "px";
	    edit.style.left = ns6? (Popup.pageSizes()[2] - (Popup.width + 10))/2 + html[0].scrollLeft +"px" : (Popup.pageSizes()[2] - (Popup.width + 10))/2 + "px";

var ver_brow=0;
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE");
ver_brow=parseFloat(temp[1]);

if (ver_brow<7.0)
 {
edit.style.top = ((((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + document.body.scrollTop) < 0) ? "100px" : (((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + document.body.scrollTop + 100) + "px";
          }
else
{
edit.style.top = ((((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop) < 0) ? "100px" : (((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop + 100) + "px";
}
}
            else
{
edit.style.top = ((((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop) < 0) ? "100px" : (((Popup.pageSizes()[3] - (Popup.height + 10))/2) - 100  + html[0].scrollTop + 100) + "px";
}



            edit.style.zIndex = 1000;
		edit.style.Background = '#FFFFFF';

	    //'cover'- div do blokowania elementow innych niz edit
	    var cover = document.getElementById('cover');
	    cover.style.display = "block";
            cover.style.position = "absolute";
	    cover.style.zIndex = 900;
	    ns6? cover.style.opacity = .5 :  cover.style.filter = "alpha(Opacity=50)";
	    if (window.opera) {
			cover.style.opacity = .5;
		}
		cover.style.left = "0px";
	    cover.style.top = "0px";
            offsetX = 0;
            if (!ns6 && !window.opera) {
                  offsetX = 20;
            }
	    cover.style.width = ns6? (Popup.pageSizes()[0] - 16) + "px" : Popup.pageSizes()[0] - offsetX + "px"; //ns6? html[0].offsetWidth +"px" : document.body.offsetWidth + "px";
	    cover.style.height = Popup.pageSizes()[1] + "px" //ns6? html[0].offsetHeight +"px" : document.body.offsetHeight + "px";
	},
	pageSizes : function () {
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else {
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
	},
	hideSelects : function (flag) {
		var selects = document.getElementsByTagName('SELECT');
		if (flag == 1) {
			for (i = 0; i < selects.length; i++) {
				selects[i].style.display = 'none';
			}
		} else {
			for (i = 0; i < selects.length; i++) {
				selects[i].style.display = '';
			}
		}
	}
}
window.onresize = function() {if (Popup.loaded == 1) {Popup.reload();}}

var displayed = '';
function ImageRotate(id)
{
   if (displayed == '') {
       document.getElementById('img_1').style.display = 'none';
   } else {
       document.getElementById(displayed).style.display = 'none';
   }
   document.getElementById(id).style.display = '';
   displayed = id;
}
function pokarz(id) {

    document.getElementById(id).style.display = 'block';

}
/* menu kategorii 3.5 UNIW A (layout_left - menu_categories) [53359]*/

function menu_categories_toggle(id) {
         if (document.getElementById(id).style.display == 'block') {
              document.getElementById(id).style.display='none'
         } else {
              document.getElementById(id).style.display='block'
         }
}
/* Ukrywacz (cybertronik) (NIE UŻYWAĆ!) (projector - projector_components_hiding) [51413]*/

var components = new Array("component_projector_opinions", "component_projector_dictionary", "component_projector_photos","component_projector_longdescription","component_projector_ordered","component_projector_associated","component_projector_incategory","component_projector_suggestproduct","component_projector_askforproduct");

function showButtons()
{
    var i = 0;
    var activeButtons = components.length;
    for (i = 0; i < components.length; i++) {
        if (document.getElementById(components[i])) {
            document.getElementById('projector_components_hidding').style.display = 'block';
            if (document.getElementById('hide_'+components[i])) {
                document.getElementById('hide_'+components[i]).style.display = 'block';
            }
        }
    }
    setTimeout("showButtons()", 2000);
}

function components_hidding(component)
{
    if (document.getElementById(component) ) {
        for (i = 0; i < components.length; i++) {
            if (document.getElementById(components[i]) ) {
                document.getElementById(components[i]).style.display = 'none';
            }
        }
        document.getElementById(component).style.display = 'block';
    }
}
showButtons();
/* Formularz kontaktu z tematem input (contact - contact_mailform) [50201]*/

if (typeof(newstxt) == "undefined") {
var alert_txt = 'Nie podano żadnego adresu e-mail.';
} 

function checkOnSubmit()
{
    if ((/^[0-9a-zA-Z._\-]+\@[0-9a-zA-Z._\-]+\.[0-9a-zA-Z]+$/).test(document.getElementById("from").value) == false || document.getElementById("from").value.length == 0){
        alert(alert_txt);
        return false;
    }
    return true;
}
/* Newsletter (contact - contact_newsletter) [44013]*/

if (typeof(newstxt) == "undefined") {

} 




function newsletter_blur(x) {
         if (x.value == '') {
                 x.value = contact_newstxt;
         }
}
function newsletter_focus(x) {
         if (x.value == contact_newstxt) {
                 x.value = '';
         }
}
/* Zadaj pytanie o produkt 3.0 (projector - projector_askforproduct) [53316]*/

function askforproduct()
{
    if (document.getElementById("askforproduct_email") ) {
        if ((/^[0-9a-zA-Z.-_]+@[0-9a-zA-Z.-_]+.[0-9a-zA-Z]+$/).test(document.getElementById("askforproduct_email").value) == false || document.getElementById("email").value.length == 0){
            alert('Nie wpisałeś poprawnie adresu e-mail na który mielibyśmy wysłać Ci odpowiedź.');
            return false;
        } else {
            return true;
        }
    }
}
function hideaskforproduct()
{
    if (document.getElementById('projector_askforproduct_table').style.display == 'none') {
        document.getElementById('projector_askforproduct_table').style.display = 'block';
    } else {
        document.getElementById('projector_askforproduct_table').style.display = 'none';
    }
}