﻿var myGallery;




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/pages/LuciteLux/119338338086498'><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/pages/LuciteLux/119338338086498'><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";
    }

}

function startGallery() {
            myGallery = new gallery($('myGallery'), {
                timed: true,
                showArrows: false,
                showCarousel: false,
                showInfopane: false
            });
        }

        //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 isApp, isProd;
    isApp = false;
    isProd = false;
    switch (type) {
        case "newsletter":
            newsletter = "../";
            break;
        case "main":
            home = highlight;
            break;
        case "contacts":
            contacts = highlight;
            break;
        case "designer":
            designer = highlight;
            break;
        case "history":
            history = 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;
    }
    
    document.write("<br />");
    document.write("<div style='margin-bottom: 6px'><a href='" + newsletter + "main.aspx'>");
    document.write("<span class='whiteLargeBold'>About LuciteLux</span></a>&nbsp;");
    document.write("</div>");
    document.write("<span class='menu'>");
    document.write("&nbsp;&nbsp; <a class='changeWhite' href='" + newsletter + "main.aspx' id='A1' style='display: inline-block; width: 166px;" + home + "'>Home</a><br />");
    document.write("&nbsp;&nbsp; <a class='changeWhite' href='" + newsletter + "history.aspx' id='linkHistory' style='display: inline-block; width: 166px;" + history + "'>The history of Lucite</a><br />");
    document.write("&nbsp;&nbsp; <a class='changeWhite' style='display: inline-block; width: 166px;" + why + "'");
    document.write("href='" + newsletter + "whyLux.aspx' id='linkWhy'>Why LuciteLux</a><br />");
    document.write("&nbsp;&nbsp; <a class='changeWhite' href='" + newsletter + "designerfocus.aspx' id='linkDesigner' style='display: inline-block; width: 166px;" + designer + "'>Designer Focus</a><br />");
    document.write("&nbsp;&nbsp; ");
    document.write("<a class='changeWhite' style='display: inline-block; width: 166px;" + apps + "'");
    document.write("href='" + newsletter + "applications.aspx' ");
    document.write("id='linkApplications' >");
    document.write("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='" + newsletter + "aviation.aspx' >Aviation</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appTanning + "' id='linkTanning' href='" + newsletter + "utran.aspx' >Tanning Beds</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appMedical + "' id='linkMedical' href='" + newsletter + "microban.aspx' >Medical Applications</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appFood + "' id='linkFood' href='" + newsletter + "microban.aspx' >Food Applications</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appWind + "' id='linkWind' href='" + newsletter + "applications.aspx' >Wind Shields</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appPop + "' id='linkPop' href='" + newsletter + "applications.aspx' >Pop Displays</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + appSky + "' id='linkSky' href='" + newsletter + "applications.aspx' >Sky Lights</a></li>");
        document.write("</ul>");
    }
    document.write("&nbsp;&nbsp; ");
    document.write("<a class='changeWhite'  style='display: inline-block; width: 166px;" + products + "'");
    document.write("href='" + newsletter + "knowledgebank.aspx' ");
    document.write("id='linkKnowledge' > ");
    document.write("Knowledge Bank</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='" + newsletter + "microban.aspx'   >Microban</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodCoral + "' id='linkCoral' href='" + newsletter + "perspexcoral.aspx'  >Perspex Coral</a></li>");
       document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodFrost + "' id='linkFrost' href='" + newsletter + "perspexfrost.aspx'  >Perspex Frost</a></li>");
        document.write("<li><a class='changeWhite' style='width: 136px;" + prodPerspex + "' id='linkPerspex' href='" + newsletter + "perspexstandard.aspx'  >Perspex Standard Offering</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodUtran + "' id='linkUtran' href='" + newsletter + "utran.aspx'  >UTran</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodTuf + "' id='linkTuf' href='" + newsletter + "tufguard.aspx'  >TufGuard®</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodMuseum + "' id='linkMuseum' href= '" + newsletter + "museum.aspx'  >Museum grade</a></li>");
        document.write("<li><a class='changeWhite' style='width: 136px;" + prodStandard + "' id='linkStandard' href='" + newsletter + "clearstandard.aspx'  >LuciteLux Standard Offering</a></li>");
        document.write("<li><a class='changeWhite' style='display: inline-block; width: 136px;" + prodResources + "' id='linkStandard' href='" + newsletter + "resources.aspx'  >Resources</a></li>");
        document.write("</ul>");
    }
    
    document.write("&nbsp;&nbsp; ");
    document.write("<a class='changeWhite' ");
    document.write("href='" + newsletter + "news.aspx' id='linkNews' ");
    document.write("name='linkNews' style='display: inline-block; width: 166px;" + news + "'>News & Events</a><br />");
    document.write("&nbsp;&nbsp; <a class='changeWhite' href='" + newsletter + "contacts.aspx' id='linkContacts' style='display: inline-block; width: 166px;" + contacts + "'>Contact Us</a><br />");
    document.write("</span>"); 
    document.write("<br /></td></tr>");
    document.write("<tr>");
}
