﻿var myGallery;

function mobileNav() {
 document.write("<div data-role='controlgroup' data-type='horizontal' align='center'>");
 document.write("<a href='main.aspx' data-role='button'>Home</a>");
 document.write("<a href='contacts.aspx' data-role='button'>Contacts</a></div>");
}


function doSearch(keyword) {
    var dest;
    var strKeyword;
    strKeyword = keyword;
    
    if (strKeyword != "Keyword:") {
        dest = "search.aspx?search=" + strKeyword;
    } else {
        dest = "search.aspx?search=";
    }
    window.location = dest;
}

function doSearchFromNewsletter() {
    var dest;
    
    if (document.getElementById("txtKeyword").value != "Keyword:") {
        dest = "../search.aspx?search=" + document.getElementById("txtKeyword").value;
    } else {
        dest = "../search.aspx?search=";
    }
    
    window.location = dest;
}

function update_user_box() {

            var user_box = document.getElementById("user");

            // add in some XFBML. note that we set useyou=false so it doesn't display "you"
            user_box.innerHTML =
      "<span>"
    + "<fb:profile-pic uid=loggedinuser facebook-logo=true></fb:profile-pic>"
    + "Welcome, <fb:name uid=loggedinuser useyou=false></fb:name>. You are signed in with your Facebook account."
    + "</span>";

            // because this is XFBML, we need to tell Facebook to re-process the document 
            FB.XFBML.Host.parseDomTree();
}

function FacebookInit() {
    FB.init("b286c206a27dc515191959a6bef22b87", "/xd_receiver.htm", { "ifUserConnected": update_user_box });
}

function drawFBComments(PageID) 
{
    document.write("<table width='100%'><tr>");
    document.write("<td >");
    document.write("<table width='100%'><tr><td>");
    document.write("<fb:comments xid='" + PageID + "' width='690px' simple='true'  css='http://www.lucitelux.com/luciteluxtest/css/Facebook.css?2' canpost='true' candelete='true' returnurl='http://www.facebook.com/apps/application.php?id=313160766251'>");
    document.write("</fb:comments>");
    document.write("</td></tr></table>");
    document.write("</td></tr></table>");
}

function DrawSocialMediaLinks() {
    document.write("<br/>&nbsp;&nbsp;&nbsp;<a href='http://www.facebook.com/LuciteLux'><img src='images/facebook.png' alt='Follow us on Facebook'/></a>");
    //document.write("<fb:fan profile_id='313160766251' stream='0' connections='0' logobar='0' width='200'></fb:fan><div style='font-size:8px; padding-left:10px'><span class='darkGreySmallest'></div>");
    document.write("<br/>&nbsp;&nbsp;&nbsp;<a href='http://www.twitter.com/LuciteLux'><img src='images/twitter.png'  alt='Follow LuciteLux® on Twitter'/></a>");
}
function DrawSocialMediaLinksNews() {
    document.write("<br/>&nbsp;&nbsp;&nbsp;<a href='http://www.facebook.com/LuciteLux'><img src='../images/facebook.png' alt='Follow us on Facebook'/></a>");
    //document.write("<fb:fan profile_id='313160766251' stream='0' connections='0' logobar='0' width='200'></fb:fan><div style='font-size:8px; padding-left:10px'><span class='darkGreySmallest'></div>");
    document.write("<br/>&nbsp;&nbsp;&nbsp;<a href='http://www.twitter.com/LuciteLux'><img src='../images/twitter.png'  alt='Follow LuciteLux® on Twitter'/></a>");
}

function FacebookDrawLogin() {
    document.write("<br />");
    document.write("<fb:login-button v='2' size='medium' onlogin='window.location.reload(true);'>Connect with Facebook</fb:login-button>");           
}

function createGallery() {
    document.write("<div id='myGallery'>");
    document.write("<div class='imageElement'>");
    document.write("<h3>Item 1 Title</h3>");
    document.write("<p>Item 1 Description</p>");
    document.write("<a href=\"javascript:updateMainPage('main_content.aspx')\" title='LuciteLux' class='open'></a>");
    document.write("<img alt='' src='../images/header1.jpg' class='full' />");
    document.write("<img alt='' src='../images/header1.jpg' class='thumbnail' />");
    document.write("</div>");
    document.write("<div class='imageElement'>");
    document.write("<h3>Item 1 Title</h3>");
    document.write("<p>Item 1 Description</p>");
    document.write("<a href=\"javascript:updateMainPage('carryme.aspx')\" title='Carry Me' class='open'></a>");
    document.write("<img alt='' src='../images/header2.jpg' class='full' />");
    document.write("<img alt='' src='../images/header2.jpg' class='thumbnail' />");
    document.write("</div>");
    document.write("<div class='imageElement'>");
    document.write("<h3>Item 1 Title</h3>");
    document.write("<p>Item 1 Description</p>");
    document.write("<a href=\"javascript:updateMainPage('applications.aspx', true)\" title='Applications' class='open'></a>");
    document.write("<img alt='' src='../images/header3.jpg' class='full' />");
    document.write("<img alt='' src='../images/header3.jpg' class='thumbnail' />");
    document.write("</div>");
    document.write("<div class='imageElement'>");
    document.write("<h3>Item 1 Title</h3>");
    document.write("<p>Item 1 Description</p>");
    document.write("<a href=\"javascript:updateMainPage('knowledgebank.aspx', false)\" title='Products' class='open'></a>");
    document.write("<img alt='' src='../images/header4.jpg' class='full' />");
    document.write("<img alt='' src='../images/header4.jpg' class='thumbnail' />");
    document.write("</div></div>");
}

//Shows|Hides the list of applications
function showElement(layer, isApp) {
    var myLayer = document.getElementById(layer);
    if (myLayer.style.display == "none" & isApp == true) {
        myLayer.style.display = "block";
        myLayer.backgroundPosition = "top";
    } else {
        myLayer.style.display = "none";
    }

}



        //This accepts a menu type, then depending on what it is will highlight the necessary menu items
        //and will draw sub menus if necessary.
        //If it's a newsletter will prefix all links with "../" 
function drawMenu(type) {
    var highlight = " background-color: #333333;";
    var home = "";
    var history = "";
    var designer = "";
    var why = "";
    var apps = "";
    var products = "";
    var news = "";
    var designers = "";
    var contacts = "";
    var appAviation = "";
    var appTanning = "";
    var appMedical = "";
    var appFood = "";
    var appWind = "";
    var appPop = "";
    var appSky = "";
    var prodMicroban = "";
    var prodUtran = "";
    var prodFrost = "";
    var prodStandard = "";
    var prodTuf = "";
    var prodMuseum = "";
    var prodPerspex = "";
    var contacts = "";
    var newsletter = "";
    var prodResources = "";
    var prodCoral = "";
    var productInfo = "";
    var colors = "";
    var isApp, isProd;
    isApp = false;
    isProd = false;
    switch (type) {
        case "main":
            home = highlight;
            break;
        case "contacts":
            contacts = highlight;
            break;
        case "designer":
            designer = highlight;
            break;
        case "history":
            history = highlight;
            break;
        case "colors":
            colors = highlight;
            break;
        case "why":
            why = highlight;
            break;
        case "apps":
            apps = highlight;
            isApp = true;
            break;
        case "aviation":
            apps = highlight;
            appAviation = highlight;
            isApp = true;
            break;
        case "tanning":
            apps = highlight;
            appTanning = highlight;
            isApp = true;
            break;
        case "medical":
            apps = highlight;
            appMedical = highlight;
            isApp = true;
            break;
        case "wind":
            apps = highlight;
            appWind = highlight;
            isApp = true;
            break;
        case "pop":
            apps = highlight;
            appPop = highlight;
            isApp = true;
            break;
        case "sky":
            apps = highlight;
            appSky = highlight;
            isApp = true;
            break;
        case "products":
            products = highlight;
            isProd = true;
            break;
        case "microban":
            products = highlight;
            prodMicroban = highlight;
            isProd = true;
            break;
        case "resources":
            products = highlight;
            prodResources = highlight;
            isProd = true;
            break;
        case "utran":
            products = highlight;
            prodUtran = highlight;
            isProd = true;
            break;
        case "frost":
            products = highlight;
            prodFrost = highlight;
            isProd = true;
            break;
        case "perspex":
            products = highlight;
            prodPerspex = highlight;
            isProd = true;
            break;
        case "tuf":
            products = highlight;
            prodTuf = highlight;
            isProd = true;
            break;
        case "museum":
            products = highlight;
            prodMuseum = highlight;
            isProd = true;
            break;
        case "standard":
            products = highlight;
            prodStandard = highlight;
            isProd = true;
            break;
        case "news":
            news = highlight;
            break;
        case "coral":
            products = highlight;
            prodCoral = highlight;
            isProd = true;
            break;
        case "productInfo":
            productInfo = highlight;
            break;
    }
    
//    document.write("<br />");
//    document.write("<div style='margin-bottom: 6px'><a href='main.aspx'>");
//    document.write("<span class='whiteLargeBold'>About LuciteLux</span></a>&nbsp;");
//    document.write("</div>");
    document.write("<span class='menu'>");
    document.write("<br/>");
    document.write("<a class='changeWhite' href='main.aspx' id='A1' style='display: inline-block; width: 166px;" + home + "'>Home</a><br />");
    document.write("<a class='changeWhite' style='display: inline-block; width: 166px;" + why + "' href='whyLux.aspx' id='linkWhy'>Why LuciteLux® - <br/>&nbsp;&nbsp; 'Just Imagine'</a><br />");
    document.write("<a class='changeWhite' href='designerfocus.aspx' id='linkDesigner' style='display: inline-block; width: 166px;" + designer + "'>Designer Focus</a><br />");
    document.write("<a class='changeWhite'  style='display: inline-block; width: 166px;" + products + "' href='knowledgebank.aspx' id='linkKnowledge' > Products</a><br />");
    if (isProd == true) {
        document.write("<ul id='k-menu'  style='display: true;' type='disc'>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodMicroban + "' id='linkMicroban' href='microban.aspx'   >Microban</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodCoral + "' id='linkCoral' href='perspexcoral.aspx'  >Perspex Coral</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodFrost + "' id='linkFrost' href='perspexfrost.aspx'  >Perspex Frost</a></li>");
        document.write("<li><a class='changeWhite' style='width: 136px;" + prodPerspex + "' id='linkPerspex' href='perspexstandard.aspx'  >Perspex Standard Offering</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodUtran + "' id='linkUtran' href='utran.aspx'  >UTran</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodTuf + "' id='linkTuf' href='tufguard.aspx'  >TufGuard®</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodMuseum + "' id='linkMuseum' href= 'museum.aspx'  >Museum grade</a></li>");
        document.write("<li><a class='changeWhite' style='width: 136px;" + prodStandard + "' id='linkStandard' href='clearstandard.aspx'  >LuciteLux® Standard Offering</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodResources + "' id='linkStandard' href='resources.aspx'  >Resources</a></li>");
        document.write("</ul>");
    }
    document.write("<a class='changeWhite' style='display: inline-block; width: 166px;" + apps + "' href='applications.aspx' id='linkApplications' >Applications</a><br />");
    if (isApp == true) {
        document.write("<ul id='v-menu'  style='display: true;' type='disc'>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appAviation + "' id='linkAviation' href='aviation.aspx' >Aviation</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appTanning + "' id='linkTanning' href='utran.aspx' >Tanning Beds</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appMedical + "' id='linkMedical' href='microban.aspx' >Medical Applications</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appFood + "' id='linkFood' href='microban.aspx' >Food Applications</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appWind + "' id='linkWind' href='applications.aspx' >Wind Shields</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appPop + "' id='linkPop' href='applications.aspx' >Pop Displays</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appSky + "' id='linkSky' href='applications.aspx' >Sky Lights</a></li>");
        document.write("</ul>");
    }
    document.write("<a class='changeWhite' href='productInformation.aspx' id='linkNews' name='linkNews' style='display: inline-block; width: 166px;" + productInfo + "'>Product Information</a><br />");
    document.write("<a class='changeWhite' href='news.aspx' id='linkNews' name='linkNews' style='display: inline-block; width: 166px;" + news + "'>News & Events</a><br />");
    document.write("<a class='changeWhite' href='contacts.aspx' id='linkContacts' style='display: inline-block; width: 166px;" + contacts + "'>Contact Us</a><br />");
    document.write("<a class='changeWhite' href='history.aspx' id='linkHistory' style='display: inline-block; width: 166px;" + history + "'>The history of Lucite</a><br />");
    document.write("</span>"); 
    document.write("<br /></td></tr>");
    document.write("<tr>");
}

