/**************************************************************/
/* MdS2008 Javascript function file for Google Earth access   */
/* Includes KML file load and control functions               */
/*                                                            */
/* Author - Richard Pomeroy                                   */
/* Copyright - p4media ltd. 2008                              */
/*                                                            */
/* V1.0 07/11/08 First version, from ge_functions.js          */
/* V1.1 09/11/08 Added Help and About window controls         */
/* V1.2 17/11/08 Help and about files include parameter       */
/* V1.3 27/11/08 Added Download function to call php with     */
/*               parameters of domain and file                */
/*                                                            */
/**************************************************************/
/* <![CDATA[ */
                        
/* Functions */	
                        
//gebid(string id)
//GetElementByID() wrapper
function gebid(e) { return document.getElementById(e); }
                        
//noCache()
//Stop the file cache
function noCache() { return '&r=' + Math.random() * 6500; };
                
// setWindowStatus(String StatusString, timeout ms)
// clears after timeout ms 
function setWindowStatus(statusString, timeout){
    window.status=statusString;
    setTimeout("window.status='';",timeout);
}

function highlight (id, active){
    var PMId = "CollapseMenu" + id + "Item";
    if ((id>=0) && (id<intPlaceMarks)){
        if (active){        
            gebid(PMId).style.backgroundColor= '#ffa500'; // Highlight
            gebid(PMId).style.color= '#480800'; 
        } else if (active==false && id!=currentPlacemarkIndex){
            gebid(PMId).style.backgroundColor = '#480800'; // Normal
            gebid(PMId).style.color= '#ffa500'; 
        }
    }
}

//
//
function toggleFullScreen() {
    var container = gebid('map3d_container');
    var menu = gebid('menu');
    if(boolFullScreen) {
        setWindowStatus ('Set Window Mode', 1200)
        menu.style.display = 'block';
        container.style.top = '30px'; // was 50
        container.style.left = '205px';
        container.style.height = '600px'; // was 750
        container.style.width = '79%'; // was 75%
        boolFullScreen = false;					
    } else {
        setWindowStatus ('Set Fullscreen Mode', 1200)
        menu.style.display = 'none';
        container.style.top = '30px'; // was 21px
        container.style.left = '0px';
        container.style.height = '97%';
        container.style.width = '100%';
        boolFullScreen = true;
    }
}

function SetCursor(cursor) { 
    if (document.all) { 
        for (var i=0;i < document.all.length; i++) { 
            document.all(i).style.cursor = cursor; 
        } 
    } 
} 

function helpWindow (helpFile){
    window.open(helpFile, '', "height=400,width=610,scrollbars=yes,left=20,top=20,resizable=yes")
}

function aboutWindow (aboutFile){
    window.open(aboutFile, '', "height=242,width=270,scrollbars=no,left=50%,top=50%,resizable=no")
}

function download (){
//    alert('download.php?kmldomain=' + strKmlDomain + '&kmlfile=' + strKmlFile);
    window.location='download.php?kmldomain=' + strKmlDomain + '&kmlfile=' + strKmlFile;
}

/* ]]> */
