//**************************************************************************************************************************************************
// paint methode (for the address fields);
// used in the basket/order.html
// d = delivery
// b = billing
// using the array[] basketAddressFields this is defined at the preferences.js
//**************************************************************************************************************************************************/



function paintAddressFields(windowReference, alterable) {
	if(belenusHome.belenusBasket[0].length > 0 && !belenusHome.oci_interface) {
		var d = windowReference.document;
		d.write('<form>');
		if(alterable) {
			d.write('<table border="0" width="100%" align="left" cellspacing="1" cellpadding="0">');
		} else {
			var borderColor = belenusHome.getWebColor(belenusHome.getCSSProperty(belenusHome.document, 'body', 'borderColor'));
			if (borderColor == null) { borderColor = "#000000";}		
			d.write('<table border="0" width="100%" align="left" cellspacing="1" cellpadding="0" style="border-color:'+borderColor+';border-width:1px;border-style:solid;">');
		}
		d.write('<tr><td colspan="3"><b id="'+belenusHome.addLKey("a17"+Math.random(),windowReference,"","b_delivery_address")+'">'+belenusHome.ld['b_delivery_address']+'</b></td></tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("d_name_label",windowReference,"","tdLabel_name")+'">'+belenusHome.ld['tdLabel_name']+'</td>');
			d.write('<td rowspan="5" width="40">&nbsp;</td>');
			d.write('<td><input type="text" id="d_name" size="30" value="'+belenusHome.getUserData('d_name')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a18"+Math.random(),windowReference,"","tdLabel_name")+'">'+belenusHome.ld['tdLabel_name']+'</td>');
			d.write('<td rowspan="5" width="40">&nbsp;</td>');
			d.write('<td>'+belenusHome.getUserData('d_name')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("d_forename_label",windowReference,"","tdLabel_forename")+'">'+belenusHome.ld['tdLabel_forename']+'</td>');
			d.write('<td><input type="text" id="d_forename" size="30" value="'+belenusHome.getUserData('d_forename')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a19"+Math.random(),windowReference,"","tdLabel_forename")+'">'+belenusHome.ld['tdLabel_forename']+'</td>');
			d.write('<td>'+belenusHome.getUserData('d_forename')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("d_street_label",windowReference,"","tdLabel_street")+'">'+belenusHome.ld['tdLabel_street']+'</td>');
			d.write('<td><input type="text" id="d_street" size="30" value="'+belenusHome.getUserData('d_street')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a20"+Math.random(),windowReference,"","tdLabel_street")+'">'+belenusHome.ld['tdLabel_street']+'</td>');
			d.write('<td>'+belenusHome.getUserData('d_street')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td><span id="'+belenusHome.addLKey("d_zipcode_label",windowReference,"","tdLabel_zipcode")+'">'+belenusHome.ld['tdLabel_zipcode']+'</span>/<span id="'+belenusHome.addLKey("d_city_label",windowReference,"","tdLabel_city")+'">'+belenusHome.ld['tdLabel_city']+'</span></td>');
			d.write('<td><input type="text" id="d_zipcode" size="5" maxlength="5" value="'+belenusHome.getUserData('d_zipcode')+'" onchange="belenusHome.setUserData(this.id, this.value)">');
			d.write('&nbsp;<input type="text" id="d_city" size="17" value="'+belenusHome.getUserData('d_city')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td><span id="'+belenusHome.addLKey("a21"+Math.random(),windowReference,"","tdLabel_zipcode")+'">'+belenusHome.ld['tdLabel_zipcode']+'</span>/<span id="'+belenusHome.addLKey("a22"+Math.random(),windowReference,"","tdLabel_city")+'">'+belenusHome.ld['tdLabel_city']+'</span></td>');
			d.write('<td>'+belenusHome.getUserData('d_zipcode')+'&nbsp;/');
			d.write('&nbsp;'+belenusHome.getUserData('d_city')+'</td>');		
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("d_email_label",windowReference,"","tdLabel_email")+'">'+belenusHome.ld['tdLabel_email']+'</td>');
			d.write('<td><input type="text" id="d_email" size="30" value="'+belenusHome.getUserData('d_email')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a23"+Math.random(),windowReference,"","tdLabel_email")+'">'+belenusHome.ld['tdLabel_email']+'</td>');
			d.write('<td>'+belenusHome.getUserData('d_email')+'</td>');
		}
		d.write('</tr>');
		if(alterable) {
			d.write('<tr><td colspan="3">&nbsp;</td></tr>');
		} else {
			d.write('<tr><td colspan="3"><br>&nbsp;<br></td></tr>');
		}
		
		d.write('<tr><td colspan="3"><b id="'+belenusHome.addLKey("a24"+Math.random(),windowReference,"","b_billing_address")+'">'+belenusHome.ld['b_billing_address']+'</b></td></tr>');
		d.write('<tr>');
	
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("b_name_label",windowReference,"","tdLabel_name")+'">'+belenusHome.ld['tdLabel_name']+'</td>');
			d.write('<td rowspan="5" width="40">&nbsp;</td>');
			d.write('<td><input type="text" id="b_name" size="30" value="'+belenusHome.getUserData('b_name')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a25"+Math.random(),windowReference,"","tdLabel_name")+'">'+belenusHome.ld['tdLabel_name']+'</td>');
			d.write('<td rowspan="5" width="40">&nbsp;</td>');
			d.write('<td>'+belenusHome.getUserData('b_name')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("b_forename_label",windowReference,"","tdLabel_forename")+'">'+belenusHome.ld['tdLabel_forename']+'</td>');		
			d.write('<td><input type="text" id="b_forename" size="30" value="'+belenusHome.getUserData('b_forename')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a26"+Math.random(),windowReference,"","tdLabel_forename")+'">'+belenusHome.ld['tdLabel_forename']+'</td>');		
			d.write('<td>'+belenusHome.getUserData('b_forename')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("b_street_label",windowReference,"","tdLabel_street")+'">'+belenusHome.ld['tdLabel_street']+'</td>');
			d.write('<td><input type="text" id="b_street" size="30" value="'+belenusHome.getUserData('b_street')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a27"+Math.random(),windowReference,"","tdLabel_street")+'">'+belenusHome.ld['tdLabel_street']+'</td>');
			d.write('<td>'+belenusHome.getUserData('b_street')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td><span id="'+belenusHome.addLKey("b_zipcode_label",windowReference,"","tdLabel_zipcode")+'">'+belenusHome.ld['tdLabel_zipcode']+'</span>/<span id="'+belenusHome.addLKey("b_city_label",windowReference,"","tdLabel_city")+'">'+belenusHome.ld['tdLabel_city']+'</span></td>');		
			d.write('<td><input type="text" id="b_zipcode" size="5" maxlength="5" value="'+belenusHome.getUserData('b_zipcode')+'" onchange="belenusHome.setUserData(this.id, this.value)">');
			d.write('&nbsp;<input type="text" id="b_city" size="17" value="'+belenusHome.getUserData('b_city')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td><span id="'+belenusHome.addLKey("a28"+Math.random(),windowReference,"","tdLabel_zipcode")+'">'+belenusHome.ld['tdLabel_zipcode']+'</span>/<span id="'+belenusHome.addLKey("a29"+Math.random(),windowReference,"","tdLabel_city")+'">'+belenusHome.ld['tdLabel_city']+'</span></td>');
			d.write('<td>'+belenusHome.getUserData('b_zipcode')+'&nbsp;/');
			d.write('&nbsp;'+belenusHome.getUserData('b_city')+'</td>');
		}
		d.write('</tr>');
		d.write('<tr>');
		if(alterable) {
			d.write('<td id="'+belenusHome.addLKey("b_email_label",windowReference,"","tdLabel_email")+'">'+belenusHome.ld['tdLabel_email']+'</td>');
			d.write('<td><input type="text" id="b_email" size="30" value="'+belenusHome.getUserData('b_email')+'" onchange="belenusHome.setUserData(this.id, this.value)"></td>');
		} else {
			d.write('<td id="'+belenusHome.addLKey("a30"+Math.random(),windowReference,"","tdLabel_email")+'">'+belenusHome.ld['tdLabel_email']+'</td>');
			d.write('<td>'+belenusHome.getUserData('b_email')+'</td>');
		}
		d.write('</tr>');	
		d.write('</table></form>');
	}
}


function paintNoteField(windowReference, alterable) {
	if(belenusHome.belenusBasket[0].length > 0 && belenusHome.displayNoteInBasket) {
		var d = windowReference.document;
		
		d.write('<form><table border="0" width="100%" cellspacing="1" cellpadding="0">');
		if(alterable) {
			d.write('<tr><td><b id="'+belenusHome.addLKey("Note_label",windowReference,"","tdLabel_cartNote")+'">'+belenusHome.ld['tdLabel_cartNote']+'</b></td></tr>');
		}
		d.write('<tr><td>');
		if(alterable) {
			d.write('<textarea id="Note" rows="5" cols="50" onchange="belenusHome.setUserData(this.id, this.value)">'+belenusHome.getUserData('Note')+'</textarea>');
		} else {
			var borderColor = belenusHome.getWebColor(belenusHome.getCSSProperty(belenusHome.document, 'body', 'borderColor'));
			if (borderColor == null) { borderColor = "#000000";}		
			d.write('<div style="width:100%;border-color:'+borderColor+';border-width:1px;border-style:solid;">');
			d.write('<b id="'+belenusHome.addLKey("a31"+Math.random(),windowReference,"","tdLabel_cartNote")+'">'+belenusHome.ld['tdLabel_cartNote']+'</b><br>');
			d.write(belenusHome.getUserData('Note').replace(/\n/g,"<br>"));
			d.write('</div>');
		}
		d.write('</td></tr>');
		d.write('</table></form>');
	}
}

function paintDetailSettings(windowReference, alterable) {
	if(belenusHome.belenusBasket[0].length > 0 && belenusHome.displayNoteInBasket) {
    var d = windowReference.document;
    
    if(alterable) {
      d.write('<form><table border="0" width="100%" cellpadding="0" cellspacing="1">');
      d.write('<tr><td><b><span id="'+belenusHome.addLKey(belenusHome.requestTypes[0]+"_label",windowReference,"","requestTypes_header")+'">');
      if(belenusHome.requestTypes[1].length > 0) {
        d.write(belenusHome.ld['requestTypes_header']);
      } else d.write('&nbsp;');
      d.write('</span></b></td><td><b><span id="'+belenusHome.addLKey(belenusHome.despatchTypes[0]+'_label',windowReference,"","despatchTypes_header")+'">');
      if(belenusHome.despatchTypes[1].length > 0) {
        d.write(belenusHome.ld['despatchTypes_header']);
      } else d.write('&nbsp;');
      d.write('</span></b></td></tr>');
      d.write('<tr>');
      d.write('<td>');
      if(belenusHome.requestTypes[1].length > 0) {
        var selected = "selected";
        if(belenusHome.getUserData(belenusHome.requestTypes[0]) == "") belenusHome.setUserData(belenusHome.requestTypes[0],belenusHome.requestTypes[1][0]); // set default value
        d.write('<select id="'+belenusHome.requestTypes[0]+'" onclick="belenusHome.setUserData(this.id, this.options[this.selectedIndex].value)">');
        for(k in belenusHome.requestTypes[1]) {
          if(belenusHome.getUserData(belenusHome.requestTypes[0]) != "") {
            selected = (belenusHome.getUserData(belenusHome.requestTypes[0]) == belenusHome.requestTypes[1][k]) ? "selected" : "";
            d.write('<option '+selected+' value="'+belenusHome.requestTypes[1][k]+'" id="'+belenusHome.addLKey("b"+Math.random(),windowReference,"",'requestTypes_'+belenusHome.requestTypes[1][k])+'">'+belenusHome.ld['requestTypes_'+belenusHome.requestTypes[1][k]]+'</option>');
          } else {
            d.write('<option '+selected+' value="'+belenusHome.requestTypes[1][k]+'" id="'+belenusHome.addLKey("b"+Math.random(),windowReference,"",'requestTypes_'+belenusHome.requestTypes[1][k])+'">'+belenusHome.ld['requestTypes_'+belenusHome.requestTypes[1][k]]+'</option>');
            selected = "";
          }
          
        }
        d.write('</select>');
      } 
      d.write('</td><td>');
      if(belenusHome.despatchTypes[1].length > 0) {
        var selected = "selected";
        if(belenusHome.getUserData(belenusHome.despatchTypes[0]) == "") belenusHome.setUserData(belenusHome.despatchTypes[0],belenusHome.despatchTypes[1][0]);
        d.write('<select id="'+belenusHome.despatchTypes[0]+'" onclick="belenusHome.setUserData(this.id, this.options[this.selectedIndex].value)">');
        for(jxx in belenusHome.despatchTypes[1]) {
        
          if(belenusHome.getUserData(belenusHome.despatchTypes[0]) != "") {        
            selected = (belenusHome.getUserData(belenusHome.despatchTypes[0]) == belenusHome.despatchTypes[1][jxx]) ? "selected" : "";
            d.write('<option '+selected+' value="'+belenusHome.despatchTypes[1][jxx]+'" id="'+belenusHome.addLKey("b"+Math.random(),windowReference,"",'despatchTypes_'+belenusHome.despatchTypes[1][jxx])+'">'+belenusHome.ld['despatchTypes_'+belenusHome.despatchTypes[1][jxx]]+'</option>');
          } else {
            d.write('<option '+selected+' value="'+belenusHome.despatchTypes[1][jxx]+'" id="'+belenusHome.addLKey("b"+Math.random(),windowReference,"",'despatchTypes_'+belenusHome.despatchTypes[1][jxx])+'">'+belenusHome.ld['despatchTypes_'+belenusHome.despatchTypes[1][jxx]]+'</option>');
            selected = "";
          }        
        }
        d.write('</select>');
      }     
      d.write('</td></tr>');
      d.write('</table></form>');
      
    } else { //unalterable
    	var borderColor = belenusHome.getWebColor(belenusHome.getCSSProperty(belenusHome.document, 'body', 'borderColor'));
    	if (borderColor == null) { borderColor = "#000000";}		
    	d.write('<div style="width:100%;border-color:'+borderColor+';border-width:1px;border-style:solid;">');
        d.write('<table border="0" width="100%" cellpadding="0" cellspacing="1">');
        d.write('<tr><td><b id="'+belenusHome.addLKey("a33"+Math.random(),windowReference,"","requestTypes_header")+'">');
        if(belenusHome.requestTypes[1].length > 0) {
          d.write(belenusHome.ld['requestTypes_header']);
        }
        d.write('</b></td><td><b id="'+belenusHome.addLKey("a34"+Math.random(),windowReference,"","despatchTypes_header")+'">');
        if(belenusHome.despatchTypes[1].length > 0) {
          d.write(belenusHome.ld['despatchTypes_header']);
        }
        d.write('</b></td></tr>');
        d.write('<tr>');
        d.write('<td id="'+belenusHome.addLKey("a35"+Math.random(),windowReference,"",'requestTypes_'+belenusHome.getUserData(belenusHome.requestTypes[0]))+'">');
        if(belenusHome.requestTypes[1].length > 0 && belenusHome.getUserData(belenusHome.requestTypes[0]) != "") {
          d.write(belenusHome.ld['requestTypes_'+belenusHome.getUserData(belenusHome.requestTypes[0])]);
        } 
        d.write('</td><td id="'+belenusHome.addLKey("a36"+Math.random(),windowReference,"",'despatchTypes_'+belenusHome.getUserData(belenusHome.despatchTypes[0]))+'">');
        if(belenusHome.despatchTypes[1].length > 0 && belenusHome.getUserData(belenusHome.despatchTypes[0]) != "") {
          d.write(belenusHome.ld['despatchTypes_'+belenusHome.getUserData(belenusHome.despatchTypes[0])]);
        }     
        d.write('</td></tr>');
        d.write('</table></form>');    
    	d.write('</div>');  
    }
  }
}

var doWhat="";
function doAfter() {
	setTimeout(doWhat,1);
	doWhat="";
}

function paintGhostlyLayer(windowReference) {
	var d = windowReference.document;//visibility:hidden;
	var backC = belenusHome.getWebColor(belenusHome.getCSSProperty(belenusHome.document, 'body', 'backgroundColor'));
	if(backC == null) backC = "silver";
	var borderColor = belenusHome.getWebColor(belenusHome.getCSSProperty(belenusHome.document, 'body', 'borderColor'));
	if (borderColor == null) { borderColor = "#000000";}
	
	d.write('<div id="GhostlyLayer" align="center" style="position:absolute;background-color:'+backC+';visibility:visible;top:0px;left:0px;width:100%;height:100%;z-index:10;">');		
	d.write('<center>');
	d.write('<div style="position:relative;left:3px;top:3;width:400px;height:99%;z-index:100;');
	d.write('background-color:'+backC+';border-color:'+borderColor);
	d.write(';border-top-width:2px;border-left-width:2px;border-right-width:2px;border-bottom-width:2px;border-style:solid">');
	d.write('<table width="10" border="0" cellpadding="0" cellspacing="8"><tr><td>');
	paintAddressFields(windowReference, true);
	d.write('</td></tr><tr><td>');
	paintNoteField(windowReference, true);	
  d.write('</td></tr><tr><td>');
  paintDetailSettings(windowReference, true);
	d.write('</td></tr></table>');
	d.write('<div style="');
	d.write('position:absolute;left:0px;width:396px;height:20px;bottom:0px;border-style:solid;');
	d.write('background-image:url(../../images/basket_ghostly_background.gif);border-color:'+borderColor+';');
	d.write('border-top-width:2px;border-left-width:0px;border-right-width:0px;border-bottom-width:0px;">');
	d.write('<table width="100%" border="0">');
	d.write('<tr><td width="100%">&nbsp;</td><td align="right"><table border="0" cellpadding="0" cellspacing="0" class="tab">');
	d.write('				<tr>');
	d.write('					<td nowrap>');
	d.write('					<img src="../custom/images/i.gif" height="10" width="4">');
	d.write('					<a href="javas'+'cript:belenusHome.checkUserInput(self); if(belenusHome.checkInput.length == 0) { if(!belenusHome.includedOrPopupBasket) {void(belenusHome.WM.getWindowReference(\'basket\').frames[\'theBasket\'].location.href=\'order.html\')} else void(belenusHome.WM.getWindowReference(belenusHome.basketWinName+\'Extra\').frames[\'theBasket\'].location.href=\'order.html\')}"  id="'+belenusHome.addLKey("a37"+Math.random(),windowReference,"","nextStepForm")+'">');
	d.write(            belenusHome.ld['nextStepForm']);
	d.write('					</a>');
	d.write('					<img src="../custom/images/i.gif" height="10" width="8"></td>');
	d.write('			</tr>');
	d.write('		</table>');
	d.write('	</td></tr>');	
	d.write('</table>');
	d.write('</div>');
	d.write('</div>');
	d.write('</center>');
	d.write('</div>');
}

function isTheGhostVisible(windowReference,switchTo) {
	if(switchTo == "yes" && belenusHome.belenusBasket[0].length > 0) {
		windowReference.document.getElementById("GhostlyLayer").style.visibility = "visible";
		windowReference.document.getElementById("GhostlyLayer").style.display = "block";
	}
	else {
		windowReference.document.getElementById("GhostlyLayer").style.visibility = "hidden";
		windowReference.document.getElementById("GhostlyLayer").style.display = "none";
	}
	
}


//**************************************************************************************************************************************************
// -submit basket &-paint submit fields methodes
//**************************************************************************************************************************************************/

function createStandardBasketForm4ServerSubmit(windowReference) {
  var d = windowReference.document;
  if(belenusHome.sendBasketTo.indexOf("mailto:") == -1) {
    d.write('<form name="standardBasketForm4ServerSubmit" id="standardBasketForm4ServerSubmit" action="'+unescape(belenusHome.sendBasketTo)+'" method="post" target="'+belenusHome.name+'">');
  } else {
    d.write('<form name="standardBasketForm4ServerSubmit" id="standardBasketForm4ServerSubmit" action="'+unescape(belenusHome.sendBasketTo)+'" method="post" enctype="text/plain" onsubmit="top.close()">');
  }
  for(i in belenusHome.belenusBasket[0]) {
    var itemValue = "";
    for(k in belenusHome.basketServerSendAwayFields) {
      var dash = (belenusHome.basketServerSendAwayFields.length-1 == k) ? "" : "|";
      itemValue += belenusHome.belenusBasket[getFieldPos(belenusHome.basketFields,belenusHome.basketServerSendAwayFields[k])][i];
      itemValue += dash;
    }
    var pos = (parseInt(i)+1);
    if(parseInt(pos) < 10) {
      pos = "00".concat(pos)
    } else if(parseInt(pos) < 100) {
      pos = "0".concat(pos);
    }
    d.write('<input type="hidden" name="pos'+i+'" value="'+itemValue+'"></input>');
  }
  if(belenusHome.basketExtraInfo) {
    for(j in belenusHome.basketAddressFields) {
      d.write('<input type="hidden" name="'+belenusHome.basketAddressFields[j]+'" value="'+getUserData(belenusHome.basketAddressFields[j])+'"></input>');
    }
  }
  d.write('</form>');
}


function createStandardBasketForm4EmailSubmit(windowReference) {
  var d = windowReference.document;
  
  var bodyText = "";
  for(i in belenusHome.belenusBasket[0]) {
    var itemValue = "";
    
    var pos = (parseInt(i)+1);
    if(parseInt(pos) < 10) {
      pos = "00".concat(pos)
    } else if(parseInt(pos) < 100) {
      pos = "0".concat(pos);
    }
    itemValue += "Item Nr.: "+pos+"\n";
    for(k in belenusHome.basketEmailSendAwayFields) {
      var dash = (belenusHome.basketEmailSendAwayFields.length-1 == k) ? "" : "\n";
      itemValue += "  "+ belenusHome.basketEmailSendAwayFields[k] + "= " + belenusHome.belenusBasket[getFieldPos(belenusHome.basketFields,belenusHome.basketEmailSendAwayFields[k])][i];
      itemValue += dash;
    }
    bodyText += itemValue + "\n\n";
  }
  bodyText += "\nExtra Data:\n"
  if(belenusHome.basketExtraInfo) {
    for(j in belenusHome.basketAddressFields) {
      bodyText += "  "+belenusHome.basketAddressFields[j] + "= " +getUserData(belenusHome.basketAddressFields[j])+"\n";
    }
  }

  d.write('<form name="standardBasketForm4EmailSubmit" method="post" id="standardBasketForm4EmailSubmit" enctype="text/plain" action="mailto:'+unescape(belenusHome.sendBasketByEmail)+'?subject='+belenusHome.ld['basketEmailSubmitSubject']+'&body='+escape(bodyText)+'">');
  d.write('</form>');
}

function createXMLExportDoc(doc) {
	with(doc) {
		open();
		write('<form id="fXMLExport" action="'+belenusHome.getPath('xml_exporter.jsp')+'" method="post" accept-charset="utf-8" target="_self">');
		write('<input type="hidden" name="fields" value="'+belenusHome.basketFields.join(',')+'">');
		if(typeof belenusHome.xmlExportFileName != "undefined" && belenusHome.xmlExportFileName != "")
			write('<input type="hidden" name="filename" value="'+belenusHome.xmlExportFileName+'">');
		if(typeof belenusHome.xmlExportContentType != "undefined" && belenusHome.xmlExportContentType != "")
			write('<input type="hidden" name="contenttype" value="'+belenusHome.xmlExportContentType+'">');
		write('<input type="hidden" name="orderlines" value="'+belenusHome.belenusBasket[0].length+'">');

		for(var jj = 0; jj < belenusHome.belenusBasket[0].length; jj++) {
			for(var kk = 0; kk < belenusHome.basketFields.length; kk++) {
				write('<input type="hidden" value="'+belenusHome.belenusBasket[getFieldPos(belenusHome.basketFields,belenusHome.basketFields[kk])][jj]+'" name="'+belenusHome.basketFields[kk]+''+jj+'">');
			}
		}
		
		write('<input type="hidden" name="addressfields" value="'+belenusHome.basketAddressFields.join(',')+'">');
		for(var aa = 0; aa < belenusHome.basketAddressFields.length; aa++) {
			write('<input type="hidden" name="'+belenusHome.basketAddressFields[aa]+'" value="'+belenusHome.getUserData(belenusHome.basketAddressFields[aa])+'">');			
		}
		
		write('</form>');
		close();
	}
}

function getXMLExport(doc) {
	doc.getElementById("fXMLExport").submit();
}

