<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
?>

<script language="javascript" type="text/javascript"><!--
// dodatkowe funkcje do opakowania jako prezent
var selected_Gift;
function selectRowEffect_Gift(object, buttonSelect) {
  if (!selected_Gift) {
    if (document.getElementById) {
      selected_Gift = document.getElementById('defaultSelected_Gift');
    } else {
      selected_Gift = document.all['defaultSelected_Gift'];
    }
  }
  if (selected_Gift) selected_Gift.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected_Gift = object;
// one button is not an array
  if (document.checkout_address.giftwrap[0]) {
    document.checkout_address.giftwrap[buttonSelect].checked=true;
  } else {
    document.checkout_address.giftwrap.checked=true;
  }
}

function rowOverEffect_Gift(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; }
function rowOutEffect_Gift(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; }
//--></script>

<script language="javascript" type="text/javascript"><!--
var selected_shipping;

function selectRowEffect_Shipping(object, buttonSelect) {
  if (!selected_shipping) {
    if (document.getElementById) {
      selected_shipping = document.getElementById('defaultSelected_Shipping');
    } else {
      selected_shipping = document.all['defaultSelected_Shipping'];
    }
  }

  if (selected_shipping) selected_shipping.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected_shipping = object;

// one button is not an array
  if (document.checkout_address.shipping[0]) {
    document.checkout_address.shipping[buttonSelect].checked=true;
  } else {
    document.checkout_address.shipping.checked=true;
  }
}

function rowOverEffect_Shipping(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; }
function rowOutEffect_Shipping(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; }
//--></script>


<script language="javascript" type="text/javascript"><!--
var selected_peyment;

function selectRowEffect_Peyment(object, buttonSelect) {
  if (!selected_peyment) {
    if (document.getElementById) {
      selected_peyment = document.getElementById('defaultSelected_Peyment');
    } else {
      selected_peyment = document.all['defaultSelected_Peyment'];
    }
  }

  if (selected_peyment) selected_peyment.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected_peyment = object;

// one button is not an array
  if (document.checkout_address.payment[0]) {
    document.checkout_address.payment[buttonSelect].checked=true;
  } else {
    document.checkout_address.payment.checked=true;
  }
}

function rowOverEffect_Peyment(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; }
function rowOutEffect_Peyment(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow';}
//--></script>
<?php echo $payment_modules->javascript_validation(); ?>

<script type="text/javascript">
<!-- <![CDATA[
function pobierz_platnosc() {
  for (x=0; x<document.checkout_address.shipping.length; x++)
   if (document.checkout_address.shipping[x].checked) {
	   var pole = document.checkout_address.shipping[x].value;
   }

  plik = "paytoship.php?q="+pole;
  element = document.getElementById("wynik");

  xml = null;
  element.innerHTML="<img src='popupbox/loader.gif' alt=''>";
  try {
    xml = new ActiveXObject("Microsoft.XMLHTTP"); // IE
  } catch(e) {
    try {
      xml = new XMLHttpRequest(); // Mozilla/FireFox/Opera
    } catch(e) {
      xml = null;
    }
  }
  if (xml != null) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
        element.innerHTML=xml.responseText;
      }
    }
    xml.open("GET", plik, true);
    xml.send(null);
  }
  return false;
}
// ]]> -->

function sprawdz() {
	 var puszka = document.checkout_address.elements['pay_type'].value;
	 if (puszka != '') {
		document.getElementById('platnosci').checked = true;
		if (selected_peyment) selected_peyment.className = 'moduleRow';
		selected_peyment = document.getElementById('tr_platnosci');
		document.getElementById('tr_platnosci').className = 'moduleRowSelected';
	 }
}
function wylacz_platnosci() {
if (document.checkout_address.elements['pay_type']) {
	for (i=0;i<document.checkout_address.pay_type.length;i++) {
		 if (document.checkout_address.pay_type[i].value == '') {
			document.checkout_address.pay_type[i].selected = true;
		 }
	 }
}
}
</script>