//252c11fe15cc0c367cc46c4ee083a475
// remove the registerOverlay call to disable the controlbar
hs.registerOverlay(
  {
  thumbnailId: null,
  overlayId: 'controlbar',
  position: 'top right',
  hideOnMouseOut: true
  }
);

hs.graphicsDir														= JS_rb+'global/js/highslide/';
hs.outlineType														= 'rounded-white';
hs.captionEval														= 'this.thumb.title';
hs.showCredits														= false;



var gl_browser_height												= 0;
var gl_browser_width												= 0;

//------------------------------------------------------------------
// breite und hoehe des browserfensters bestimmen
//------------------------------------------------------------------
function init_browser_height_width()
  {
  if(ie && navigator.appVersion.indexOf("Linux") < 0)
    {
    gl_browser_width												= document.documentElement.clientWidth;
    gl_browser_height												= document.documentElement.clientHeight;
	//gl_browser_width												= document.body.clientWidth;
    //gl_browser_height												= document.body.clientHeight;
	}
  else
    {
	gl_browser_width												= innerWidth;
    gl_browser_height												= innerHeight;
    }
  
  //fuer linux
  if(navigator.appVersion.indexOf("Linux") >= 0)
    {
    gl_browser_height												= gl_browser_height-8;
    }
  }


//------------------------------------------------------------------
// bitte warten...
//------------------------------------------------------------------
function cx_show_container(str)
  {
  init_browser_height_width();
  cx_show_schleier();
  document.getElementById(str).style.display						= 'block';
  document.getElementById(str).style.top							= (document.body.scrollTop+parseInt(gl_browser_height/2)-parseInt(document.getElementById(str).offsetHeight/2))+'px';
  document.getElementById(str).style.left							= (parseInt(gl_browser_width/2)-parseInt(document.getElementById(str).offsetWidth/2))+'px';
  setTimeout('cx_container_mittig(\''+str+'\')',100);
  }
function cx_show_schleier()
  {
  int_hoehe															= parseInt(document.getElementById('wrap').offsetHeight);
  if(int_hoehe < gl_browser_height)
    {
	int_hoehe														= gl_browser_height;
	}
  document.getElementById('schleier').style.height					= int_hoehe+'px';
  document.getElementById('schleier').style.display					= 'block';
  try{document.getElementById('schleier').focus();}catch(e){}
  }
function cx_hide_schleier()
  {
  document.getElementById('schleier').style.display					= 'none';
  }
function cx_container_mittig(str)
  {
  // nur ausfuehren, wenn sichtbar
  if(document.getElementById(str).style.display == 'block')
    {
	init_browser_height_width();
	document.getElementById(str).style.top				= (document.documentElement.scrollTop+parseInt(gl_browser_height/2)-parseInt(document.getElementById(str).offsetHeight/2))+'px';
    document.getElementById(str).style.left			= (parseInt(gl_browser_width/2)-parseInt(document.getElementById(str).offsetWidth/2))+'px';
    setTimeout('cx_container_mittig(\''+str+'\')',100);
	}
  }
function cx_hide_container(str)
  {
  document.getElementById(str).style.display						= 'none';
  cx_hide_schleier();
  }


//------------------------------------------------------------------
// AJAX-Framework
//------------------------------------------------------------------
var cx_arr_http_request 											= new Array();

function cx_make_request(str_index,str_url,str_method,cx_parameter,cx_response_function)
  {
  cx_arr_http_request[str_index][0]									= false;
  
  if(window.XMLHttpRequest)
    {// Mozilla, Safari,...
    cx_arr_http_request[str_index][0]									= new XMLHttpRequest();
	if(cx_arr_http_request[str_index][0].overrideMimeType)
	  {
      cx_arr_http_request[str_index][0].overrideMimeType('text/xml');
      }
    }
  else if(window.ActiveXObject)
    {// IE
	try
	  {
      cx_arr_http_request[str_index][0]								= new ActiveXObject("Msxml2.XMLHTTP");
      }
	catch(e)
	  {
	  try
	    {
        cx_arr_http_request[str_index][0]							= new ActiveXObject("Microsoft.XMLHTTP");
        }
	  catch(e)
	    {}
	  }
	}
  
  if(!cx_arr_http_request[str_index][0])
    {
    alert('Giving up :( Cannot create an XMLHTTP instance');
    return false;
    }
  
  //----------------------------------------------------------------
  // response funktion
  //----------------------------------------------------------------
  if(cx_response_function == '')
    {
	cx_arr_http_request[str_index][0].onreadystatechange 			= function()
	  {
	  if(cx_arr_http_request[str_index][0].readyState == 4)
		{
	    if(cx_arr_http_request[str_index][0].status == 200)
		  {
	  	  cx_response_default(str_index);
	  	  }
		}
	  };
    }
  else
    {
	cx_arr_http_request[str_index][0].onreadystatechange 			= eval(cx_response_function);
    }
  
  cx_arr_http_request[str_index][0].open(str_method, str_url, true);
  if(str_method == 'POST')
    {
    cx_arr_http_request[str_index][0].setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    cx_arr_http_request[str_index][0].setRequestHeader("Content-length", cx_parameter.length);
    cx_arr_http_request[str_index][0].setRequestHeader("Connection", "close");
    cx_arr_http_request[str_index][0].send(cx_parameter);
	}
  else
    {
    cx_arr_http_request[str_index][0].send(null);
    }
  }
  
  
//------------------------------------------------------------------
// default response funktion
//------------------------------------------------------------------
function cx_response_default(str_index)
  {
  // 1 ein Objekt?
  if(cx_arr_http_request[str_index][1] != '')
    {
    cx_arr_http_request[str_index][1].innerHTML						= cx_arr_http_request[str_index][0].responseText;
    cx_arr_http_request[str_index][1].style.display					= 'block';
	}
  else
    {
	//alert(cx_arr_http_request[str_index][0].responseText);
	}
  // 2 weitere funktion vorhanden?
  if(cx_arr_http_request[str_index][2] != '')
    {
	eval(cx_arr_http_request[str_index][2]);
	}
  else
    {
	cx_hide_ladevorgang();
	}
  }



//------------------------------------------------------------------
// artikel in den warenkorb legen
//------------------------------------------------------------------
function item_add_to_basket(obj_form)
  {
  str_item															= obj_form.elements['f_artnr'].value;
  str_item_parent													= obj_form.elements['f_artnr_parent'].value;
  int_menge															= obj_form.elements['f_menge'].value.replace(/[^0-9]/g,'');
  
  if(str_item != '' && int_menge != '')
    {
	cx_arr_http_request['atb']										= new Array();
    cx_arr_http_request['atb'][0]									= false;
    cx_arr_http_request['atb'][1]									= '';
    cx_arr_http_request['atb'][2]									= '';
	
	cx_make_request('atb',JS_rb+'./index.php?f_artnr='+str_item+'&f_menge='+int_menge+'&f_artnr_parent='+str_item_parent,'GET','','add_to_basket_response');
	}
  
  return false;
  }


function add_to_basket_response()
  {
  if(cx_arr_http_request['atb'][0].readyState == 4)
	{
	if(cx_arr_http_request['atb'][0].status == 200)
	  {
  	  cx_show_container('item_added_to_basket');
      }
	}
  }


function handleEnter(i_item, event, str_modus)
  {
  var keyCode														= event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
  
  if(keyCode == 13)
    {
	if(str_modus == 'update_basket')
	  {
	  document.forms['form_basket'].submit();
	  }
	}
  }


function delete_item_from_basket(nr)
  {
  document.forms['form_basket'].elements['f_menge[]'][nr].value		= 0;
  document.forms['form_basket'].submit();
  }

