﻿/**************************************************************************************************
* FILE NAME           : website.cs                                                                *
* AUTHOR              : Michael Underwood                                                         *
* DATE LAST WORKED ON : 02/10/10                                                                  *
* DESCRIPTION         : javascript file that controls user interface for the web site             *
*                                                                                                 *
* PROPERTY OF GIS DYNAMICS                                                                        *
**************************************************************************************************/

/**************************************************************************************************
 * ---------------------------------------------------------------------------------------------- *
 * MENU FUNCTIONALITY                                                                             *
 * ---------------------------------------------------------------------------------------------- *
/*************************************************************************************************/
function MenuMouseOver(buttonID)
{
    if(buttonID == 1)
    { document.getElementById("about_button").src = "img/about_orange.jpg"; }
    else if (buttonID == 4)
    { document.getElementById("faq_button").src = "img/faq_orange.jpg"; }
    else if (buttonID == 5)
    { document.getElementById("learn_button").src = "img/learn_orange.jpg"; }
    else if (buttonID == 6)
    { document.getElementById("testimnonials_button").src = "img/testimonials_orange.jpg"; }
    else if (buttonID == 7)
    { document.getElementById("blog").src = "img/blog_orange.jpg"; }
    else if (buttonID == 8)
    { document.getElementById("contact_button").src = "img/contact_orange.jpg"; }
}
/////////////////////////////////////////////////
function MenuMouseOut(buttonID)
{
    if(buttonID == 1)
    { document.getElementById("about_button").src = "img/about_green.jpg"; }
    else if (buttonID == 4)
    { document.getElementById("faq_button").src = "img/faq_green.jpg"; }
    else if (buttonID == 5)
    { document.getElementById("learn_button").src = "img/learn_green.jpg"; }
    else if (buttonID == 6)
    { document.getElementById("testimnonials_button").src = "img/testimonials_green.jpg"; }
    else if (buttonID == 7)
    { document.getElementById("blog").src = "img/blog_green.jpg"; }
    else if (buttonID == 8)
    { document.getElementById("contact_button").src = "img/contact_green.jpg"; }
}
/////////////////////////////////////////////////
function ButtonSubMenuUI(buttonID, onOff, isspecialpage)
{
    //check  if on or off
    if(onOff == 1)//on
    {
        //declarations
        var object = null;
        var curleft = 0;
        var curtop = 0;
        
        //check wich button is calling
        if(buttonID == 1)//demo button
        {
            //obtain object
            object = document.getElementById("demo_button");
            object.src = "img/videos_orange.jpg";

            //get submenu object
            var submen = document.getElementById("submenu");
            if (submen != null) {
                submen.innerHTML = "<table border=\"0px\" cellpadding=\"0px\" cellspacing=\"0px\" width=\"100%\" >" +
                                   "<tr>" +
                                       "<td style=\"background-color:White; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid #000000;\"><h5 id=\"whatis\" onmouseover=\"SubMenuItemsUI(1,1,1);\" onmouseout=\"SubMenuItemsUI(1,1,2);\" onclick=\"SubMenuItemsClick(1,1);\">&nbsp;&nbsp;What is Go iLawn?</h5></td>" +
                                   "</tr>" +
                                   "<tr>" +
                                       "<td style=\"background-color:White; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000;\"><h5 id=\"new\" onmouseover=\"SubMenuItemsUI(1,4,1);\" onmouseout=\"SubMenuItemsUI(1,2,2);\" onclick=\"SubMenuItemsClick(1,2);\">&nbsp;&nbsp;In the News</h5></td>" +
                                   "</tr>" +
                               "</table>";
            }
        }
        else//subscribe button
        {
            //obtain object
            object = document.getElementById("subscribe_button");
            document.getElementById("subscribe_button").src = "img/pricing_orange.jpg";

            //get submenu object
            var submen = document.getElementById("submenu");
            if (submen != null) {
                submen.innerHTML = "<table border=\"0px\" cellpadding=\"0px\" cellspacing=\"0px\" width=\"100%\" >" +
                                   "<tr>" +
                                       "<td style=\"background-color:White; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-top: 1px solid #000000; border-right: 1px solid #000000;\"><h5 id=\"trial\" onmouseover=\"SubMenuItemsUI(2,1,1);\" onmouseout=\"SubMenuItemsUI(2,1,2);\" onclick=\"SubMenuItemsClick(2,1);\">&nbsp;&nbsp;Trial</h5></td>" +
                                   "</tr>" +
                                   "<tr>" +
                                       "<td style=\"background-color:White; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000;\"><h5 id=\"paygo\" onmouseover=\"SubMenuItemsUI(2,2,1);\" onmouseout=\"SubMenuItemsUI(2,2,2);\" onclick=\"SubMenuItemsClick(2,2);\">&nbsp;&nbsp;Pay As You Go</h5></td>" +
                                   "</tr>" +
                                   "<tr>" +
                                       "<td style=\"background-color:White; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000;\"><h5 id=\"bucket\" onmouseover=\"SubMenuItemsUI(2,3,1);\" onmouseout=\"SubMenuItemsUI(2,3,2);\" onclick=\"SubMenuItemsClick(2,3);\">&nbsp;&nbsp;Prepay</h5></td>" +
                                   "</tr>" +
                               "</table>";
            }

        }
        
        //obtain location of object
        if (object.offsetParent) 
        {
            do 
            {
	            curleft += object.offsetLeft;
	            curtop += object.offsetTop;
	        } 
	        while (object = object.offsetParent);
        }

        if (buttonID == 1)//demo button
        {
            var submen = document.getElementById("submenu");
            submen.style.top = (curtop + 55) + "px";
            submen.style.left = curleft + "px";
            submen.style.visibility = "visible";
        }
        else 
        {
            var submen = document.getElementById("submenu");
            submen.style.top = (curtop + 55) + "px";
            submen.style.left = curleft + "px";
            submen.style.visibility = "visible";
        }
    }
    else //off
    {
        if(buttonID == 1)//demo button
        {
            //check if demo page is calling
            if(isspecialpage == 1)
            { document.getElementById("demo_button").src = "img/videos_orange.jpg"; }
            else
            { document.getElementById("demo_button").src = "img/videos_green.jpg"; }
            var submen = document.getElementById("submenu");
            submen.style.visibility = "hidden";
        }
        else
        {
            //check if subscribe is calling
            if(isspecialpage == 1)
            { document.getElementById("subscribe_button").src = "img/pricing_orange.jpg"; }
            else
            { document.getElementById("subscribe_button").src = "img/pricing_green.jpg"; }
            var submen = document.getElementById("submenu");
            submen.style.visibility = "hidden"; ; 
        }
    }
}
/////////////////////////////////////////////////
function SubMenuUI(onOff) 
{
    var submen = document.getElementById("submenu");
    if(onOff == 1)
    { submen.style.visibility = "visible"; }
    else
    { submen.style.visibility = "hidden"; }
}
/////////////////////////////////////////////////
function SubMenuItemsUI(buttonID, menuItemID, onOff)
{
    if(buttonID == 1)//demo
    {
        if(onOff == 1)//on
        {
            document.body.style.cursor = "pointer";
            if (menuItemID == 1)//what is go ilawn
            { document.getElementById("whatis").style.color = "#d98621"; }
            else
            { document.getElementById("new").style.color = "#d98621"; }
        }
        else//off
        {
            document.body.style.cursor = "default";
            if(menuItemID == 1)//what is go ilawn
            { document.getElementById("whatis").style.color = "#000000"; }
            else
            { document.getElementById("new").style.color = "#000000"; }
        }
    }
    else//subscribe
    {
        if(onOff == 1)//on
        {
            document.body.style.cursor = "pointer";
            if(menuItemID == 1)//trial
            { document.getElementById("trial").style.color = "#d98621"; }
            else if(menuItemID == 2)//paygo
            { document.getElementById("paygo").style.color = "#d98621"; }
            else//prepay
            { document.getElementById("bucket").style.color = "#d98621"; }
        }
        else//off
        {
            document.body.style.cursor = "default";
            if(menuItemID == 1)//trial
            { document.getElementById("trial").style.color = "#000000"; }
            else if(menuItemID == 2)//paygo
            { document.getElementById("paygo").style.color = "#000000"; }
            else//prepay
            { document.getElementById("bucket").style.color = "#000000"; }
        }
    }
}
/////////////////////////////////////////////////
function SubMenuItemsClick(buttonID, menuItemID)
{
    var packed = "";
    
    if(menuItemID == 1)
    { packed = escape("1"); }
    else if(menuItemID == 2)
    { packed = escape("2"); }
    else if(menuItemID == 3)
    { packed = escape("3"); }
    else
    { packed = escape("4"); }
    

    if(buttonID == 1)//demo
    {
        //window.location = "demo.aspx?" + packed;
        //window.location = "http://24.172.202.226/ilawnTEST/demo.aspx?" + packed;
        //window.location = "http://74.218.146.168/ilawnSUPPORT/demo.aspx?" + packed; 
        window.location = "http://www.goilawn.com/demo.aspx?" + packed;
    }
    else //subscribte
    {
        //window.location = "subscribe.aspx?" + packed;
        //window.location = "http://24.172.202.226/ilawnTEST/subscribe.aspx?" + packed;
        //window.location = "http://74.218.146.168/ilawnSUPPORT/subscribe.aspx?" + packed; 
        window.location = "http://www.goilawn.com/subscribe.aspx?" + packed;
    }
}
/////////////////////////////////////////////////
function WhatIsGoIlawnRedirect() 
{
        //window.location = "demo.aspx?1";
        //window.location = "http://24.172.202.226/ilawnTEST/demo.aspx?1";
        //window.location = "http://74.218.146.168/ilawnSUPPORT/demo.aspx?1"; 
        window.location = "http://www.goilawn.com/demo.aspx?1"; 
}
/////////////////////////////////////////////////
function WhatIsGoIlawn_CursorToPointer() 
{ document.body.style.cursor = "pointer"; }
/////////////////////////////////////////////////
function WhatIsGoIlawn_CursorToDefault() 
{ document.body.style.cursor = "default"; }
/**************************************************************************************************
 * ---------------------------------------------------------------------------------------------- *
 * DEMO FUNCTIONALITY                                                                             *
 * ---------------------------------------------------------------------------------------------- *
/*************************************************************************************************/
function DemoOnLoad()
{
    //obtain packed data
    var query = window.location.search;
    if (query.substring(0, 1) == '?') 
    { query = query.substring(1); }

    if (query == "2")//in the news
    {
        document.getElementById("header").innerHTML = "<h3>In the News</h3>";
        document.getElementById("media").innerHTML = "<embed src=\"http://www.lgwvideos.com/FLV_Player/flvplayer.swf\" FlashVars=\"initexemel=http://www.lgwvideos.com/embed/go-ilawn.asp\" quality=\"high\" bgcolor=\"#000000\" width=\"400\" height=\"330\" name=\"flvplayer\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowFullScreen=\"true\" />";
    }
    else//what is goilawn
    {
        document.getElementById("header").innerHTML = "<h3>What is Go iLawn?</h3>";
        document.getElementById("media").innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"750\" height=\"525\">" +
                                                        "<param name=\"movie\" value=\"demo/GoiLawnFlash_controller.swf\" />" +
                                                        "<param name=\"quality\" value=\"best\" />" +
                                                        "<param name=\"bgcolor\" value=\"#1a1a1a\" />" +
                                                        "<param name=\"allowfullscreen\" value=\"true\" />" +
                                                        "<param name=\"scale\" value=\"showall\" />" +
                                                        "<param name=\"allowscriptaccess\" value=\"always\" />" +
                                                        "<!--[if !IE]>-->" +
                                                        "<object type=\"application/x-shockwave-flash\" data=\"demo/GoiLawnFlash_controller.swf\" width=\"750\" height=\"525\">" +
                                                            "<param name=\"quality\" value=\"best\" />" +
                                                            "<param name=\"bgcolor\" value=\"#1a1a1a\" />" +
                                                            "<param name=\"allowfullscreen\" value=\"true\" />" +
                                                            "<param name=\"scale\" value=\"showall\" />" +
                                                            "<param name=\"allowscriptaccess\" value=\"always\" />" +
                                                        "<!--<![endif]-->" +
                                                            "<div id=\"noUpdate\">&nbsp;</div>" +
                                                        "<!--[if !IE]>-->" +
                                                        "</object>" +
                                                        "<!--<![endif]-->" +
                                                    "</object>";
    }
}