//
//   var isIE = false;
////-----------------------------------------------------------------------------------------------------------------------------
//
//function loadXMLDoc(url, elemento, tipo) {
//
//    var req;
//    // branch for native XMLHttpRequest object
//    if (window.XMLHttpRequest) {
//        req = new XMLHttpRequest();
//        req.onreadystatechange = function() { processReqChange(req,elemento,tipo) };
//        req.open("GET", url, true);
//        req.send(null);
//    // branch for IE/Windows ActiveX version
//    } else if (window.ActiveXObject) {
//        isIE = true;
//        req = new ActiveXObject("Microsoft.XMLHTTP");
//        if (req) {
//            req.onreadystatechange = function() { processReqChange(req,elemento,tipo) };
//            req.open("GET", url, true);
//            req.send();
//        }
//    }
//}
////-----------------------------------------------------------------------------------------------------------------------------
//
//// handle onreadystatechange event of req object
//function processReqChange(req,elemento,tipo) {
//    // only if req shows "loaded"
//    if (req.readyState == 4) {
//        // only if "OK"
//        if (req.status == 200) {
//            clearTopicList(elemento);
//            buildTopicList(req,elemento,tipo);
//         } else {
//            alert("There was a problem retrieving the XML data:\n" +
//                req.statusText);
//         }
//    }
//}
////-----------------------------------------------------------------------------------------------------------------------------
//
//// empty Topics select list content
//function clearTopicList(elemento) {
//    var select = document.getElementById(elemento);
//    while (select.length > 0) {
//        select.remove(0);
//    }
//}
////-----------------------------------------------------------------------------------------------------------------------------
//
//// add item to select element the less
//// elegant, but compatible way.
//function appendToSelect(select, value, content, selected) {
//    var opt;
//	opt = document.createElement("option");
//	opt.value = value;
//    if(selected) {
//		opt.selected = 'true';
//    }
//    opt.appendChild(document.createTextNode(content));
//    select.appendChild(opt);
//}
////-----------------------------------------------------------------------------------------------------------------------------
//
//// fill Topics select list with items from
//// the current XML document
//function buildTopicList(req,elemento, tipo) {
//    var select = document.getElementById(elemento);
//    if(tipo=="TABLE") {
//    	var items = req.responseText;
//	select.innerHTML=items;
//    } else {
//    	var items = req.responseXML.getElementsByTagName("option");
//    	for (var i = 0; i < items.length; i++) {
//        	appendToSelect(select, items[i].getAttribute("value"), items[i].text, items[i].getAttribute("selected"));
//
//    	}
//    }
//}
////-----------------------------------------------------------------------------------------------------------------------------
//
//function refreshSelect(elemento,url,tipo) {
//	clearTopicList(elemento);
//	loadXMLDoc(url+"&ref="+new Date().getTime(),elemento,tipo);
//}  
////-----------------------------------------------------------------------------------------------------------------------------






	function clearOption() {
		selectObject = document.getElementById("destinationCode");

		for (var i=selectObject.options.length-1; i>=0; i--){
		  selectObject.options[i] = null;
		}
	    selectObject.options.selectedIndex = -1;
	}

	function addOption(optionText,optionValue) {
		selectObject = document.getElementById("destinationCode"); 
	    var optionObject = new Option(optionText,optionValue);
	    var optionRank = selectObject.options.length;
	    selectObject.options[optionRank]=optionObject;
	}

	function changeCountry () {
		xCountry = document.getElementById ("countryCode");
		document.getElementById("submiter").src="js-destinations.php?country="+xCountry[xCountry.selectedIndex].value+"&s="+Math.random(100000);		
	}

	
