﻿// JScript File

// Preload Compensation Calculator Images

function preloadImages() {

    preload_image_object = new Image();
    // set image url
    image_url = new Array();
    image_url[0] = "/Images/Injury_Calculator/body_head.gif";
    image_url[1] = "/Images/Injury_Calculator//body_ankles.gif";
    image_url[2] = "/Images/Injury_Calculator/body_arms_and_sholders.gif";
    image_url[3] = "/Images/Injury_Calculator/body_back.gif";
    image_url[4] = "/Images/Injury_Calculator/body_elbows_and_wrists.gif";
    image_url[5] = "/Images/Injury_Calculator/body_feet.gif";
    image_url[6] = "/Images/Injury_Calculator/body_hands.gif";
    image_url[7] = "/Images/Injury_Calculator/body_hips.gif";
    image_url[8] = "/Images/Injury_Calculator/body_legs_and_knees.gif";
    image_url[9] = "/Images/Injury_Calculator/body_neck.gif";
    var i = 0;
    for (i = 0; i <= 9; i++)
        preload_image_object.src = image_url[i];

}

// Change body image and div visability

function setVisible(id, imgid, div) {
    document.getElementById(id).src = imgid

    // For every injury div, set the display to none
    els = ['headInjury', 'neckInjury', 'backInjury', 'armInjury', 'elbowInjury', 'handInjury', 'hipInjury', 'legInjury', 'ankleInjury', 'footInjury']
    for (var i_tem = 0; i_tem < els.length; i_tem++)
        document.getElementById(els[i_tem]).style.display = "none"

    // Now show the currently highlighted injury text
    document.getElementById(div).style.display = "block"
}

//// Scripts for google map

//var map;
//var localSearch = new GlocalSearch();

//function GeocodeFromPostcode(postcode) {

//    localSearch.setSearchCompleteCallback(null,
//		function() {

//		    if (localSearch.results[0]) {
//		        var resultLat = localSearch.results[0].lat;
//		        var resultLng = localSearch.results[0].lng;
//		        var point = new GLatLng(resultLat, resultLng);
//		        DrawMap(point);
//		    } else {
//		        alert("Postcode not found!");
//		    }
//		});

//    localSearch.execute(postcode + ", UK");
//}
