image1 = new Image();
image1.src = "i/frame_news.png";

image2 = new Image();
image2.src = "i/ramka_p.png";


function change_lang(lang)
{
	switch (lang)
	{
		case 'PL':
		location.href = "http://www.kanlux.pl"; 
		break;
		case 'RU':
		location.href = "http://www.kanlux.info";
		break;		
		case 'DE':
		location.href = "http://www.kanlux.org";
		break;
		case 'UK':
		location.href = "http://www.kanlux.eu";
		break;
		case 'FR':
		location.href = "http://www.kanlux.net";
		break;						
	}
}

function fillOrderForm(data){

var val = data.split("|");
if(typeof(val[8])=="undefined") { val[8] = ""; }
		document.forms.zamowienie.firma.value = val[1];
		//document.forms.zamowienie.imie.value = val[3];
		//document.forms.zamowienie.nazwisko.value = val[2];
		document.forms.zamowienie.ulica.value = val[4]+' '+val[5];
		document.forms.zamowienie.miasto.value = val[6];
		document.forms.zamowienie.kod.value = val[7];
		document.forms.zamowienie.mag.value = val[8];

}

function zmien_klase(id, newClass) {
	    identity=document.getElementById(id);
	    identity.className=newClass;
	    
    }


function checkUncheckSome(controller,theElements) {
	//Programmed by Shawn Olson
	//Copyright (c) 2006
	//Permission to use this function provided that it always includes this credit text
	//  http://www.shawnolson.net
	//Find more JavaScripts at http://www.shawnolson.net/topics/Javascript/
	
	
	//theElements is an array of objects designated as a comma separated list of their IDs
	//If an element in theElements is not a checkbox, then it is assumed
	//that the function is recursive for that object and will check/uncheck
	//all checkboxes contained in that element
	
	
     var formElements = theElements.split(',');
	 var theController = document.getElementById(controller);
	 for(var z=0; z<formElements.length;z++){
	  theItem = document.getElementById(formElements[z]);
	  if(theItem){
	  if(theItem.type){
        if(theItem.type == 'checkbox' && theItem.id != theController.id){
	     theItem.checked = theController.checked;
	    }
	  } else {
	     // 	    alert(controller);
	    var nextArray = '';
	     for(var x=0;x <theItem.childNodes.length;x++){
	      if(theItem.childNodes[x]){
	        if (theItem.childNodes[x].id){
	          nextArray += theItem.childNodes[x].id+',';
		    }
	      }
	     }
	     checkUncheckSome(controller,nextArray);
	   
	   }
	  
	  }
     }
    }


function addToBasket(item, price, karton, paczka)
{
 num = 	eval("document.forms.bigForm.elements['ile[" + item + "]'].value");
 num = (num==0) ? 1 : num;
 count = (paczka) ? karton*num : num;

//alert(count + " " + num + " " + item);

	document.forms.oneForm.item.value=item;
	document.forms.oneForm.ile.value=count;
	document.forms.oneForm.cena.value=price;

	document.forms.oneForm.submit(); 


}

function insRow()
{
var x=document.getElementById('addProd').insertRow(1)
var y=x.insertCell(0)
var z=x.insertCell(1)
var c=x.insertCell(2)
y.innerHTML='<input type="text" class="reg" name="item[]" maxlength="5" />'
z.innerHTML='<input type="text" class="reg" name="itemCount[]" maxlength="3" value="1" />'
c.innerHTML='<input type="button" class="cpB" value="usuń" onclick="deleteRow(this.parentNode.parentNode.rowIndex)" />'
}

function insRowNew()
{
var x=document.getElementById('B2').insertRow(1)
var y=x.insertCell(0)
var z=x.insertCell(1)
var c=x.insertCell(2)
y.innerHTML='<input type="text" class="regExp" name="item[]" maxlength="5" />'
z.innerHTML='<input type="text" class="regExp" name="itemCount[]" maxlength="3" value="1" />'
c.innerHTML='<input type="button" class="buttonDelete hand" value="" alt="Usuń" title="Usuń" onclick="deleteRowNew(this.parentNode.parentNode.rowIndex)" />'
}

function deleteRowNew(i)
{
document.getElementById('B2').deleteRow(i)
}

function deleteRow(i)
{
document.getElementById('addProd').deleteRow(i)
}

function show(layer)
{
var timerId=setTimeout( function() { return layerOp(layer, 1) }, 200)
}
function hide(layer)
{
var timerId=setTimeout( function() { return layerOp(layer, 0) }, 200)

}
function layerOp(szDivID, iState) 
{
    if(document.layers)           
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)          
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)        
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}


function getCurrent(pic)
 {
return document.getElementById(pic).name;
 }

function pic(imgName, img)
 {
   if (document.images)
    {
          document.getElementById(imgName).name=img;        
      document.getElementById(imgName).src= 'photos/produkty/thb/'+img+'.jpg';
      
    }
 }
 
function pic_mid(imgName, img)
 {
   if (document.images)
    {
          document.getElementById(imgName).name=img;        
      document.getElementById(imgName).src= 'photos/produkty/mid/'+img+'.jpg';
      
    }
 } 


function PopupPic(img) 
 { 
        window.open('popup.php?src=' + img, '', 'resizable=1,HEIGHT=200,WIDTH=200,LEFT=10,TOP=10');
 }

function PopupRms(id) 
 { 
        window.open('rms.php?id=' + id, '', 'resizable=0,HEIGHT=220,WIDTH=400, scrollbars=yes,LEFT=10,TOP=10');
 }

function PopupHelp()
 {
        window.open('infosms.php', '', 'resizable=0,HEIGHT=210,WIDTH=400, scrollbars=no,LEFT=10,TOP=10');
 }

function PopupPhoto(img) 
 { 
        window.open('popup_p.php?src=' + img, '', 'resizable=1,HEIGHT=100,WIDTH=100,LEFT=10,TOP=10');
 }
 
function PopupWindow(target, width, height) 
 { 
        window.open(target, '', 'resizable=0,HEIGHT='+height+',WIDTH='+width+',LEFT=10,TOP=10');
 } 

function gallery(id) 
 { 
        window.open('gallery.php?id=' + id, '', 'resizable=1,HEIGHT=680,WIDTH=740,LEFT=10,TOP=10');
 }

function PopUpPP()
{
window.open('/pp/pp.php','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,fullscreen=no,width=750,height=540,LEFT=10,TOP=10');
}

function selectMenu(target,selObj)
 {
  eval(target+".location='"+selObj.options[selObj.selectedIndex].value+"'");

 }


