
function submitZoom(resolution,lang,boundaryType,loopCount){
    var tempString = "&resolution=" + resolution + "&lang=" + lang + "&boundaryType=" + boundaryType + "&sZoomLevel=" + loopCount;
    tempString = tempString + "&cmd=Zoom";
    tempString = tempString + "&switchTab=" + tabValue;
    document.MapForm.action = document.MapForm.action+ tempString;
    document.MapForm.submit();
    return true;
}

function submitZoomIn(resolution,lang,boundaryType,zoomLevel){
    var tempString = "&resolution=" + resolution + "&lang=" + lang + "&boundaryType=" + boundaryType;
    tempString = tempString+"&ZoomLevel=zoomin&sZoomLevel="+zoomLevel;
    tempString=tempString+"&cmd=Zoom";
    document.MapForm.action = document.MapForm.action+ tempString;
    document.MapForm.submit();
    return true;
}

function submitZoomOut(resolution,lang,boundaryType,zoomLevel){
    var tempString = "&resolution=" + resolution + "&lang=" + lang + "&boundaryType=" + boundaryType;
    tempString = tempString+"&ZoomLevel=zoomout&sZoomLevel="+zoomLevel;
    tempString=tempString+"&cmd=Zoom";
    document.MapForm.action = document.MapForm.action+ tempString;    
    document.MapForm.submit();
    return true;
}

function submitPan(resolution,lang,boundaryType,dir){
    var tempString = "&resolution=" + resolution + "&lang=" + lang + "&boundaryType=" + boundaryType;
    tempString = tempString + "&cmd=DoPan&pan=" + dir;
    tempString = tempString + "&switchTab=" + tabValue;
    document.MapForm.action = document.MapForm.action+ tempString;
    document.MapForm.submit();
    return true;
}

function setSwitchTab(){       
        document.MapForm.action = document.MapForm.action+"&switchTab="+tabValue;	        
	return true;
}

function setSearchPass(val){               
        document.MapForm.action = document.MapForm.action+"&searchPass="+val;	          
	return true;
}

function setSearchTheme(val){
    document.MapForm.action = document.MapForm.action+"&searchTheme="+val;	
    return true;
}

function drawHierarchySelected(level,id){

    document.MapForm.action = document.MapForm.action+"&cmd=hierarchy&level="+level+"&placeid="+id;	
    return true;
}

function setThematic(val){
    if(val == '0'){
        document.MapForm.action = document.MapForm.action+"&cmd=thematic&displayThematic=NO";	
    }else{
        document.MapForm.action = document.MapForm.action+"&cmd=thematic&displayThematic=YES";	
    }
    return true;
}

function submitForm(){    
    document.MapForm.submit();
    return true;
}

function layerTab(){
    document.MapForm.action = document.MapForm.action+"&cmd=layerDisplay";
    document.MapForm.action = document.MapForm.action+"&DisplayData=No&displayThematic=NO&displaySearch=NO";
}   
 
function removeLang(){
    var url = document.MapForm.action;
    
    q=url.split("?");
    var newAction = q[0]+"?";
    if (q[1]) {
        //Get all Name/Value pairs from the QueryString
        var pairs = q[1].split('&');
        for (i=0;i<pairs.length;i++) {

            //Get the Name from given Name/Value pair
            var keyval = pairs[i].split('=');

            if (keyval[0] != 'lang') {
            
                if(i==0){
                    newAction = newAction+pairs[i];
                }else{
                    newAction = newAction+"&"+pairs[i];
                }
            }
            
        }        
    }
    document.MapForm.action = newAction;
    
}

function switchLanguage(val){    
    document.MapForm.action = document.MapForm.action+"&otherLang="+val;
    removeLang();
    document.MapForm.action = document.MapForm.action+"&lang="+val;  
}

//remove resolution value from MapForm.action and
//replace it with the argument value passed to the function.
function redrawMapSize(val){
    var url = document.MapForm.action;
    
    q=url.split("?");
    var newAction = q[0]+"?";
    if (q[1]) {
        //Get all Name/Value pairs from the QueryString
        var pairs = q[1].split('&');
        for (i=0;i<pairs.length;i++) {

            //Get the Name from given Name/Value pair
            var keyval = pairs[i].split('=');

            if (keyval[0] != 'resolution') {
            
                if(i==0){
                    newAction = newAction+pairs[i];
                }else{
                    newAction = newAction+"&"+pairs[i];
                }
            }
            
        }        
    }
    document.MapForm.action = newAction;
    
    document.MapForm.action = document.MapForm.action+"&cmd=reDrawMap&resolution="+val;
    showLoadMap();
}
