

function Checkform(flang){
var v="";

v=getFieldValue(document.Contact.LastName,"text");
if(v =="" ) {
  if (flang=="de") {
    alert("Bitte geben Sie Ihren Nachnamen ein!");
  }
  else {
    alert("Please enter your lastname!");
  }
  document.Contact.LastName.focus();
  return false;
}

v=getFieldValue(document.Contact.FirstName,"text");
if(v =="" ) {
  if (flang=="de") {
    alert("Bitte geben Sie Ihren Vornamen ein!");
  }
  else {
    alert("Please enter your firstname!");
  }
  document.Contact.FirstName.focus();
  return false;
}

v=getFieldValue(document.Contact.EMailAddress,"mail");
if(v =="" ) {
  if (flang=="de") {
    alert("Bitte geben Sie Ihre gültige E-Mail Adresse ein!");
  } else {
    alert("Please enter a valid E-Mail address!");
  }
  document.Contact.EMailAddress.focus();
  return false;
}

v=getFieldValue(document.Contact.Phone,"text");
if(v =="" ) {
  if (flang=="de") {
    alert("Bitte geben Sie Ihre Telefonnr. ein!");
  }
  else {
    alert("Please enter your phone number!");
  }
  document.Contact.Phone.focus();
  return false;
}

v=getFieldValue(document.Contact.Company,"text");
if(v =="" )
{
  if (flang=="de") {
    alert("Bitte geben Sie Ihren Firmenname ein!");
  }
  else {
    alert("Please enter your company!");
  }
  document.Contact.Company.focus();
  return false;
}

v=getFieldValue(document.Contact.PostalCode,"text");
if(v =="" )
{
  if (flang=="de") {
    alert("Bitte geben Sie eine Postleitzahl ein!");
  }
  else {
    alert("Please enter your postal code!");
  }
  document.Contact.PostalCode.focus();
  return false;
}

v=getFieldValue(document.Contact.City,"text");
if(v =="" )
{
  if (flang=="de") {
    alert("Bitte geben Sie Ihre Stadt ein!");
  }
  else {
    alert("Please enter your city!");
  }
  document.Contact.City.focus();
  return false;
}

v=getFieldValue(document.Contact.Country,"select");
dvalue="";
if (flang=="de") {
  dvalue="Bitte wählen..";
} else {
  dvalue="Please select..";
}

if(v =="" || v == dvalue)
{
  if (flang=="de") {
    alert("Bitte wählen Sie Ihr Land aus!");
  }
  else {
    alert("Please choose your country!");
  }
  document.Contact.Country.focus();
  return false;
}

v=getFieldValue(document.Contact.Query,"textarea");
if(v =="" )
{
  if (flang=="de") {
    alert("Bitte tragen Sie ein Kommentar ein!");
  }
  else {
    alert("Please enter your comment!");
  }
  document.Contact.Query.focus();
  return false;
}

// Its the end
return true;
}









// **************** A  J A X  ****************

var ComboNum=0;
var ObjectID="";
var httpRequestDebug = false; // if problems occure while using this XML function, set this variable to 'true'. The functions will return error messages if they are 
var isIEBrowser = false;
var req; //global variable which represents the XMLHttpRequest object
var reqType; // the type of request you would like to handle, either XML or RTF (meaning a DOM compatible XML structure or text/html as return value of the request
var actionNo; // because the XMLHttpRequest executes only one Customized function after a successfull return, this number can be used to execute only the specified functions-block in the customized function list, see function "cusActions()"

function loadXMLDoc() { // opens the specified url in the back-end and set's the global "req" variable. This function initializes the whole XMLHttpRequest prozess
   var url = loadXMLDoc.arguments[0];
   if (window.XMLHttpRequest) {    // branch for native XMLHttpRequest object
        req = new XMLHttpRequest();
      } else if (window.ActiveXObject) {  // branch for IE/Windows ActiveX version
        isIEBrowser = true;
        try {
          req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (othermicrosoft) {
          try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (failed) {
            req = false;
          }
        }
    }
    if (!req) {
         if(httpRequestDebug) alert("An error occured, your browser does not support XMLHttpRequest!");
    }
    else {
        req.onreadystatechange = processReqChange; // the property "req.onreadystatechange" handels the state of the request in the back-end and if something changes, the function "processReqChange" will be executed.
        req.open("GET", url, true); // parameter: method (post or get) , url to open in back-end, asynchronous (true or false)
        req.send(null); // optional you could send an additional header or other parameter
    }
}

// handle onreadystatechange event of req object
function processReqChange() {
    if (req.readyState == 4) {
        if (req.status == 200) {
           cusActions();
        } else {
           alert("There was a problem retrieving the data:\n" +
               req.statusText);
        }
    }
}


function cusActions() {

//_change='onChange="onChangeFunction(\''+(ComboNum+1)+'\',this.value);"';

if(ComboNum==1){
 ObjectID="Combo2";
 replaceInnerHTML("Combo2", "") ;
}
if(req.responseText.indexOf("EMPTY")!=0){
document.getElementById("subgrouplayer").style.display = "block";
var _text='<select name="Function" class="ffield">'+req.responseText+'</select>';
replaceInnerHTML(ObjectID, _text)
}
else
document.getElementById("subgrouplayer").style.display = "none";


}


function getResponseRTFMiddle(start,end) {
    var code = req.responseText;
    var ret = code.substring(code.indexOf(start)+(start.length),code.indexOf(end));
    return ret;
}

function getResponseRTFByTag(tagName) {
    var code = req.responseText;
    // get the first occurence of the tag, but only the opening of the tag ("<tagname"), so that attributes will be ignored...
    var tmpCode = code.substring(code.indexOf("<"+tagName)+(1+tagName.length),code.indexOf("</"+tagName+">"));
    // ... and then get the real tag content, by returning the text behind the first ">", which should be the closing character of the tag we searched earlier, excluding any attributes in the tag
    return tmpCode.substr(tmpCode.indexOf(">")+1,tmpCode.length);
}

function replaceInnerHTML(targetID, newContent) {
    var targetObj = document.getElementById(targetID);
	if(targetObj) {
	    targetObj.innerHTML = "";
		targetObj.innerHTML = newContent;
	}
}

function onChangeFunction(combo,key) {

ComboNum=1*combo;


if(ComboNum==1){
 var getkey=language+"~"+key;
}

    var rtfURL = "../CUS_Get_SubgroupCombos?readform&Combo="+combo+"&Key="+getkey;
    loadXMLDoc( rtfURL);
   
}




