var selected;

var submitter = null;



function submitFunction() {
    submitter = 1;
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}  



function popupWindowOffer(url) {

  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600,screenX=150,screenY=150,top=150,left=150')

}  





function selectRowEffect(object, buttonSelect) {

  if (!selected) {

    if (document.getElementById) {

      selected = document.getElementById('defaultSelected');

    } else {

      selected = document.all['defaultSelected'];

    }

  }



  if (selected) selected.className = 'moduleRow';

  object.className = 'moduleRowSelected';

  selected = object;



// one button is not an array

  if (document.getElementById('payment'[0])) {

    document.getElementById('payment'[buttonSelect]).checked=true;

  } else {

    //document.getElementById('payment'[selected]).checked=true;

  }

}



function rowOverEffect(object) {

  if (object.className == 'moduleRow') object.className = 'moduleRowOver';

}



function rowOutEffect(object) {

  if (object.className == 'moduleRowOver') object.className = 'moduleRow';

}



function popupImageWindow(url) {

  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')

}

		







function setcolor(obj,percentage,prop){

	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";

}

// Ende neuer Block





function reload_JS($url){

    window.location.href='$url';

}				



// RADIO

							

function radioWert(rObj) {

  for (var i=0; i<rObj.length; i++) if (rObj[i].checked) return rObj[i].value;

  return false;

}



function unsetRadio(rObj) {

  for (var i=0; i<rObj.length; i++) 

   rObj[i].checked = false;

  return 1;

}



function setradio(feld, wert){

	for (i=0; i<feld.length; i++){

			if(feld[i].value == wert){

				feld[i].checked = true;

			}

	}

}     

//----------------------------------------------------------------

function getElementsByName_iefix(tag, name) {

     

     var elem = document.getElementsByTagName(tag);

     var arr = new Array();

     for(i = 0,iarr = 0; i < elem.length; i++) {

          att = elem[i].getAttribute("name");

          if(att == name) {

               arr[iarr] = elem[i];

               iarr++;

          }

     }

     return arr;

}

//----------------------------------------------------------------				



function showMore(art,radio,showvalue){

	 var rows = getElementsByName_iefix("tr",art);

	 for (i in rows){

		if (rows[i]){

	 		if (radioWert(document.getElementsByName(radio))==showvalue){

				//alert(rows[i].style.display);

	    	rows[i].style.display="";

			}else

		 		rows[i].style.display="none";

		}

	 }

	 

	 return 1;

}



									

function formCheckQuantityMin(document) {



  var products_quantity = document.getElementsByName('products_qty')[0].value;

  var products_quantity_min = document.getElementById('products_quantity_min').value;

  //alert(products_quantity+"----"+products_quantity_min + (products_quantity > products_quantity_min)+(parseInt(products_quantity) > parseInt(products_quantity_min)));

  //alert(document.getElementsByName('products_qty')[0].value+"----"+document.getElementById('products_quantity_min').value );

  if (parseInt(products_quantity) >= parseInt(products_quantity_min)) {

    return true;

  } else {

    alert('Die Mindestbestellmenge von '+ parseInt(products_quantity_min) +' wurde unterschritten.');

    document.getElementsByName('products_qty')[0].value=document.getElementById('products_quantity_min').value;

     return false;

  }

}								

	



function popup(w,h,site) {

        x = screen.availWidth/2-w/2;

        y = screen.availHeight/2-h/2;

        var popupWindow = window.open("","test","width="+w+",height="+h+",left="+x+",top="+y+",screenX="+x+",screenY="+y+",toolbar=no,location=no,directories=0,status=no,menubar=no,scrollbars=no,resizable=no,alwaysRaised=1,dependent=yes");

        popupWindow.document.location=site;

      }

function showProgress(){

 src="i/blind1.gif";

 for (i=1;i<30;i=i+1){

  if (src=="http://www.xdata-server.de/flwfms/i/logout.png"){

  src="http://www.xdata-server.de/flwfms/i/status/red.gif";

  }else{

  src="http://www.xdata-server.de/flwfms/i/logout.png";

  }

  tm=i*60000;

  window.setTimeout("alert(src);popup(50,50,src);",tm);

 }

}



function check_form() {

  var error_message = unescape("<?php echo xtc_js_lang(JS_ERROR); ?>");

  var error_found = false;

  var error_field;

  var keywords = document.getElementById("advanced_search").keywords.value;

  var pfrom = document.getElementById("advanced_search").pfrom.value;

  var pto = document.getElementById("advanced_search").pto.value;

  var pfrom_float;

  var pto_float;



  if ( (keywords == '' || keywords.length < 1) && (pfrom == '' || pfrom.length < 1) && (pto == '' || pto.length < 1) ) {

    error_message = error_message + unescape("<?php echo xtc_js_lang(JS_AT_LEAST_ONE_INPUT); ?>");

    error_field = document.getElementById("advanced_search").keywords;

    error_found = true;

  }



  if (pfrom.length > 0) {

    pfrom_float = parseFloat(pfrom);

    if (isNaN(pfrom_float)) {

      error_message = error_message + unescape("<?php echo xtc_js_lang(JS_PRICE_FROM_MUST_BE_NUM); ?>");

      error_field = document.getElementById("advanced_search").pfrom;

      error_found = true;

    }

  } else {

    pfrom_float = 0;

  }



  if (pto.length > 0) {

    pto_float = parseFloat(pto);

    if (isNaN(pto_float)) {

      error_message = error_message + unescape("<?php echo xtc_js_lang(JS_PRICE_TO_MUST_BE_NUM); ?>");

      error_field = document.getElementById("advanced_search").pto;

      error_found = true;

    }

  } else {

    pto_float = 0;

  }



  if ( (pfrom.length > 0) && (pto.length > 0) ) {

    if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {

      error_message = error_message + unescape("<?php echo xtc_js_lang(JS_PRICE_TO_LESS_THAN_PRICE_FROM); ?>");

      error_field = document.getElementById("advanced_search").pto;

      error_found = true;

    }

  }



  if (error_found == true) {

    alert(error_message);

    error_field.focus();

    return false;

  }

}



function popupWindow(url) {

  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')

}

      


