﻿//author:: Laurence Lemmon-Warde
//2008

var currentselection;
var browser='';var version='';var entrance= '';var cond= '';
// BROWSER?
if (browser == ''){if (navigator.appName.indexOf('Microsoft') != -1)browser = 'IE'
else if (navigator.appName.indexOf('Netscape') != -1)browser = 'Netscape'
else browser = 'IE';}
if(navigator.appVersion.indexOf('Safari') != -1) browser = 'Safari';

if (version == ''){version= navigator.appVersion;paren = version.indexOf('(');
whole_version = navigator.appVersion.substring(0,paren-1);version= parseInt(whole_version);}
if (browser == 'IE' && version >= 4) 
    document.write('<link rel="stylesheet" href="styles/dankitchens_ie.css" />');
if (browser == 'Netscape' && version >= 2.02) 
    document.write('<link rel="stylesheet" href="styles/dankitchens.css" />');
if (browser == 'Safari') {

    document.write('<link rel="stylesheet" href="styles/dankitchens.css" />');
    document.write('<link rel="stylesheet" href="styles/dankitchens_safari.css" />');
}

function pageLoad(s)
{
    if(s != 'projects' & s != 'contactus' & s != 'showroom') 
    {
        var objTh = document.getElementById("thumbnailstable");
        document.getElementById("thumb1").className = s + "1";
        document.getElementById("thumb2").className = s + "2";
        document.getElementById("thumb3").className = s + "3";
        document.getElementById("thumb4").className = s + "4";
        new Effect.Appear(objTh);
    }
    if(s == 'projects') 
    {
        var objTh = document.getElementById("thumbnailstable");
        new Effect.Appear(objTh);
    }    

    document.getElementById(s).className = 'selected'; 
    currentselection = s;

    var obj = document.getElementById("txt" + s);
    if(obj != null) 
	{
		obj.style.display="block";
    	new Effect.Appear(obj);
	}
}

function navigationChange(m)
{
    var currentselection = m.id;
    if(currentselection == 'home') {currentselection = 'default'};
    document.location.href=currentselection + ".htm";
}

function navMouseOver(m)
{
    if(m != null) if(m.id != currentselection) m.className = 'over';
}

function navMouseOut(m)
{
    if(m.id != currentselection) m.className = '';
}

function navigateGallery()
{
    if(currentselection == '') {currentselection = 'home'};
    if(currentselection != 'home') document.location.href="images/" + currentselection + "/index.html";
}

function createNavMenu()
{  
    var common = "<tr><td onclick=\"navigationChange(this);\" onmouseover=\"navMouseOver(this);\" onmouseout=\"navMouseOut(this);\" ";
    var menu = "<div class=\"navigationdiv\">";
            menu += "<table class=\"menutable\" id=\"menutable\">";
                menu += "<tr><td style=\"height:20px\"></td></tr>";
                menu += common + "id=\"kitchens\">kitchens</td></tr>";
                menu += common + "id=\"projects\">current projects</td></tr>";
                menu += common + "id=\"otherrooms\">other rooms</td></tr>";
                menu += common + "id=\"accessories\">accessories</td></tr>";
                menu += common + "id=\"innovations\">innovations</td></tr>";
                menu += common + "id=\"aboutus\">about us</td></tr>";
                menu += common + "id=\"showroom\">showroom</td></tr>";
                menu += common + "id=\"contactus\">contact us</td></tr>";
                menu += common + "id=\"home\">home</td></tr>";
                menu += "</table>";
            menu += "</div>";
     document.write(menu);     
 }

function navigateProject(p)
{
    document.location.href="project" + p + ".htm";
}

function navigateProjectGallery(proj)
{
    document.location.href="images/projects/project" + proj + "/index.html";
}
