var allWIN = new Array();
var allWOS = new Array();
var lastWOS = new Array();
var lastWIN = new Array();



function is(url,urltarget,w,h)
{	
	var i, x;
	var XFound = 1;
	var attr = "dependent=yes,scrollbars=yes,resizable=yes,status=yes";
	var urlloc="";
var portString = "" ;                      
if ( window.location.port.length > 0 )     
{                                          
  portString = ":"+ window.location.port ; 
}                                          
//urlloc = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port;
//urlloc = window.location.protocol + "//" + window.location.hostname + portString ;
//url = urlloc + url;


	lastWIN[0] = url;

	for(i = 0; i < allWIN.length; ++i)
	{
		if (allWIN[i] == url)
		{
			XFound = 0;
			if (allWOS[i].closed == true)
			{
				allWOS[i] = open(url,urltarget,attr + ",top=100,left=170,width=" + w + ",height=" + h);
		      	allWOS[i].focus();
			}
			else
		      	allWOS[i].focus();
		}
	}

	if (XFound == 1)
	{
		allWIN = allWIN.concat(lastWIN);
		lastWOS[0] = open(url,urltarget,attr + ",top=100,left=170,width=" + w + ",height=" + h);
	      allWOS = allWOS.concat(lastWOS);
      	lastWOS[0].focus();
	}
}


function closeallwin()
{	
	var ip;
	for(ip = 0; ip < allWIN.length; ++ip)
	{
		if (allWOS[ip].closed == false)
               { allWOS[ip].close(); }
	}
}

function showProfile(show)
{ 
	if (show=="J") {
		alert("Ist ihr Profil noch aktuell?"); 
	}	
}

function showMessage(type,liefertage)
{ 
	if (type=="empty") {
		alert("Es wurde keine Bestellung weitergeleitet (Bestellliste ist leer)"); 
	} else if (type=="emptyWithRekl") {
		alert("Ihre Bestellliste war leer - es wurde daher keine Bestellung weitergeleitet.\n " + 
			"Ihre Reklamation wird jedoch umgehend bearbeitet.\n" + liefertage); 
	} else if (type=="okay") {
		alert("Ihre Reklamation wurde weitergeleitet "); 
	} else if (type=="sold") {
		alert("Ihre Bestellung wurde weitergeleitet.\n" + liefertage); 
	} else if (type=="soldWithRekl") {
		alert("Ihre Bestellung und Ihre Reklamation wurden weitergeleitet.\n" + liefertage); 
	}	
}


function give(wert)
{	
        opener.document.forms[0].artikel.value=wert; 
	self.window.close();
	return; 
}

function druckProduktdatenblatt() {
	var anzForms = document.parameterform.anzForms.value; 
	for (i=0; i<anzForms;i++) {
		document.forms[i].print(); 
	}	
	
	
	
}

function abmelden(show)
{	
    if (show=="J"){
    	        window.open("/portal/html/abmelden.html","abmelden","width=300,height=140,location=no,resizeable=no"); 
//   		entscheidung = confirm("Sie haben noch eine offene Bestellliste, wollen Sie die Bestellung tätigen?")
//		if (entscheidung==true) {
//			window.location='/portal/servlet/at.debis.buo.servlets.Bestellliste'; 
			
//		}
//		else window.close(); 

//	} else window.close(); 
// Zurück zur Startseite
	} else this.location='/portal/index.html'; 
	
}


function ruecksetzen()
{	
   		entscheidung = confirm("Wollen Sie wirklich Ihr Sortiment auf den ursprünglichen Zustand zurücksetzen?")
		if (entscheidung==true) {
			document.forms[1].buttonfield.value='loeschen';
			document.forms[1].submit();
			
		}
		 

	
}


function nichtAbmelden()
{	
		opener.location='/portal/servlet/at.debis.buo.servlets.Bestellliste'; 
		this.window.close();	
	
}

function schonAbmelden()
{	
//		this.window.close();	
//		opener.close(); 
		opener.location='/portal/index.html'; 
		this.window.close();	
}




function demolh_anmelden()
{
        document.forms[0].user.value="DEMOLH"; 
        document.forms[0].pw.value="PW20020402"; 
        document.forms[0].submit(); 
}

function demogastro_anmelden()
{	
        document.forms[0].user.value="DEMOGASTRO"; 
        document.forms[0].pw.value="PW20020402"; 
        document.forms[0].submit(); 
}


