<!--//
function setPoiTypeName(typeId, typeName) {
	if ( document.getElementById('poiTypeName') != null) {
    	document.getElementById('poiTypeName').value = typeName;
    } 
    if (document.getElementById('poiType') != null) {
    	document.getElementById('poiType').value = typeId;
    }
    if (document.getElementById('poiName') != null ) {
    	document.getElementById('poiName').value = "My " + typeName;
    	//document.getElementById('poiName').disabled = false;
    }
    if (document.getElementById("poiImage") != null) {
    	document.getElementById("poiImage").src = "images/icons/" + typeId + ".png";
    	document.getElementById("poiImage").style.visibility = 'visible';
    }
    if (document.getElementById('addingPoi') != null) {
    	document.getElementById('addingPoi').value = true;
    }
    //submitWithCommand('poiTypeSelected', null, null, null, null);
    //var url = 'map.do?command=poiTypeSelected&poiTypeName='+typeName+'&poiType='+typeId+'&poiName=My '+ typeName + '&addingPoi='+true;
    //var url = 'map.do?command=dummy';
    var url = 'map.do?command=poiTypeSelected&addingPoi=true' 		     
			     + '&poiTypeName=' + typeName
			     + '&poiType=' + typeId
			     + '&poiName=My ' + typeName
			     + '&ts=' + new Date();	
    //alert('AJAX to ' + url); 
    callOut(url , 'Loading POI Type...', processPoiTypeSelected);
}

function submitWithCommand(c, poiId, lat, lng, excludeInclude){
	document.mapForm.command.value = c;
	document.mapForm.poiId.value = poiId;
	document.mapForm.excludeFromMap.value = excludeInclude;
	document.mapForm.currentLat.value = lat;
	document.mapForm.currentLng.value = lng;
	
	document.mapForm.submit();
}
function checkFieldsAndSubmit(c, poiId, lat, lng, poiAction){   
   if (document.getElementById('poiName').value == null || document.getElementById('poiName').value  == '') {
   	 	alert('Please select a Point of Interest and a Personalized name for it');
   } else {
		submitWithCommand(c, poiId, lat, lng, poiAction);
   }

}
function importSetAndSubmit(c, poiId, lat, lng, poiAction){   
   if (((document.getElementById('selectedPoisetId').value == null || document.getElementById('selectedPoisetId').value  == '')) &&
      ((document.getElementById('withinMiles').value == null) || (document.getElementById('withinMiles').value == '')))
   
   {
   	 	alert('Please select a POI Set from the drop down list OR a distance within which we should search for POIs and then press the Import... button to import all its Points of Interest.');
   } else {
		submitWithCommand(c, poiId, lat, lng, poiAction);
   }

}

function checkCopySetAndSubmit(){   
   if ((document.getElementById('selectedCopyPoisetId').value == null || document.getElementById('selectedCopyPoisetId').value  == '') &&
       (document.getElementById('newPoisetName').value == null || document.getElementById('newPoisetName').value  == '')){
   	 	alert('Please select a POI Set from the drop down list OR specify a NEW Poiset to copy the marked Points of Interest to.');
   } else {
		submitWithCommand('copyToSet',null, null, null, null);
   }

}

function markAllAndSubmit(){   
	submitWithCommand('markAllToCopy',null, null, null, null);
}  

function unMarkAllAndSubmit(){   
	submitWithCommand('unMarkAllToCopy',null, null, null, null);
}

<!--//

var currentSubTab = '';

function showBlock(blockName){
	deactivateSubTab('tab11');
	deactivateSubTab('tab12');
	deactivateSubTab('tab13');
	deactivateSubTab('tab14');	
	if (document.getElementById(blockName) != null) {
		document.getElementById(blockName).style.display = "block";
	} 
	if (blockName == 'tab12Block') {
	    //restoreTab12Block();
	}
}

function restoreTab12Block(){
    document.getElementById('tab12Left').style.width='48%';
    document.getElementById('tab12Left').style.display='block';
    //document.getElementById('orId').style.display='inline';
    //document.getElementById('tab12Right').style.display='inline';
}



function lightUpSubTab(tabName) {

	if (document.getElementById(tabName+'Text') != null) {
		document.getElementById(tabName+'Text').style.color='#003399';
	} 
	
	if (document.getElementById(tabName) != null) {
		document.getElementById(tabName).style.background='#DADADA';
	} 

}

function dimOutSubTab(tabName) {
	if (document.getElementById(tabName+'Text') != null) {
		document.getElementById(tabName+'Text').style.color='#FFFFFF';
	}
	
	if (document.getElementById(tabName) != null) {
		document.getElementById(tabName).style.background='#990099';
	}
}

function dimOutOthersBut(tabName) {
	dimOutSubTab('tab11');
	dimOutSubTab('tab12');
	dimOutSubTab('tab13');
	dimOutSubTab('tab14');	
	lightUpSubTab(tabName);	
	lightUpSubTab(currentSubTab);
}

function dimOutAllButCurrent() {
	dimOutSubTab('tab11');
	dimOutSubTab('tab12');
	dimOutSubTab('tab13');
	dimOutSubTab('tab14');	
	lightUpSubTab(currentSubTab);
}

function deactivateSubTab(tabName) {
	dimOutSubTab(tabName);
	if (document.getElementById(tabName+'Block') != null) {
		document.getElementById(tabName+'Block').style.display = "none";
	}
}



function setCurrentSubtab(subTab){
	currentSubTab = subTab;
}

//-->	

