function resizeOneCol()
 {
  var iH    = document.documentElement.clientHeight;
  var iHvis = iH - 220;
  var cH    = GetElementHeight(document.getElementById('col1of1'));
  var fT    = 0;
  var fH    = 0;
  
  //mindesthöhe bei zu kurzem text
  if (cH < 360 ) {
  	cH  = 360;
  	smH = 360;
  	fT  = cH + 210;
  	fH  = cH;
  }
  
  if (cH > iHvis) {
  	smH = iHvis;
  	fT  = iH - 10;
  	fH  = cH - iHvis;
  }
  
  if (iHvis > cH) {
  	smH = cH;
  	fT  = cH + 210;
  	fH  = iHvis;
  }
  
  document.getElementById('col1of1').style.height = cH + 'px';  
  document.getElementById('menu').style.height = smH + 'px';
  document.getElementById('imprintMenu').style.top = fT - 60 + 'px';  
  document.getElementById('footer').style.top = fT + 'px';
  document.getElementById('footer').style.height = fH + 'px';
 
}

function resizeTwoCols()
 {
  var iH    = document.documentElement.clientHeight;
  var iHvis = iH - 220;
  var cH1 = GetElementHeight(document.getElementById('col1of2'));
  var cH2 = GetElementHeight(document.getElementById('col2of2'));
  var fT    = 0;
  var fH    = 0;
  
  var cMax = Math.max(cH1, cH2);
  
  //mindesthöhe bei zu kurzem text
  if (cMax < 360 ) {
  	cMax  = 360;
  	smH = 360;
  	fT  = cMax + 210;
  	fH  = cMax;
  }
  
  if (cMax > iHvis) {
  	smH = iHvis;
  	fT  = iH - 10;
  	fH  = cMax - iHvis;
  }
  
  if (iHvis > cMax) {
  	smH = cMax;
  	fT  = cMax + 210;
  	fH  = iHvis;
  }
  
  document.getElementById('col1of2').style.height = cMax + 'px'; 
  document.getElementById('col2of2').style.height = cMax + 'px'; 
  document.getElementById('menu').style.height = smH + 'px';
  document.getElementById('imprintMenu').style.top = fT - 60 + 'px';  
  document.getElementById('footer').style.top = fT + 'px';
  document.getElementById('footer').style.height = fH + 'px';
 }


function resizeThreeCols()
 {
  var iH    = document.documentElement.clientHeight;
  var iHvis = iH - 220;
  var cH1 = GetElementHeight(document.getElementById('col1of3'));
  var cH2 = GetElementHeight(document.getElementById('col2of3'));
  var cH3 = GetElementHeight(document.getElementById('col3of3'));
  var fT  = 0;
  var fH  = 0;
  
  var cMax = Math.max(cH1, cH2);
  cMax = Math.max(cMax, cH3);
  
  //mindesthöhe bei zu kurzem text
  if (cMax < 360 ) {
  	//alert('one');
  	cMax  = 360;
  	smH = 360;
  	fT  = cMax + 210;
  	fH  = cMax;
  }
  
  if (cMax > iHvis) {
    //alert('two');
  	smH = iHvis;
  	fT  = iH - 10;
  	fH  = cMax - iHvis;
  }
  
  if (iHvis > cMax) {
  	//alert('three');
  	smH = cMax;
  	fT  = cMax + 210;
  	fH  = iHvis;
  }
  
  //alert(cMax +', ' +smH+', '+fT);
  
  document.getElementById('col1of3').style.height = cMax + 'px'; 
  document.getElementById('col2of3').style.height = cMax + 'px'; 
  document.getElementById('col3of3').style.height = cMax + 'px'; 
  document.getElementById('menu').style.height = smH + 'px';
  document.getElementById('imprintMenu').style.top = fT - 60 + 'px';  
  document.getElementById('footer').style.top = fT + 'px';
  document.getElementById('footer').style.height = fH + 'px';
 }
 
 function poptastic(url)
{
	var newwindow;
	newwindow=window.open(url,'name','height=400,width=200');
	if (window.focus) {newwindow.focus()}
}

function GetElementHeight (elm)
{
  if (!elm)
    return 0;

  if (document.layers)
  {
    if (!elm.height)
      elm.height = elm.clip.height;
    return elm.height;
  }
  else if (typeof(elm.style && elm.style.height) == 'number')
  {
    return elm.style.height;
  }
  else if (typeof(elm.style && elm.style.height) == 'string' && !isNaN(parseInt(elm.style.height)))
  {
    return parseInt(elm.style.height);
  }
  else if (elm.offsetHeight)
  {
    return elm.offsetHeight;
  }
  else if (typeof(elm.style && elm.style.pixelHeight) == 'number')
  {
    return elm.style.pixelHeight;
  }
  else if (elm.clientHeight)
  {
    return elm.clientHeight;
  }

  return 0;
}
 
 
 
 function updateIFrame(form, element, iframe, ul) {
	var id = form.elements[element].value;
	var url = ul + id;
	var ifr = null;
	
	ifr = document.getElementById(iframe);
	
	if (ifr != null) {
		ifr.src = url;
	}
}

function focusin(id){
	//diese CSS-Klasse wird bei einem Fokus verwendet
	id.className='border-focus';
}

function focusout(id){
	//diese CSS-Klasse wird verwendet, wenn der Fokus woanders liegt.
	id.className='border-normal';
}

function toggleDivVisibility(id,setVisVal) {
	var el = null;

	el = document.getElementById(id);
	if (el != null){
		if (el.style.display == "block"){
			el.style.display = "none";
		}else{
			el.style.display = "block";
		/*	el.style.overflow = "scroll";
			el.style.height = "350px"; */
		} 
	}
	
	if (setVisVal) {
		var visId = id + 'Visible';
		vis = document.getElementById(visId);
			if (vis != null) {
			if (el.style.display == "block"){
				vis.value = "block";
			}else{
				vis.value ="none";
			}
		}
	}
}


function showInvisibleDiv(id) {
	var el = null;
	el = document.getElementById(id);
	if (el != null){
		el.style.display = "block";
	}
}

function box(msg) {
	alert(msg);
}

function togDisabled(form,id) {
	var el = form.elements[id];
	
	if (el.disabled == true) {
		el.disabled = false;
	} else {
		el.disabled = true;
	}
}

function disableFormElements(form) {
	var el = null;
	
	for (id in form.elements) {
		el = form.elements[id];
		
		if (el != null) {
			if (el.disabled == false) {
				el.disabled = true;
			}	
		}
	}
}

function enableFormElements(form) {
	var el = null;
	
	for (id in form.elements) {
		el = form.elements[id];
		
		if (el != null) {
			if (el.disabled == true) {
				el.disabled = false;
			}	
		}
	}
}

function redirectOutput(MyForm, link) {
var w = window.open(link,'Popup_Window_f4s','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes');
MyForm.target = 'Popup_Window_f4s';

return true;
}

function refreshOutput(link) {
var w = window.open(link,'Popup_Window_f4s','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes');
this.target = 'Popup_Window_f4s';
//return true;
}

function refreshIFrame(surl){
document.frames["supplier_detail"].location = surl;   
document.frames["supplier_detail"].location.refresh();
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}
