var folderName = "/soulyyours";
var rootLocation = window.location.host
rootLocation += rootLocation =="localhost"?folderName:"";
var root = "http://"+ rootLocation +"/";
$(function() {
    $("div.mod .body div ul li").mouseover(function()
    {
        $(this).toggleClass("hover");
    }); 
    $("div.mod .body div ul li").mouseout(function()
    {
        $(this).toggleClass("hover");
    }); 
    $(".redButton").mouseover(function()
    {
        $(this).toggleClass("hover");
    }); 
    $(".redButton").mouseout(function()
    {
        $(this).toggleClass("hover");       
    });
    $("div.mainMenu a").click(function(){
        $("div.mainMenu").removeClass("active");
        $(this).parent().addClass("active");
    });
    $("#logo").click(function(){
        window.location = "/";
    });
    $("#terms").click(function(){
        displayAlert("/Terms.html",true);
        return false;
    });
    $("#privacyPolicy").click(function(){
        displayAlert("/PrivacyPolicy.html",true);
        return false;
    });
    $("#siteMap").click(function(){
        displayAlert("/SiteMap.html",true);
        return false;
    });
    createModal();
    $("#modal .exit").click(function(){
        $("#modalOverlay").fadeOut();
        return false;
    });
    $("#requestQuote").click(function(){
        window.location = "/Contact/?page=RequestQuote";
    });

//    alert("App Name: "+navigator.appName+"\n\rCode Name: "+navigator.appCodeName +"\n\rApp Version: "+navigator.appVersion+"\n\rUser Agent: "+navigator.userAgent);
});

function displayAlert(content, isHtml){
    if(isHtml)
        $("#modal .content").load(content);
    else
        $("#modal .content").html(content)
    $("#modalOverlay").fadeIn();
}

function SetUpPage(pageTitle,mainMenuId,subMenuId){
    document.title = pageTitle==""?document.title:pageTitle;
    if(mainMenuId!="")
        $("#"+mainMenuId).addClass("active");
    if(subMenuId!="")
        $("#"+subMenuId).addClass("active");
}

function createModal(){
    var overlay = document.createElement('div');
    overlay.setAttribute("id","modalOverlay");
    var display = document.createElement('div');
    display.setAttribute("id","modal");
    var exit = document.createElement('div');
    exit.setAttribute("class","exit");
    exit.innerHTML="x";
    var clear = document.createElement('div');
    clear.setAttribute("class","clear");
    var content = document.createElement('div');
    content.setAttribute("class","content");

    display.appendChild(exit);
    display.appendChild(clear);
    display.appendChild(content);
    overlay.appendChild(display);
    document.body.appendChild(overlay);
    $("#modalOverlay").hide();
}


