var cosmo0 = new Image();
cosmo0.src = "images/thecosmopolitan-0.jpg";
var cosmo1 = new Image();
cosmo1.src = "images/thecosmopolitan-1.jpg";

var sky0 = new Image();
sky0.src = "images/skylasvegas-0.jpg";
var sky1 = new Image();
sky1.src = "images/skylasvegas-1.jpg";

var allure0 = new Image();
allure0.src = "images/allure-0.jpg";
var allure1 = new Image();
allure1.src = "images/allure-1.jpg";

var panorama0 = new Image();
panorama0.src = "images/panorama-0.jpg";
var panorama1 = new Image();
panorama1.src = "images/panorama-1.jpg";

var trumpinternational0 = new Image();
trumpinternational0.src = "images/trumpinternational-0.jpg";
var trumpinternational1 = new Image();
trumpinternational1.src = "images/trumpinternational-1.jpg";

var turnberryplace0 = new Image();
turnberryplace0.src = "images/turnberryplace-0.jpg";
var turnberryplace1 = new Image();
turnberryplace1.src = "images/turnberryplace-1.jpg";

var turnberryplace_home0 = new Image();
turnberryplace_home0.src = "images/turnberryplace_home-0.gif";
var turnberryplace_home1 = new Image();
turnberryplace_home1.src = "images/turnberryplace_home-1.gif";


var startList = function() {
	if (document.all&&document.getElementById){
		navRoot = document.getElementById("topmenu");
		for (i=0; i<navRoot.childNodes.length; i++){
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI"){
				node.onmouseover=function(){
					this.className+=" over";
				}
				node.onmouseout=function(){
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function imgSwap(el, on){
	var id = el.getAttribute('id');
	var img = el.getElementsByTagName('IMG')[0];
	if(on == 1){
		img.src = eval(id + '1').src;
	}
	else{
		img.src = eval(id + '0').src;
	}
}

function showTitle(el, on){
	var t, n;
	if(on == 1){
		t = el.getElementsByTagName('img')[0].getAttribute('title');
	}
	else{
		t = '';
	}
	n = document.createTextNode(t);
	document.getElementById('label').childNodes[0].nodeValue = n.nodeValue;
}

function showFS(on){
	if(on == 1){
		v = 'visible';
	}
	else{
		v = 'hidden';
	}
	document.getElementById('fashionshow').style.visibility = v;
}

var start = new Array(64,55,51);
var end = new Array(191,171,144);

var diff = new Array(end[0] - start[0], end[1] - start[1], end[2] - start[2]);

var steps = 10;

var inc = new Array(parseInt(diff[0] / steps), parseInt(diff[1] / steps), parseInt(diff[2] / steps));

var colors = new Array();
var divcolor = new Array();
	
function divColors(){
	colors[0] = start[0].toString(16) + start[1].toString(16) + start[2].toString(16);
	
	for(var i = 1; i < steps; i++){
		var temp = new Array();
		for(var j = 0; j <= 2; j++){
			if(diff[j] > 0){
				temp[j] = start[j] + (inc[j] * i);
			}
			else{
				temp[j] = start[j] - (inc[j] * i);
			}
		}
		colors[i] = temp[0].toString(16) + temp[1].toString(16) + temp[2].toString(16);
	}
	
	colors[colors.length] = end[0].toString(16) + end[1].toString(16) + end[2].toString(16);
	
	for(c in colors){
		var bg = '#' + colors[c].toString(); //.replace(/,/g, '');
		divcolor[c] = bg;
	}
}

var currFade = 0;
var fadePos = new Boolean(false);
var fadeI = null;
var fadeO = null;
var canFade = new Boolean(true);
var delay = 50;

function fadeIn() {
	fadeO = null;
	if (currFade < (steps)) {
		currFade++;
		setFade(currFade);
	}
	else {
		if (currFade == (steps)) {
			window.clearInterval(fadeI);
			fadeI = null;
		}
	}
}
	
function fadeOut() {
	fadeI = null;
	if (currFade > 0) {
		currFade--;
		setFade(currFade);
	}
	else {
		if (currFade == 0) {
			window.clearInterval(fadeO);
			fadeO = null;
		}
	}
}

function ckFade(b){
	if(canFade) {
		if(b){
			if(fadeO != null){window.clearInterval(fadeO);}
			fadePos = b;
			fadeI = window.setInterval('fadeIn()', delay);
		}
		else{
			if(fadeI != null){window.clearInterval(fadeI);}
			fadePos=false;
			fadeO = window.setInterval('fadeOut()', delay);
		}
	}
	else{
		c = b ? 0 : divcolor.length - 1;
		setFade(c);
	}
}

function setFade(currFade){
	document.getElementById('fashionshow').style.visibility = (currFade == 0 ? 'hidden' : 'visible');
	document.getElementById('fashionshow').style.backgroundColor = divcolor[currFade];
	return true;
}


function fade(el, on){
	for(i = 0; i < window.divcolor.length; i++){
		f = window.setInterval("setBG(i)", 100);
	}
}
function setBG(c){
	document.getElementById('fashionshow').style.backgroundColor = window.divcolor[c];
}

function ezraInit(){
	startList();
//	divColors();
}

window.onload = ezraInit;

        function openidx(){
                var el = document.getElementById('idxframe');
                el.style.height = '580px';
          
                var p = document.getElementById('idxreset');
                p.style.display = 'block';
        }
        
        function closeidx(){
                var el = document.getElementById('idxframe');
                el.style.height = '16ex';
                
                var p = document.getElementById('idxreset');
                p.style.display = 'none';
        }
        function resetidx(){
                
                var idx = document.getElementById('idxframe');
                var loc = idx.getAttribute('data');
                if(idx.tagName == 'OBJECT'){
                var loc = idx.getAttribute('data');
                        var nidx = document.createElement('object');
                        nidx.setAttribute('type', 'text/html');
                        nidx.setAttribute('data', loc);
                        idx.setAttribute('id', 'staleidx');
                        nidx.setAttribute('id', 'idxframe');
                                
                        idx.parentNode.replaceChild(nidx, idx);
                }
                else if(idx.tagName == 'IFRAME'){
                        var loc = idx.getAttribute('src');
                        idx.setAttribute('src', loc);
                }
        }

