function QI_divText(){
	document.getElementById("text").style.visibility="hidden";
	document.getElementById("text").style.overflow="hidden"; 
}
function write_cookie(n,w){
 var a = new Date();
 e=1000*60*60*24*365;
 a = new Date(a.getTime() +e);
 document.cookie = n+'='+w+'; expires='+a.toGMTString()+';';
}

function read_cookie(n){
 a = document.cookie;
 res = '';
 while(a != '')
 {
  while(a.substr(0,1) == ' '){a = a.substr(1,a.length);}
  cookiename = a.substring(0,a.indexOf('='));
  if(a.indexOf(';') != -1)
  {cookiewert = a.substring(a.indexOf('=')+1,a.indexOf(';'));}
  else{cookiewert = a.substr(a.indexOf('=')+1,a.length);}
  if(n == cookiename){res = cookiewert;}
  i = a.indexOf(';')+1;
  if(i == 0){i = a.length}
  a = a.substring(i,a.length);
 }
 return(res);
}

function delete_cookie(n){
 document.cookie = n+'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}

function nw(url){
    fenstergucker=window.open(url, 'newin','width=10,height=10,directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
    fenstergucker.focus();	
}



function nwin(url){
    fensteri=window.open (url, 'neufen','width=0,height=0,directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
    fensteri.focus();	
}

function nf(url){
    fenst=window.open (url, 'nfen','width=900,height=500,directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
    fenst.focus();	
}
function goToURL(externerLink) { 
	var externerLink
	location=externerLink;
}
var oldid=0;
var oldobj=0;
var actid=0;

function setoldid(id){
	oldid=id;
	actid=id;
}
function selectSHOW(x){
	if(document.getElementById('selectINPUT1')){
		if(x==0){
			document.getElementById('selectINPUT1').style.visibility='visible';
			document.getElementById('selectINPUT2').style.visibility='visible';
		}
		if(x==1){
			document.getElementById('selectINPUT1').style.visibility='hidden';
			document.getElementById('selectINPUT2').style.visibility='hidden';
		}
	}
}
function show_umen(id,obj,leftPos,topPos){

	
	if(id==null)id=act_id;
	if(id){
		document.getElementById(id).style.visibility='visible';

		var test="";
		var point = { x: 0, y: 0 };
	    while (obj){
		    point.x = point.x + parseInt(0+obj.offsetLeft,10);
		    point.y = point.y + parseInt(0+obj.offsetTop,10);
		    obj = obj.offsetParent;
	    }
	    document.getElementById(id).style.left = point.x-5+leftPos;
		document.getElementById(id).style.top = point.y+18+topPos;
	}
	if(oldid && (oldid != id)){
		document.getElementById(oldid).style.visibility='hidden';
		
	}
	oldid=id;
}

function checkall(num){
	for(i=0;i< num;i++){
		if(document.warenk.elements[i*2].checked == false){
			document.warenk.elements[i*2].checked = true;
		}else{
			document.warenk.elements[i*2].checked = false;
		}	
	}
}

function chmen(id,wkid,n,rub){
	if(id == 0){
		menge=document.warenk.elements[n*2+1].value;
		document.location.href="act/do_ch_men.php?wk_id="+wkid+"&menge="+menge+"&n="+n+"&rub="+rub;
	}else {
		menge=document.warenk.elements[n*2+1].value;
		document.location.href="act/do_ch_menge.php?wk_id="+wkid+"&menge="+menge+"&rub="+rub;
		
	}
}	
function handleError() {
	return true;
}
//window.onerror = handleError;

var n=0;
var obj;
var hght=0;
var height=1;
var min_hght=0;
function smooth_size(){
	if(obj){
		h=parseInt(document.getElementById(obj).style.height);
		if(h <= hght && h >= 1){
			nh= n+h;
			nh=nh-10;
			if(nh>hght)nh=hght;
			if(nh<min_hght)nh=min_hght;
			document.getElementById(obj).style.height=nh;
			setTimeout('smooth_size()',100);
		}
	}
}

function size_box(id,th){
	hght=th.offsetHeight;
	h=parseInt(document.getElementById(id).style.height);
	if(!h)document.getElementById(id).style.height=hght;
	min_hght=25;
	obj=id;
	//alert(hght);
	if(h<30){
		n=20;
		height=0;
	}else{
		n=0;
		height=25;
	}
    smooth_size();
    write_cookie(id,height);
}

function get_c_height(c_obj){
	b_hgt=read_cookie(c_obj);
	if(b_hgt > 0) 
		document.getElementById(c_obj).style.height=b_hgt;
}
function size_agb(id){
	hght=300;
	min_hght=1;
	obj=id;
	if(n == 0){
		n=20;
		smooth_size();
	}
	else{
		n=0;	
		smooth_size();
	}
}

var nam=null;
var xpos=null;
var ypos=null;
var xelement=null;
var yelement=null;
function set(id){
	nam=id;
	xpos=parseInt(window.event.x) - parseInt(document.getElementById(nam).style.left);
	ypos=parseInt(window.event.y) - parseInt(document.getElementById(nam).style.top);
	xelement=nam+"x";
	yelement=nam+"y";
}

function move(){
	if(nam){
		document.getElementById(nam).style.top=window.event.y-ypos;
		document.getElementById(nam).style.left=window.event.x-xpos;
		document.posform.elements[xelement].value=window.event.x-xpos;
		document.posform.elements[yelement].value=window.event.y-ypos;
	}
}

function set_pos(){
	if(nam){
		posx=document.getElementById(nam).style.top;
		posy=document.getElementById(nam).style.left;
		nam=null;
	}
}


function ch_table(table){
	url="db_tool/ch_table.php?tabelle="+table;	
	fensteri=window.open(url,'chtable','width=850,height=600,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');	
	fensteri.focus();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

var g_iCount = new Number();
var g_iCount = 10;
function startShopNachrichtCountdown(){
       if((g_iCount - 1) >= 0){
               g_iCount = g_iCount - 1;
               setTimeout('startShopNachrichtCountdown()',1000);             
       }else if(g_iCount==0){
       	MM_showHideLayers('errorDIV_','','hide');
		//location.reload();
       	}
}


function scrolldown(i) {
  self.resizeTo (window_width,i);
     if(i < window_height) {
        setTimeout ("pos_down()",10);
     }
} 
function pos_down() {  
resizeTo(window_width,window_height)     		         	
 // i += 4;
  //scrolldown(i);
}
function scrollup(x) {
  self.resizeTo (window_width,x);
  setTimeout ("pos_up()",10);
}  
function pos_up() {       			
  if(x <= 0) {
    self.close();
  }
  x -= 4;
  scrollup(x);
}
//Warenkorbscroller
ie=document.all?1:0;
n=document.layers?1:0;
var speed=0;
var loop, timer;

function goDown(move){
	if(!document.getElementById("inhalt_").style.top)
		document.getElementById("inhalt_").style.top=1;
	x=parseInt(document.getElementById("inhalt_").style.top);
	y=document.getElementById("inhalt_").offsetHeight*-1;
	y=y+80;
	if(x > y){
		t=document.getElementById("inhalt_").style.top;
		h= parseInt(t)-parseInt(move);
		document.getElementById("inhalt_").style.top=h;
		if(loop) timer=setTimeout("goDown("+move+")",speed);
	}
}
function goUp(move){
	
   if(!document.getElementById("inhalt_").style.top)
		document.getElementById("inhalt_").style.top=1;
	x=parseInt(document.getElementById("inhalt_").style.top);
	if(x<0){
		t=document.getElementById("inhalt_").style.top;
		h= parseInt(t) + parseInt(move);
		document.getElementById("inhalt_").style.top=h;
		if(loop) timer=setTimeout("goUp("+move+")",speed);
	}
}
function noScroll(){
        loop=false;
        clearTimeout(timer);
}



function showYear(){
  var now = new Date();
  var year = now.getYear();
  var month = now.getMonth() + 1;
  var month = ((month < 10) ? " 0" : "") + month;  
  document.write (month+'/'+year);
  }

function order(ch,num,error){
	num=num*2;
	ok=false;
	pfad="act/order.php?dummy=0";
	val=new Array();
	for(i=0;i < num;i=i+2){
		if(document.warenk.elements[i].checked == true){
			val[i]=document.warenk.elements[i].value;
			pfad +="&val["+i+"]="+val[i];
			ok=true;
		}
	}
	if(ok)document.location.href=pfad;
	else alert(error);
}
var w3c = document.getElementById&&!document.all?1:0;;
var msie = document.all?1:0;
function intro(x){
	if(x){
		if (w3c){
			var field=document.getElementById('dict');
			field.addEventListner('dblclick',fetchSel, true);
		}
		if (msie){
			var field=document.all.dict;
			field.ondblclick=fetchSel;
		}
	}
}
function fetchSel(){
	if(document.selection){
		selected=document.selection.createRange().text;
	}
	if(selected!=''){
		document.selection.empty();
	}
	else if(window.getSelection){
		selected=window.getSelection().toString();
		selected=selected.replace(/["!?;:,. ]/g,'');
	}
	popup(selected);
}
function popup(selected){
	var searchURL='http://de.wikipedia.org/';
	var attr = 'wiki/' + escape(selected);
	var param = "width=520,height=400";
	param += ",left=260,top=60";
	param += ",menubar=1";
	param += ",location=1";
	param += ",scrollbars=1";
	param += ",resizable=1";
	param += ",toolbar=1";
	param += ",status=1";
	if(selected != "") {
		popWin = window.open(searchURL + attr,'s',param);
		
	}
}
function writeCURR(x){
	document.write(x);
}
