var s_click = false;
var netscape = false;
var search_box_x = 0;
var search_box_y = 0;

if(navigator.appName.substring(0,8) == "Netscape")
  {
  netscape = true;
  }


function s_press()
{
search_box_origine_x = x - search_box_x;
search_box_origine_y = y - search_box_y;
s_click = true;
}

function s_release()
{
s_click = false;
setCookie('1');
}

function s_replace(e)
{
x = (netscape) ? e.pageX : event.x + document.body.scrollLeft;
y = (netscape) ? e.pageY : event.y + document.body.scrollTop;

if(s_click && document.getElementById)
  {
  search_box_x = x - search_box_origine_x;
  search_box_y = y - search_box_origine_y;
  document.getElementById("search_box").style.left = search_box_x
  document.getElementById("search_box").style.top = search_box_y
  }
}


if(netscape)
  {
  document.captureEvents(Event.MOUSEMOVE);
  }

document.onmousemove = s_replace;



function setCookie(s_state)
{
var cName = "STATE";
var cVisible= s_state;
var cX=search_box_x;
var cY=search_box_y;
var cValue=cVisible + ";" + cX + ";" + cY;
var oneYear= 24*60*60*1000*365;
var expDate=new Date();
expDate.setTime(expDate.getTime() + oneYear);
document.cookie = cName   + "=" + escape(cValue) + "; expires=" + expDate.toGMTString () + ";path=/";
return;
}

function getCookie()
{
var cName = "STATE";
var myCookie = " " + document.cookie + ";";
var searchName = " " + cName + "=";
var startOfCookie = myCookie.indexOf(searchName);
if(startOfCookie != - 1)
  {
  startOfCookie += searchName.length;
  endOfCookie = myCookie.indexOf(";",startOfCookie);
  cValue=unescape(myCookie.substring(startOfCookie,endOfCookie));
  }
  else
     cValue="0;0;0";
return(cValue);
}



function set_search_box_state()
{
var cValue=getCookie();
var cArray=cValue.split(";");

// Alle Infos versorgen
s_x=cArray[1];
s_y=cArray[2];


search_box_x = s_x;
search_box_origine_x=0;
search_box_y = s_y;
search_box_origine_y=0;
document.getElementById("search_box").style.left = search_box_x
document.getElementById("search_box").style.top = search_box_y
 
if(cArray[0] == '1')
  t_visible("search_box");
  else
     t_hidden("search_box");

return;
}


function t_fade(t_state)
{
if(ie4 || !ns6)
  {
  document.all.search_box.style.filter="blendTrans(duration=0.5)";
  document.all.search_box.filters.blendTrans.apply();
  }


if(t_state == "hidden")
  {
  t_hidden("search_box");                                                                               
  v_state="0";
  }
  else
    {
    t_visible("search_box");                                                                            
    v_state="1";                                                                                        
    }

if(ie4 || !ns6)
  document.all.search_box.filters.blendTrans.play();                                                      
                                                                                                          
if(ns6)                                                                                                   
  document.getElementById('search_box').style.visibility=t_state;                                         

setCookie(v_state);                                                                                       
}



function s_option(option_count)
{
o_value=document.s_box.search_box_option_value.value;
o_option=o_value.charAt(option_count);

o_start=Math.abs(option_count) + 1;
img_name="s_option" + option_count;

if(o_option == "0")
  {
  img_src="/images/search_box/s_on.gif";
  new_value=o_value.substr(0,Math.abs(option_count)) + "1" + o_value.substr(o_start);
  }
  else
     {
     img_src="/images/search_box/s_off.gif";
     new_value=o_value.substr(0,Math.abs(option_count)) + "0" + o_value.substr(o_start);
     }
t_image(img_name,img_src);
document.s_box.search_box_option_value.value=new_value;
}


function supply_values()
{
document.s_box.search_box_start.value="1";
return true;
}
