function check_form(form){
	return_boolean = true	
 obj = eval(form)
 for(i=0;i<obj.length;i++) {
  obj.elements[i].style.color = "black";
  field_name = obj.elements[i].name;
  if (field_name.indexOf("_ck") != -1) {
    if (obj.elements[i].value == "") {
      obj.elements[i].style.backgroundColor = "#FFCC00";
	  obj.elements[i].style.color = "black";
      return_boolean = false	  
    }
    else
    {
      obj.elements[i].style.backgroundColor = "white";
    }
  }
}
return return_boolean;
}


var msg = "";
function killErrors(des,url,line) {
window.status=msg;
return true;
}

//window.onerror = killErrors;



function login_check()
{
if (document.publiclogin.username_ck.value=="")
{
alert ("Input 'Username'!")
document.publiclogin.username_ck.focus();
return false
}


if (document.publiclogin.pass_ck.value=='')     
{
alert ("Input 'Password'!")
document.publiclogin.pass_ck.focus();
return false
}
if (document.publiclogin.code_ck.value=='')     
{
alert ("Input 'Security Code'!")
document.publiclogin.code_ck.focus();
return false
}
}

function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}

function clearf(object,text)
{
 if (object.value == text)
 {
  object.value = "";
  object.focus();
 }
}

function setf(object,text)
{
 if(object.value == "")
 {
  object.value = text;
  this.focus();
 }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function SwitchCatMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("idLeftPartContainer").getElementsByTagName("div"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu3")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function SelectSubCatMenu(PrID,id){
	document.prodCatForm.action="";
	document.prodCatForm.prodPrCat.value=PrID;
	document.prodCatForm.prodCat.value=id;
	document.prodCatForm.mode.value="showSubCat";
//	document.prodCatForm.method="post";
	document.prodCatForm.submit();
}

function button_over(eButton)
	{
	eButton.style.backgroundColor = "#B5BDD6";
	eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
	}
function button_out(eButton)
	{
	eButton.style.backgroundColor = "threedface";
	eButton.style.borderColor = "threedface";
	}
function button_down(eButton)
	{
	eButton.style.backgroundColor = "#8494B5";
	eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
	}
function button_up(eButton)
	{
	eButton.style.backgroundColor = "threedface";
	eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
	eButton = null; 
	}

	
function transfer() {
	document.input_form.text1.value = oDiv1.innerHTML;
	document.input_form.text1_plain.value = oDiv1.innerText;
	document.input_form.text2.value = oDiv2.innerHTML;
	document.input_form.text2_plain.value = oDiv2.innerText;
}

function doSwitch(x)
{
	if (x == 1) 
	{
		document.forms.switchform.cmd.value = "create";
		document.forms.switchform.submit();
	}
	if (x == 2)	
	{
					
			document.forms.switchform.cmd.value = "update";
			document.forms.switchform.submit();		
	}	
	
	if (x == 0) 
	{
		document.forms.switchform.cmd.value = "PicNone";
		document.forms.switchform.submit();
	}
}


function no_error()
{ return true; }
//window.onerror=no_error;


function checkChoice(field, i) {
if (i == 0) { // "All" checkbox selected.
if (field[0].checked == true) {
for (i = 1; i < field.length; i++)
field[i].checked = false;

   }
}
else  {  // A checkbox other than "Any" selected.
if (field[i].checked == true) {
field[0].checked = false;

      }
   }
}



   var activeItem;
    function showContent(checkObj){
        if(activeItem && activeItem!=checkObj){    // Close previous opened item
            document.getElementById(activeItem.value).style.display='none';    // The value of the checkbox matches the id of the div
            activeItem.checked=false;
        }
        var style='none';
        if(checkObj.checked)style='block';
        document.getElementById(checkObj.value).style.display=style;
        activeItem = checkObj;        
    }
	
	
	 

function submitForm(formId) {
	var f = document.getElementById(formId)	
	f.submit()
}



function Disab (val) {

if(val=="1") 
{input_form.speichern.disabled=true
}
}

function check1() {
  var ext = document.input_form.bild1.value;
  	var ext2 = document.input_form.bild2.value;
  		var ext3 = document.input_form.bild3.value;
  
 ext = ext.substring(ext.length-3,ext.length);
 	ext2 = ext2.substring(ext2.length-3,ext2.length);
    	ext3 = ext3.substring(ext3.length-3,ext3.length);
 
 ext = ext.toLowerCase();
	ext2 = ext2.toLowerCase();
		ext3 = ext3.toLowerCase();
		
if(ext!='') {

  if(ext != 'jpg' && ext != 'gif' && ext != 'png') 
  {
    alert('Sie haben ein .'+ext+
          ' Bildformat ausgewählt; Erlaubt sind nur .jpg, .gif, und .png Formate!');
    return false; 
	}
				}

if(ext2!='') {

  if(ext2 != 'jpg' && ext2 != 'gif' && ext2 != 'png') 
  {
    alert('Sie haben ein .'+ext2+
          ' Bildformat ausgewählt; Erlaubt sind nur .jpg, .gif, und .png Formate!');
    return false; 
	}
				}
				
if(ext3!='') {

  if(ext3 != 'jpg' && ext3 != 'gif' && ext3 != 'png') 
  {
    alert('Sie haben ein .'+ext3+
          ' Bildformat ausgewählt; Erlaubt sind nur .jpg, .gif, und .png Formate!');
    return false; 
	}
				}				
		
		
		
  else 

    return true; 
	
}


  function DivSetVisible(state)
  {
   var DivRef = document.getElementById('PopupDiv');
   var IfrRef = document.getElementById('DivShim');
   if(state)
   {
    DivRef.style.display = "block";
    IfrRef.style.width = DivRef.offsetWidth;
    IfrRef.style.height = DivRef.offsetHeight;
    IfrRef.style.top = DivRef.style.top;
    IfrRef.style.left = DivRef.style.left;
    IfrRef.style.zIndex = DivRef.style.zIndex - 1;
    IfrRef.style.display = "block";
   }
   else
   {
    DivRef.style.display = "none";
    IfrRef.style.display = "none";
   }
  }
  
function drugSet(layname) {
	drugObj = null;
	if (document.all) drugObj = document.all(layname);
	else if (document.getElementById)  drugObj = document.getElementById(layname);
	if (!drugObj.style.left) drugObj.style.left = 0;
	if (!drugObj.style.top) drugObj.style.top = 0;
	drugObj.onmousedown = down; // offsetX offsetY????;
	drugObj.onmouseup = function () {document.onmousemove = null;}
}

function down(e) {
	var obj = this;
	if (document.all) {
		offsetX = event.clientX + document.body.scrollLeft - obj.style.pixelLeft;
		offsetY = event.clientY + document.body.scrollTop - obj.style.pixelTop;
	}
	else if (document.getElementById) {
		offsetX = e.pageX - parseInt(obj.style.left);
		offsetY = e.pageY - parseInt(obj.style.top);
	}
	document.onmousemove = move; // obj.onmousemove = move;
}

function move(e) {
	var obj = drugObj;
	if (document.all) {
		obj.style.pixelLeft = event.clientX + document.body.scrollLeft - offsetX;
		obj.style.pixelTop = event.clientY + document.body.scrollTop - offsetY;
	}
	else if (document.getElementById) {
		obj.style.left = e.pageX - offsetX;
		obj.style.top = e.pageY - offsetY;
	}
}



function toggleDisplay(div,iframe,objpos,pos)
{
	var t=0;
	var l=0;
	var state=false;

	var cNode = document.getElementById(objpos);
	while(cNode.tagName!='BODY'){ 
       		l+=cNode.offsetLeft; 
       		t+=cNode.offsetTop; 
       		cNode=cNode.offsetParent; 
    	}

	var DivRef = document.getElementById(div);
	var IfrRef = document.getElementById(iframe);
   	var ObjPos = document.getElementById(objpos);

	if (DivRef.style.display=="none") {
		state=true;
	} else {
		state=false;
	}

   	if(state)
   	{
    		DivRef.style.display = "block";
    		IfrRef.style.width = DivRef.offsetWidth;
    		IfrRef.style.height = DivRef.offsetHeight;
	
	switch (pos) {
		case "left": 
    			DivRef.style.top = t;
    			DivRef.style.left = (l-ObjPos.offsetWidth);
    			IfrRef.style.top = t;
    			IfrRef.style.left = (l-ObjPos.offsetWidth);
	  		break;
		case "right": 
			DivRef.style.top = t;
			DivRef.style.left = (l+ObjPos.offsetWidth);
    			IfrRef.style.top = t;
    			IfrRef.style.left = (l+ObjPos.offsetWidth);
	  		break;
		case "bottom": 
			DivRef.style.top = (t+ObjPos.offsetHeight);
    			DivRef.style.left = l;
    			IfrRef.style.top = (t+ObjPos.offsetHeight);
    			IfrRef.style.left = l;
	  		break;
		case "top": 
    			DivRef.style.top = (t-ObjPos.offsetHeight);
    			DivRef.style.left = l;
    			IfrRef.style.top = (t-ObjPos.offsetHeight);
    			IfrRef.style.left = l;
	  		break;
        	}


    	IfrRef.style.zIndex = DivRef.style.zIndex - 1;
    	IfrRef.style.display = "block";
    	IfrRef.style.backgroundColor = "black";
   	}
   	else
   	{
    		DivRef.style.display = "none";
    		IfrRef.style.display = "none";
   	}

}

