﻿//Description: This is a javascript file that contains all the javascript codes for this website.

/////////////////////////////////////////////////////////////////////////////////////////////////
//Contact Us
function ShowOthersField()
{
    var ddlWhere = document.getElementById("ucContactUs_ddlWhere"); //ddlWhere
    var txtOthers = document.getElementById("ucContactUs_txtOthers"); //txtOthers

    var strSelected = ddlWhere.options[ddlWhere.selectedIndex].value;
    
    if (strSelected == "Others")
    {
        txtOthers.disabled = false;
        txtOthers.value = "Please state here...";
    }
    else
    {
        txtOthers.disabled = true;
        txtOthers.value = "";
    }
}
function ClearOthersField()
{
    var txtOthers = document.getElementById("ucContactUs_txtOthers"); //txtOthers
    if (txtOthers.value == "Please state here...")
        txtOthers.value = "";
}
function ClearFields()
{
    document.getElementById("ucContactUs_txtContactPerson").value = ""; //txtContactPerson
    document.getElementById("ucContactUs_txtCompanyName").value = ""; //txtCompanyName
    document.getElementById("ucContactUs_txtPhoneCntryCode").value = ""; //txtPhoneCntryCode
    document.getElementById("ucContactUs_txtPhoneAreaCode").value = ""; //txtPhoneAreaCode
    document.getElementById("ucContactUs_txtPhoneNo").value = ""; //txtPhoneNo
    document.getElementById("ucContactUs_txtMobileCntryCode").value = ""; //txtMobileCntryCode
    document.getElementById("ucContactUs_txtMobileAreaCode").value = ""; //txtMobileAreaCode
    document.getElementById("ucContactUs_txtMobileNo").value = ""; //txtMobileNo
    document.getElementById("ucContactUs_txtEmail").value = ""; //txtEmail
    document.getElementById("ucContactUs_txtEmailSubj").value = ""; //txtEmailSubj
    document.getElementById("ucContactUs_txtComment").value = ""; //txtComment
    document.getElementById("ucContactUs_txtOthers").value = ""; //txtOthers
    document.getElementById("ucContactUs_txtVeriCode").value = ""; //txtVeriCode
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//Location
function InitGoogleMap() {
    if (GBrowserIsCompatible())
    {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(1.349391, 103.840628), 17);
        //GMap2.setUIToDefault();
        map.enableContinuousZoom();
        map.enableScrollWheelZoom();
        map.addControl(new GLargeMapControl());
        map.addControl(new GScaleControl());
        map.addControl(new GMapTypeControl());
        //map.addControl(new GHierarchicalMapTypeControl()); //either this or GMapTypeControl
        map.addControl(new GOverviewMapControl());
        
        var strHtmlInfo = "<font face=\"Arial\" size=\"3\" color=\"blue\"><b><u>GPS Lands (S) Pte Ltd</u></b></font><br>" +
            "<font face=\"Arial\" size=\"2\">35 Jalan Pemimpin #05-02<br>" +
            "Wedge Mount Industrial Building<br>" +
            "Singapore 577176</font>";
        map.openInfoWindowHtml(map.getCenter(), strHtmlInfo);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//Product Item
function ShowItemInfo(strInnerHtml)
{
    document.getElementById("item").innerHTML = strInnerHtml;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//Image
function imageOpacity(image, opacity)
{
 if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
    image.style.MozOpacity=opacity/100;
 else if (navigator.appName.indexOf("Microsoft")!= -1 &&parseInt(navigator.appVersion)>=4)
    image.filters.alpha.opacity=opacity;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//XBAP container
function WriteThere(strInnerHtml)
{
    document.getElementById("wpf").innerHTML = strInnerHtml;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//HTML container
function InsertThere(strDiv, strInnerHtml) {
    document.getElementById(strDiv).innerHTML = strInnerHtml;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
