
function Buy()
{

  var combo = document.getElementsByName("aktionsbutton")[0].value;
  var objCheckBoxes = document.forms["warenkorb"].elements["id"];
  var length  = objCheckBoxes.length;
  var link    = document.forms["warenkorb"].action;
  var IDListe = new Array();
  var counter = 0;
  
  
  if(objCheckBoxes.length == null){
	   if(objCheckBoxes.checked){
	      IDListe.push(objCheckBoxes.value);
		  counter = counter +1;
	   }
	}
  
  for(var i=0; i < length; i++)
    {
        if(objCheckBoxes[i].checked){
	        counter = counter +1;
			var CheckBoxID = objCheckBoxes[i].value;
			IDListe.push(CheckBoxID);
	   }
    }
	
  if(counter != 0){
  
       if(objCheckBoxes.length == null){
	   
	        var ID = objCheckBoxes.value;
			var url = link+"&ajax=buy&buyId="+ID+"&move="+combo+"";
			var ajax = new XMLHttpRequest();
			ajax.open("GET",url,true);         
            ajax.onreadystatechange = function () {
					if (ajax.readyState == 4) {
						document.getElementById("warenkorb").innerHTML = ajax.responseText;
					}
				};	

			ajax.send();
	   }
  
      
      for(var y=0; y < length; y++){
	     if(objCheckBoxes[y].checked){
		    var ID = objCheckBoxes[y].value;
			var url = link+"&ajax=buy&buyId="+ID+"&move="+combo+"";
			var ajax = new XMLHttpRequest();
			ajax.open("GET",url,true);         
            ajax.onreadystatechange = function () {
					if (ajax.readyState == 4) {
						document.getElementById("warenkorb").innerHTML = ajax.responseText;
					}
				};	

			ajax.send();				
		    
		}	
	  }
	   /* Refresh */
	 //window.location.href = link;
  }else{
     alert("Es wurden keine Items selektiert.");  
  }

}

 
function uncheck(id)
{
  var objCheckBoxes = document.forms["warenkorb"].elements["id"];
  var length        = objCheckBoxes.length;
  
  
  if(objCheckBoxes.length == null){
       objCheckBoxes.checked = false;	
  }
  
  for(var i=0; i < length; i++)
    {
        if(objCheckBoxes[i].value == id){
	        objCheckBoxes[i].checked = false;
	   }
    }
    
  aktion(0);
} 
 
function aktion(id)
{
   var AuktionsID = id.value;
   var IDListe = new Array();		
   var objCheckBoxes = document.forms["warenkorb"].elements["id"];
   var length  = objCheckBoxes.length;
   var link    = document.forms["warenkorb"].action;

    if(objCheckBoxes.length == null){
	   if(objCheckBoxes.checked){
	      IDListe.push(objCheckBoxes.value);
	   }
	}
   
	for(var i=0; i < length; i++)
    {
        if(objCheckBoxes[i].checked){
	        var CheckBoxID = objCheckBoxes[i].value;
			IDListe.push(CheckBoxID);
	   }
    }
	

	var url     = link+"&ajax=true&parameter="+IDListe;
    var ajax = new XMLHttpRequest();
    ajax.open("GET",url,true);

	ajax.onreadystatechange = function () {
					if (ajax.readyState == 4) {
						document.getElementById("warenkorb").innerHTML = ajax.responseText;
					}
				};	
	
    ajax.send();    
}	
 
 
 
 
 function ItemSearch()
 {  
    var value;
	var combo;
	var object;
	
	value = document.getElementsByName("info")[0].value;
	combo = document.getElementsByName("Combo")[0].value;
		
	if(combo == 1){
	   object = document.createElement("input");
	   object.type  = "hidden";
	   object.name  = "byName";
	   object.value = value;
	}

	if(combo == 2){
	  object = document.createElement("input");
	  object.type = "hidden";
	  object.name = "byID";
	  object.value = value;
	}

    document.forms["Search"].appendChild(object);	
	document.forms["Search"].submit();

 }
 

 
 
  floatingMenu.add('staticbox',  
        {  
            // Represents distance from left or right browser window  
            // border depending upon property used. Only one should be  
            // specified.  
            // targetLeft: 0,  
            targetRight: 10,  
  
            // Represents distance from top or bottom browser window  
            // border depending upon property used. Only one should be  
            // specified.  
            //targetTop: 0,  
            targetBottom: 1,  
  
            // Uncomment one of those if you need centering on  
            // X- or Y- axis.  
             //centerX: true,  
             //centerY: true,  
  
            // Remove this one if you don't want snap effect  
            snap: true  
        }); 


	