function photo_window(id, name, width, height, lang) {
    window.open("photo.php?id="+id+"&lang="+lang, "towar", "width="+width+", height="+height);
}

function confDelUrl(message, url){
	var what = confirm(message);
	if (what == true ){
		window.location = url;
		return true;
	}
}

function goBack(url){
    window.location = url;
    return true;
}

function openWindow(wSite, wTitle, wWidth, wHeight) {
//    wWidth=300;
//      wHeight=300;
    //wSite, wTitle, "width="+wWidth+", height="+wHeight
    //allert("dupa");
    window.open(wSite, "_blank", "width="+wWidth+", height="+wHeight);
}

function openWindow2(wSite, wWidth, wHeight) {
//    wWidth=300;
//      wHeight=300;
    //wSite, wTitle, "width="+wWidth+", height="+wHeight
    //allert("dupa");
    window.open(wSite, "_blank", "width="+wWidth+", height="+wHeight);
}

function reloadParent(url) {
    window.opener.location = url;
    window.close();
}

function moveUpList(listField, doc) {
   if ( listField.length == -1) {  // If the list is empty
      alert("Lista jest pusta!");
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         alert("Musisz wybra? element z listy aby go przesun??!");
      } else {  // Something is selected
         if ( listField.length == 0 ) {  // If there's only one in the list

         } else {  // There's more than one in the list, rearrange the list order
            if ( selected == 0 ) {
               alert("Pierwszy element nie mo?e by? przesuni?ty do g?ry.");
            } else {
               // Get the text/value of the one directly above the hightlighted entry as
               // well as the highlighted entry; then flip them
               var moveText1 = listField[selected-1].text;
               var moveText2 = listField[selected].text;
               var moveValue1 = listField[selected-1].value;
               var moveValue2 = listField[selected].value;
               listField[selected].text = moveText1;
               listField[selected].value = moveValue1;
               listField[selected-1].text = moveText2;
               listField[selected-1].value = moveValue2;
//               listField.focus();
               listField.selectedIndex = selected-1; // Select the one that was selected before
               var hidField1 = document.getElementsByName("hidgrid"+moveValue1);
               var hidField2 = document.getElementsByName("hidgrid"+moveValue2);
               var hidField1value = hidField1[0].value;
               var hidField2value = hidField2[0].value;
               hidField1[0].value = hidField2value;
               hidField2[0].value = hidField1value;
            }  // Ends the check for selecting one which can be moved
         }  // Ends the check for there only being one in the list to begin with
      }  // Ends the check for there being something selected
   }  // Ends the check for there being none in the list
}


function moveDownList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      alert("Lista jest pusta!");
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         alert("Musisz wybra? element z listy aby go przesun??!");
      } else {  // Something is selected
         if ( listField.length == 0 ) {  // If there's only one in the list

         } else {  // There's more than one in the list, rearrange the list order
            if ( selected == listField.length-1 ) {
               alert("Ostatni element nie mo?e by? przesuni?ty do g?ry.");
            } else {
               // Get the text/value of the one directly below the hightlighted entry as
               // well as the highlighted entry; then flip them
               var moveText1 = listField[selected+1].text;
               var moveText2 = listField[selected].text;
               var moveValue1 = listField[selected+1].value;
               var moveValue2 = listField[selected].value;
               listField[selected].text = moveText1;
               listField[selected].value = moveValue1;
               listField[selected+1].text = moveText2;
               listField[selected+1].value = moveValue2;
               listField.selectedIndex = selected+1; // Select the one that was selected before
               var hidField1 = document.getElementsByName("hidgrid"+moveValue1);
               var hidField2 = document.getElementsByName("hidgrid"+moveValue2);
               var hidField1value = hidField1[0].value;
               var hidField2value = hidField2[0].value;
               hidField1[0].value = hidField2value;
               hidField2[0].value = hidField1value;

            }  // Ends the check for selecting one which can be moved
         }  // Ends the check for there only being one in the list to begin with
      }  // Ends the check for there being something selected
   }  // Ends the check for there being none in the list
}

