<!-- Navi Functions -->
<!-- *************************************************************************************************************** -->

if (SID==null) {
	var SID=0
}	

var lastViewpoint;
var nLoadModels=0;
var loading=0;
var startLoadingTime;
var actTarget3D;

function selectFullScreenMode(target3D,targetList,hint) {
  var modes=target3D.getDisplayModes();
  var html='';
//alert (modes);
	actTarget3D=target3D;
  var m = modes.split('#');
  for(j=1;j<m.length;j++) {
    var x =m[j].split('@');
    var p =x[0].split(' ');
    html = html + '<option value=' + x[1] + '>' + p[0] + ' x ' + p[2].replace(",","") + '</option>'
  }
  if (html!='') {
    html = '<option value=0>'+hint+'</option>' + html
    html = '<select style="font-size:9;" ID="fm" onChange="showFullscreenMode(fm.value)">' + html + '</select>';      
    targetList.innerHTML=html;
  }
  else {
    target3D.showDisplayModes('Möchten Sie in den Vollbildmodus wechseln? \nDrehen Sie das Objekt durch Ziehen mit der Maus. \nZurück mit der Taste \'ESC\'', '1024 by 768, True Color (32 bit)');    
  }
}

function showFullscreenMode(fMode) {
  location.href='?SID=' + SID + '&askFullscreenMode='+fMode;  
}


function CheckModelLoading() {

	try {
		var jetzt = new Date();
		var diff=Math.floor((jetzt.getTime()-startLoadingTime)/1000);
		while (((loading == 0) || (diff > 28)) == false)
		 {
			var jetzt = new Date();
			diff=Math.floor((jetzt.getTime()-startLoadingTime)/1000);
			alert("One Moment - Scene is still loading (" + (30-diff) + " sec) ...");
		}
	}
	catch (e) {}
}

function startLoading() {
	loading=1;
	try {
		var jetzt = new Date();
		startLoadingTime=jetzt.getTime();
	}
	catch (e) {}
}

function endLoading() {
	window.setTimeout('loading=0;', 500);
}


function changeLang(newLang,myGroupLink) {
  document.location.href='?Reset=Y&lang='+newLang+myGroupLink;
}

function findArticle(what,filterShop,MsgToShort) {
	if (what!=null) {
	  if (what.length > 1) location.href='?SID=' + SID + '&doJob=SEARCH&what=' + escape(what) + '&filterShop=' + filterShop; 
	  else window.alert(MsgToShort); 
	}
}


function findInShop(what,shop,filterShop,MsgToShort)  {
	if (what!=null) {
	  if (what.length > 1) location.href=shop+'?SID=' + SID + '&doJob=SEARCH&what=' + escape(what) + '&filterShop=' + filterShop; 
	  else window.alert(MsgToShort); 
	}
}


function editData(filterShop,LSID,LS,UG,Lingua,ditta,artID,GroupItemKey) {
	url = '../jump.asp?SID=' + SID + '&main='+filterShop+'&LSID='+LSID+'&LS='+LS+'&UG='+UG+'&Lingua='+Lingua+'&ditta='+ditta+'&artID='+artID+'&GroupItemKey='+GroupItemKey;
  openNewWindow(url,'EditWindow','width=700,height=600,left=50,top=50,resizable=yes,scrollbars=yes')
}

function showArticle(myBasketDetailID, m_job, isOpen, grpID) { 
  location.href='?SID=' + SID + '&doJob=' + m_job + '&BasketDetailID=' + myBasketDetailID + '&isOpen=' + isOpen + '&grpID='+grpID+'#ensureVisible';
}

function ShowDetail(EAN,grpID,artID,basketDetailID,targetGroup,targetCombi,w,h,targetLayout) {
	if (w=='') w=760;
	if (h=='') h=460;
  if (EAN!='') {
    url='?SID=' + SID + '&EAN='+EAN;
  }
  else {
    if (basketDetailID>0) {
      url='VS_showDetail.asp?SID=' + SID + '&basketDetailID='+basketDetailID+'&targetGroup='+targetGroup+'&targetCombi='+targetCombi+'&targetLayout='+targetLayout;
    }
    else {
      url='VS_showDetail.asp?SID=' + SID + '&grpID='+grpID+'&artID='+artID+'&targetGroup='+targetGroup+'&targetCombi='+targetCombi+'&targetLayout='+targetLayout;
    }
  }
  openNewWindow(url,'configWindow','width='+w+',height='+h+',left=50,top=50,menubar=no,resizable=yes,scrollbars=yes')
}

function OpenGroupID(doJob,groupID) {
  location.href='?SID=' + SID + '&doJob='+doJob+'&GrpID='+groupID;
}

function openLink(myURL) {
  location.href=myURL+'&SID='+SID;
}

function DeleteBasketDetailID(doJob,MsgConfirm,BasketDetailID) {
  if (confirm(MsgConfirm))
    location.href='?SID=' + SID + '&doJob='+doJob+'&doDetailJob=DeleteElement&qty=0&BasketDetailID='+BasketDetailID;
}

function deleteElement(doConfirmMsg,MyBasketDetailID) {
  if (confirm(doConfirmMsg)) 
    window.location.href='?SID=' + SID + '&doJob=XML_PLANNING_CONFIG&doDetailJob=DeleteElement&ElementID='+MyBasketDetailID;
}

function navigateFrame(FrameName,URL){
	document.getElementsByName(FrameName)[0].src=URL;
}

function doCFG(doJob,sortID,BasketDetailID,doDetailJob,optionKey,optionTag,groupsOnly,forceOnOff,doEnsureVisible,addTo,inNewWindow) {
    var ensureVisible='';
    //alert(doJob);
    if (doEnsureVisible==1) ensureVisible='&#ensureVisible'
    var myLink='?SID=' + SID + '&doJob='+doJob+'&sortimentID='+sortID+'&BasketDetailID='+BasketDetailID+'&doDetailJob='+doDetailJob+'&optionKey='+unescape(optionKey)+'&optionTag='+unescape(optionTag)+'&groupsOnly='+groupsOnly+'&forceOnOff='+forceOnOff+'&addTo='+addTo+'&inNewWindow='+inNewWindow+ensureVisible;
    //alert(myLink);
    if ((doJob=='COLOR_SIM_COMPACT')||(doJob=='COLOR_SIM_PROFILE')||(doJob=='CC_COLORSIM')||(doJob=='IN_COLORSIM_DEALER')||(doJob=='IN_COLORSIM_SALES')||(doJob=='IN_COLORSIM_ADMIN')||(doJob=='IN_COLORSIM_PDF')||(doJob=='DE_COLORSIM_SALES')||(doJob=='RE_COLORSIM_SALES')||(doJob=='IN_COLORSIM_READER')||(doJob=='RE_COLORSIM_READER')) {
    	top.navigateFrame('ColorsimInfo','VS_ColorSimInfo.asp'+myLink);
    	//top.navigate('VS_ColorSimInfo.asp'+myLink);
    	
		} else {
			location.href=myLink;
		}
}

function DeleteClient(doConfirm) {
  if (confirm(doConfirm)) {
    location.href='?SID=' + SID + '&doJob=ARCHIV_CLIENTLIST&DeleteClient=1';
  }
}

function openImage(url) {
    var newWindow=window.open('VS_image.asp?SID=' + SID + '&url=' + url,'Ansicht_XL', 'menubar=no,scrollbars=yes');
    if (newWindow==null) alert("Ein Pop-Up-Blocker verhindert das korrekte öffnen eines Fensters. Deaktivieren Sie den Pop-Up-Blocker für dieser Anwendung!");
    else {
	    newWindow.resizeTo(screen.availWidth, screen.availHeight);
	    newWindow.moveTo(0, 0);
	    newWindow.focus();
	}
}
 
function openColorSim(targetSize) {
	var newWindow=window.open('VS_ColorsimImage.asp?SID=' + SID + '&showImage='+targetSize,'Ansicht_XL', 'menubar=no,scrollbars=yes');
	if (newWindow==null) alert("Ein Pop-Up-Blocker verhindert das korrekte öffnen eines Fensters. Deaktivieren Sie den Pop-Up-Blocker für dieser Anwendung!");
	else {
		newWindow.resizeTo(screen.availWidth, screen.availHeight);
		newWindow.moveTo(0, 0);
		newWindow.focus();
	}
}
  
function openWRL(url) {
  openNewWindow('edi_wrl.asp?SID=' + SID + '&wrl=' + url,'Ansicht_3D', 'width=800,height=800,left=50,top=50,resizable=yes,menubar=no');
}

function selPlaningCombi(CombiID) {
	top.document.PlanDialog.location.href='VS_PlanDialog.asp?SID=' + SID + '&doJob=XML_PLANNING_CONFIG&BasketDetailID='+CombiID;
}

<!-- Detail Functions -->
<!-- *************************************************************************************************************** -->

function setElementData(basketDetailID,Interface,newValue,job) {
	window.location.href='?SID=' + SID + '&doJob='+job+'&setElementData='+Interface+'&newValue='+newValue+'&basketDetailID='+basketDetailID;
}

function AddToBasket(BasketDetailID, doJob, actPage, addToGroup, inNewWindow, main) {
  if (document.formButtons!=null) addToGroup=document.formButtons.BasketGroup.value;
  switch(inNewWindow) {
	  case 1:
			// open in new Window
	    opener.location.href=main+'?SID=' + SID + '&BasketDetailID='+BasketDetailID+'&doJob='+doJob+'&actPage='+actPage+'&doDetailJob=AddToBasket&AddToGroup='+addToGroup;
	    top.close();
		  break;
	  case 2:
			// open in embedet frame 
	    top.location.href=main+'?SID=' + SID + '&BasketDetailID='+BasketDetailID+'&doJob='+doJob+'&actPage='+actPage+'&doDetailJob=AddToBasket&AddToGroup='+addToGroup;
		  break;
	  default:
	  	// open in top frame
	  	location.href='?SID=' + SID + '&BasketDetailID='+BasketDetailID+'&doJob=' + doJob + '&actPage=' + actPage + '&doDetailJob=AddToBasket&AddToGroup='+addToGroup;
		  break;
	}
}

function editArticle(main, doJob, artID, inNewWindow) {
  if (inNewWindow) {
    opener.location.href=main+'?SID=' + SID + '&doJob='+doJob+'&artID='+artID;
    top.close();
  }
  else {
  	location.href='?SID=' + SID + '&doJob='+doJob+'&artID='+artID;
	}
} 
 
function AddToPlan(BasketDetailID, inNewWindow, main) {
  if (inNewWindow) {
	  opener.top.location.href=main+'?SID=' + SID + '&BasketDetailID='+BasketDetailID+'&doJob=XML_PLANNING_CONFIG&openCatalog=1&doDetailJob=SelectCatalogElement';
  	top.close();
  }
  else location.href='?SID=' + SID + '&BasketDetailID='+BasketDetailID+'&doJob=XML_PLANNING_CONFIG&openCatalog=1&doDetailJob=SelectCatalogElement';
}

function SelectOnDetailElementID(myBasketDetailID,sortimentID, onElementID) { 
  location.href='?SID=' + SID + '&sortimentID='+sortimentID+'&doJob=PLANING_NEWCONFIG&BasketDetailID='+myBasketDetailID+'&doDetailJob=SelectOnDetailElementID&onElementID=' + onElementID + '&#ensureVisible';
}

function showSortiment(groupID,group,inNewWindow,referrer,main) {
  if (inNewWindow) {
	  isOpener=false;
    if ((referrer== "") && (opener!=undefined)) isOpener=true; 
    if (isOpener) {
      if (group=='') opener.location.href=main+'?SID=' + SID + '&grpID='+groupID;
      else opener.location.href=main+'?SID=' + SID + '&grp='+group;
      top.close();
    }
    else {
      top.location.href=main+'?SID=' + SID + '&grpID='+groupID;
      top.resizeTo(820,600)
    }
  }
  else location.href=main+'?SID=' + SID + '&grpID='+groupID;
}

<!-- Basket Functions -->
<!-- *************************************************************************************************************** -->
function clpSet(myText)
{
	window.clipboardData.setData("Text",myText);
}

function clearBasket(MsgConfirm,actm_job) {
  if (confirm(MsgConfirm))
    //location.href='?SID=' + SID + '&ClearBasket=1&doJob='+actm_job;
    location.href='?reset=Y';
}

function confirmJob(MsgConfirm,newhref,althref) {
  if (confirm(MsgConfirm)) {
    location.href=newhref;
	}
	else {
		if (althref!=undefined) location.href=althref;
	}		
}

function OpenBasketDetailID(doJob, BasketDetailID, GrpID, main) {
  if (BasketDetailID>0) location.href=main+'?SID=' + SID + '&doJob='+doJob+'&BasketDetailID='+BasketDetailID+'&GrpID='+GrpID;
}

function showPrices(job,doShow) { 
  location.href='?SID=' + SID + '&doJob='+job+'&showPrices='+doShow+'&#ensureVisible';
}

function changeQuantity(basketDetailID,newQuantity,job,doConfirmMsg) {
  if (newQuantity==0) {
    if (confirm(doConfirmMsg))
      window.location.href='?SID=' + SID + '&doJob='+job+'&qty='+newQuantity+'&basketDetailID='+basketDetailID;
  }
  else window.location.href='?SID=' + SID + '&doJob='+job+'&qty='+newQuantity+'&basketDetailID='+basketDetailID+'#J'+basketDetailID;
}

function ResearchChangeQuantity(basketDetailID,newQuantity,CallBack,doConfirmMsg) {
  if (newQuantity==0) {
    if (confirm(doConfirmMsg))
      window.location.href='?SID=' + SID + '&doJob=NIX&CallBack='+CallBack+'&qty='+newQuantity+'&basketDetailID='+basketDetailID;
  }
  else window.location.href='?SID=' + SID + '&doJob=NIX&CallBack='+CallBack+'&qty='+newQuantity+'&basketDetailID='+basketDetailID+'#J'+basketDetailID;
}

function moveElement(basketDetailID,dir,job) {
  window.location.href='?SID=' + SID + '&doJob='+job+'&moveElement='+dir+'&basketDetailID='+basketDetailID;
}

function doShow(basketDetailID,how,job) {
  window.location.href='?SID=' + SID + '&doJob='+job+'&doShow='+how+'&basketDetailID='+basketDetailID;
}
    
function EditBasket(basketDetailID, elementType,job) {
  openNewWindow('VS_edit.asp?SID=' + SID + '&basketDetailID='+basketDetailID+'&elementType='+elementType+'&m_job='+job,'ValueShopEditor','width=800,height=700,left=30,top=30,resizable=yes');
}

<!-- Plan Functions -->
<!-- *************************************************************************************************************** -->
	function UserAction(text) {
		try {
			//alert(document.URL);
			document.formPlanDialog.action='?SID=' + SID + '&doJob=XML_PLANNING_CONFIG&'+text;
			document.formPlanDialog.submit();	
		}
		catch (e) 
		{	
			//alert('Fehler in UserAction: ' + text ) 
		}
	}

	function startAction(ActionKey) {
		window.location.href='VS_PlanDialog.asp?SID=' + SID + '&doJob=XML_PLANNING_CONFIG&startAction='+ActionKey+'&#ensureVisible';		
	}

  var doRepeat=true
  var direction
  function move3DElement(Plane, dir, step) {
    try {
	    if (doRepeat) {
	      var offset=5;
	      var PosX=parseFloat(document.form3DInfo.sel_PosX.value);
	      var PosY=parseFloat(document.form3DInfo.sel_PosY.value);
	      var PosZ=parseFloat(document.form3DInfo.sel_PosZ.value);
	      var Rot=parseFloat(document.form3DInfo.sel_Rot.value);
	      //var Rot=" & Replace(Rot, ",", ".") & ";
	      step = step + 1;
	      var ms=50; if (step==1) { ms=200; direction=dir; }
        if (Plane=='XY') {
          //if (top.document.PlanToolbar.myPitch.value=='T') {
            PosX = PosX + Math.round(offset * Math.cos(direction / 180 * Math.PI)*10)/10;
            PosY = PosY - Math.round(offset * Math.sin(direction / 180 * Math.PI)*10)/10;
          //} else {
          //  PosX = PosX + Math.round(offset * Math.cos((-Rot+direction) / 180 * Math.PI)*10)/10;
          //  PosY = PosY - Math.round(offset * Math.sin((-Rot+direction) / 180 * Math.PI)*10)/10;
          //} 
        }
        else {
           PosZ = PosZ + offset * direction;
        }
        top.document.PlanScene.DragNodeTo(PosX,PosY,PosZ,Rot);
	      document.form3DInfo.sel_PosX.value=PosX;
	      document.form3DInfo.sel_PosY.value=PosY;
	      document.form3DInfo.sel_PosZ.value=PosZ;
	      if (doRepeat) window.setTimeout('move3DElement(\''+ Plane + '\',' + step + ')', ms);
	    }
    } 
    catch(e) { 
   		doRepeat=false; 
    }
  }

  function Update3DInfo(PosX,PosY,PosZ,Rot) {
  	PosX=Math.round(PosX*10)/10;	
  	PosY=Math.round(PosY*10)/10;	
  	PosZ=Math.round(PosZ*10)/10;	
  	Rot=Math.round(Rot*10)/10;	
    top.document.form3DInfo.sel_PosX.value=PosX;
    top.document.form3DInfo.sel_PosY.value=PosY;
    top.document.form3DInfo.sel_PosZ.value=PosZ;
    top.document.form3DInfo.sel_Rot.value=Rot;
  }

      
<!-- Print Functions -->
<!-- *************************************************************************************************************** -->

function printData(groupID, format, recursiv) {
  url='VS_createDocument.asp?SID=' + SID + '&doJob=CATALOG&doPrint=1&recursiv=' + recursiv + '&format=' + format + '&groupID='+groupID;
  openNewWindow(url,'PrintWindow','width=960,height=700,left=50,top=50,resizable=yes,scrollbars=yes,menubar=yes');
}

function printItem(myBasketDetailID,format) {
	target='';
	url='VS_CreateDocument.asp?SID=' + SID + '&doJob=DETAILREPORT&doPrint=1&format='+format+'&BasketDetailID=' + myBasketDetailID +'&target='+target;
  openNewWindow(url,'ValueShopPublisher','width=800,height=800,left=40,top=40,resizable=yes,scrollbars=yes,menubar=yes');
}  

function printDocument(myBasketDetailID,format) {
  url='VS_PrintDocument.asp?SID=' + SID + '&doJob=DETAILREPORT&doPrint=1&format='+format+'&BasketDetailID=' + myBasketDetailID;
  openNewWindow(url,'ValueShopPublisher','width=800,height=600,left=40,top=40,resizable=yes,scrollbars=yes,menubar=yes');
}  

function preview(doJob, format, what) {
  url='VS_createDocument.asp?SID=' + SID + '&doJob=' + doJob + '&doPrint=1&format=' + format + '&what=' + what;
  openNewWindow(url, 'ValueShopOffer','width=800,height=600,left=70,top=70,resizable=yes,scrollbars=yes,menubar=yes');
}

function createDoc(doJob, format, GenerateDocAlert, filename) {
  doIt=true;
  if (GenerateDocAlert!='') if (!confirm(GenerateDocAlert)) doIt=false;
  if (doIt) {
    url='VS_createDocument.asp?SID=' + SID + '&doJob=' + doJob + '&format=' + format + '&filename=' + filename;
    openNewWindow(url, 'ValueShopOffer','width=500,height=150,left=70,top=70,resizable=no,scrollbars=no,menubar=no');
  }
}

function selectElements(on) {
 for (var i=0; i < document.formArticleList.elements.length; ++i) {
   if (document.formArticleList.elements[i].name=='DoActionOn') {
     if (on==1) document.formArticleList.elements[i].checked=true;
     else document.formArticleList.elements[i].checked=false;
   }
 }
}

function showPrintDialog() {
	var retval='';
	for (var i=0; i < document.formArticleList.elements.length; ++i) {
	 if (document.formArticleList.elements[i].name=='DoActionOn') {
	   if (document.formArticleList.elements[i].checked==true) retval=retval + '*' + encodeURI(document.formArticleList.elements[i].value);
	 }
	}
	if (retval!='') { 
		var myURL='VS_ReportDialog.asp?SID=' + SID + '&PrintArticles='+retval; 
		openNewWindow(myURL,'ValueshopPrintPublisher','width=810,height=430,left=50,top=20,menubar=no;resizable=no,scrollbars=no'); 
	}
	else { 
		alert('Es wurde nichts ausgewählt! Wählen Sie bitte jene Artikel aus, die Sie drucken möchten.'); 
	}
}

<!-- input functions -->
<!-- ********************************************************************************************* -->

// controlla input numerici
function ChkNumber(item,whatType)
{
  item.value=WithThousands(NoPoints(item.value));
} 

function UpdateValue(itemName, newValue) {
	if (itemName!=null) {
		alert("Error in UpdateValue: "+itemName.Value+" > "+newValue);
		itemName.Value=unescape(newValue);
	}
	else {
		alert("Error in UpdateValue: itemName not found!");
	}
}

function UpdateInnerHTML(itemName, newValue) {
	if (itemName!=null) {
		itemName.innerHTML=unescape(newValue);
	}
	else {
		alert("Error in UpdateInnerHTML: itemName not found!");
	}
}

// toglie i puntini dai numeri
function NoPoints(valore)
{  
  risultato="";
  for (ii=0;ii<valore.length;ii++) {
    car=valore.substr(ii,1);
    if ((car>="0") && (car<="9"))
      risultato=risultato+car;
    if (car==",")
      risultato=risultato+".";
    if (car=="-")
      risultato=risultato+car;
  }
  if (risultato=="")
    risultato="0";
  return (risultato);
}

function WithThousands(valore)
{  
  frac="";
  fra=valore-Math.floor(valore);
  if (fra!=0) 
  {
    valore=Math.floor(valore-fra+.000001);
    fra=Math.floor(fra*100+.50000001);
  } else {
    valore=Math.floor(valore);
  }
  tmp=valore.toString();
  frac=fra.toString();
  if ((fra<10) && (fra>0))
    frac="0"+frac;
  while ((tmp.substr(0,1))=='0')
  {
    tmp=tmp.substr(1,tmp.length-1);
  }
  risultato="";
  while (tmp.length>3)
  {
    parte1=tmp.substr(tmp.length-3,3);
    risultato="."+parte1+risultato;      
    tmp=tmp.substr(0,tmp.length-3);
  }
  risultato=tmp+risultato;
  if ((frac!="") && (frac!="0")) 
    risultato=risultato+","+frac;
  if (risultato.substring(0,2)=='-.')
    risultato="-"+risultato.substring(2,risultato.length-3);
  return (risultato);
}

function ChkDate(item,noMsg)
{
	dateDivisor="."
	msg_mustBeData="Die Eingabe muss ein Datum sein"
	msg_noYear="Ungültiges Jahr"
	msg_noMonth="Ungültiger Monat"
	msg_noDay="Ungültiger Tag"

	//dateDivisor="/"
	//msg_mustBeData="L'inserimento deve essere di tipo data"
	//msg_noYear="Anno non ammesso"
	//msg_noMonth="Mese non ammesso"
	//msg_noDay="Giorno non ammesso"

  var dataX=item.value;
  if (dataX==".")			// la data odierna!
  {
    oggi = new Date();
    dd = "0"+oggi.getDate(); if (dd.length>2) dd=dd.substring(dd,1,2);
    me = oggi.getMonth()+1;
    mm = "0"+me; if (mm.length>2) mm=mm.substring(mm,1,2);
    yy = oggi.getYear();
    dataX=dd+dateDivisor+mm+dateDivisor+yy;
  }
  if (dataX=="")
    return (true);
  retFunc=true;
  ps=dataX.indexOf("/");				/* controllo data con separatore barra */
  if (ps==-1)
    ps=dataX.indexOf(".");				/* oppure separatore punto */
  if (ps==-1) {
    if (dataX.length==6)				/* imposta automaticamente da ggmmaa ad gg/mm/20aa */
    {
			dataX=dataX.substr(0,2)+"/"+dataX.substr(2,2)+"/20"+dataX.substr(4,2);
			ps=dataX.indexOf("/");
    }
    else
    {
			if (noMsg!='Y')
        window.alert (msg_mustBeData);
			item.value='';
      retFunc=false;
    }
  }
  if (retFunc)
  {
    giorno=dataX.substr(0,ps);
    dataX=dataX.substr(ps+1,10);
    ps=dataX.indexOf('/');
    if (ps==-1)
      ps=dataX.indexOf(".");
    if (ps==-1) 
    {
if (noMsg!='Y')
        window.alert (msg_mustBeData);
item.value='';
      retFunc=false;
    } 
    else
    {
      mese=dataX.substr(0,ps);
      anno=dataX.substr(ps+1,10); 
      if (anno=="") anno="0";
      if (mese=="") mese="0";
      if ((isNaN(giorno)) || (isNaN(mese)) || (isNaN(anno)))
      {   
  if (noMsg!='Y')
          window.alert (msg_mustBeData);
  item.value='';
        retFunc=false;
      }
      else
      {
        if (anno<15)
          anno=eval(anno)+2000;
        if (anno<100)
    anno=eval(anno)+1900;
        if (anno<1400)
        {
    if (noMsg!='Y')
 	      window.alert (msg_noYear);
    item.value='';
          retFunc=false;
        } 
	  else
	  {
    if ((mese<1) || (mese>12))
          {  
      if (noMsg!='Y')
        window.alert (msg_noYear);
	      item.value='';
            retFunc=false;
          } 
    else
    {
      gg=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
            if ((mese==2) && ((anno % 4)==0) && (anno!=1900)) 
        gg[mese-1]=29;
            if ((giorno<1) || (giorno>gg[mese-1]))
            { 
	if (noMsg!='Y')
	          window.alert (msg_noMonth);
	item.value='';
              retFunc=false;
            } 
      else
              if (retFunc)
              {  
          /* la data era completamente corretta! */
                p1="0"+giorno; p2="0"+mese;
                if (p1.length>2) p1=p1.substr(1,2);
                if (p2.length>2) p2=p2.substr(1,2);
	          item.value=p1+dateDivisor+p2+dateDivisor+anno;	 
	  aa=anno; mm=mese; gg=giorno;
              }
          }
        }
      }
    }
  }

  if (!retFunc)
  {
    if (noMsg!='Y')
    {
      item.focus();
      item.select();
    }
  }    

  return (retFunc);
}

function AjaxCall(url, divContainer, overwrite) {                              
	//erstellen des requests                 
	var req = null;                
	try{                    
		req = new XMLHttpRequest();                
	}                
	catch (ms){                    
		try{                        
			req = new ActiveXObject("Msxml2.XMLHTTP");                    
		}                     
		catch (nonms){                        
			try{                            
				req = new ActiveXObject("Microsoft.XMLHTTP");                        
				}                         
			catch (failed){                            
				req = null;                        
			}                    
		}                  
	}                
	if (req == null)                      
		alert("Error creating request object!");                                    
		//anfrage erstellen (GET, url ist localhost,                  
		//request ist asynchron 
	var mURL=url+'&'+Math.random();
	req.open("GET", mURL, true);                
		//Beim abschliessen des request wird diese Funktion ausgeführt                
	
	req.onreadystatechange = function() {
		switch(req.readyState) { 
			case 4: 
				if(req.status!=200) { 
					alert("Fehler:"+req.status); 
				} 
				else { 
					if ((req.responseText!='')&&(divContainer!='')) {
						if (divContainer=='Alert') {
								alert(req.responseText);
						} 
						else {
							//schreibe die antwort in den div container mit der id content                                 
							if(overwrite==null) 
								document.getElementById(divContainer).innerHTML += req.responseText;                            
							else
								document.getElementById(divContainer).innerHTML = req.responseText;                            
						}
					}
				}                            
				break;                                                
			default: 
				return false;                            
				break;                             
		}                    
	};                    
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                
	req.send(null);            
}

<!-- Standard functions -->
<!-- *************************************************************************************************************** -->

function checkScreenSize(actScreenSize) {
  var x=screen.width;
  if (x<1000) {
  	if (actScreenSize!='S') location.href='?SID=' + SID + '&ScreenSize=S';  
  }
  else  {
  	if (actScreenSize!='L') location.href='?SID=' + SID + '&ScreenSize=L';  
  }
}

function openNewWindow(winUrl, winName, winOpt) {
  if (winOpt=='') winOpt='width=400,height=400,left=50,top=50,resizable=yes,scrollbars=yes';
  newWindow=open(winUrl,winName,winOpt);
  if (newWindow==null) alert("Ein Pop-Up-Blocker verhindert das korrekte öffnen eines Fensters. Deaktivieren Sie bitte den Pop-Up-Blocker für diese Anwendung.");
  else newWindow.focus();
}

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_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 ImportFile(Importlink,NO_FILE_SELECTED,START_IMPORT_NOW) {
  if (document.formPlanDialog.ImportFile.value.length==0) {
      alert(NO_FILE_SELECTED);
  }
  else  {
    if (confirm(START_IMPORT_NOW)) {
      document.formPlanDialog.action=Importlink+'&ImportFile='+document.formPlanDialog.ImportFile.value;
      document.formPlanDialog.submit();
    }
  }
}
  

