function createOption(val,label){
	var opt = document.createElement('option');
    opt.value = val;
    opt.appendChild(document.createTextNode(label));
    return opt;
}

function in_array( what, where ){
	var a=false;
	for(var i=0;i<where.length;i++){
	  if(what == where[i]){
	    a=true;
        break;
	  }
	}
	return a;
}

function buildRequest(method,ns,content){
	if(content == undefined) content = "";
	var body = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
	"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
	"<soap:Body>" +
	"<" + method + " xmlns=\"" + ns + "\" >" +content+ "</" + method + ">"+
	"</soap:Body>" +
	"</soap:Envelope>";
	return body;
}

function alertX(o){
	var s = '';
	for(x in o){
		s += x +" : "+o[x]+"; \n";
	}
	alert(s);
}

function compareVersionString(v1,v2){
	if(v1 && v2){
		v1 = v1.split('.');
		v2 = v2.split('.');
		i = 0;
		l = Math.min(v1.length,v2.length);
		try {
			for(var i=0;i<l;i++){
				var a = parseInt(v1[i]);
				var b = parseInt(v2[i]);
				if(a == b) continue;
				if(a > b) return 1;
				if(a < b) return -1;
			}
		} catch(e){
			throw "Invalid Version String";
		}
		return 0;
	} else throw "Missing one parameter";
}
