function showHideDiv(div)
    {  
        var divstyle = new String();
        divstyle = document.getElementById(div).style.visibility;
        if(divstyle.toLowerCase()=="visible" || divstyle == "")
        {
            document.getElementById(div).style.visibility = "hidden";
            document.getElementById(div).style.height = "1px";
            
        }
        else
        {
            document.getElementById(div).style.visibility = "visible";
            document.getElementById(div).style.height = "";
        }
    }



function ajaxLicense(){
	

var pa =''; 
    
var email = document.license.email.value;    
if ( email != undefined) {  // ansonsten js Fehlerquelle
	pa += '&email='+email; 
}		 
			   
var domain = document.license.domain.value;    
if ( domain != undefined) {  // ansonsten js Fehlerquelle
	pa += '&domain='+domain; 
}

	
	
var req = "ext_action=license&ext_process=ajax"+pa;
//alert(req);
ajaxReq(req);

}

	
function ajaxReq(request_str){
    //alert(request_str);
    sndReq('extensions/form/license/ajax.php',request_str);

}

function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function sndReq( dest,postpar) {    
//alert(dest);
	http.open('POST', dest);
    http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    

    http.onreadystatechange = handleResponse;
    http.send(postpar);

}	



function handleResponse() {
    if(http.readyState == 4){
    	
//alert(http.responseText); 
  
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');



            
            if(update[1]=='createDomElement') {
            	
            	

				// call your function to remove all the children from your element
				so_clearInnerHTML(document.getElementById("ajaxResponseMsg"));
				
					            	
				ajaxt = document.createElement("div");  
				ajaxt.setAttribute("id","myAjaxDiv");          	
				ajaxt.appendChild(document.createTextNode(update[3]));            	
				            	
				            	
				            	
				            	
				// alert('8888');
				// create a DIV element, using the variable eDIV as a reference to it
				eDIV = document.createElement("div");
				//use the setAttribute method to assign it an id
				eDIV.setAttribute("id","myAjaxDivHead");
				// add the text "hello world" to the div with createTextNode
				eDIV.appendChild(document.createTextNode(update[2]));
				
				eDIV.appendChild(ajaxt);
				
				// append your newly created DIV element to an already existing element.
				document.getElementById("ajaxResponseMsg").appendChild(ajaxt);
				
				            } 

									
										   
				        }
				    }
				    //openDebugPopup1("save_pos.php");
				    
			if(update[1]=='innerHtml') {	
				var myDiv = document.getElementById('ajaxResponseMsg');
				myDiv.innerHTML = update[2];
			}	    
}	
	
	
function so_clearInnerHTML(obj) {
	// so long as obj has children, remove them
	while(obj.firstChild) obj.removeChild(obj.firstChild);
}

