/* basics */

var isIE=navigator.appName.indexOf("Explorer")>=0 ? true: false;
var isMac=navigator.platform.indexOf("Mac")>=0 ? true: false;
var NS6=(parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var base = 'toolbar=0,location=0,directories=0,status=0,menubar=0,';
var none = base+'resizable=0,scrolling=0,scrollbars=0,';
var withScroll =  base+'resizable=0,scrolling=1,scrollbars=1,';
var footerHeight = 33;
var tourWindowHeight = 350 + 150;
var tourWindowWidth = 350 + 385;
var buttonPath=(location.href.indexOf("tours")>0 ||location.href.indexOf("keywords")>0)? '../../../../': '../../';
if (location.href.indexOf("zooms")>0){
	buttonPath=buttonPath+"../";
}

function Button(imgName,path){
	this['on'] = new Image();
	this['off'] = new Image();
	 if (pngNormal){
		this['on'].src = path+'images/design/buttons/on/'+imgName+'.png';
		this['off'].src = path+'images/design/buttons/off/'+imgName+'.png';}
	else{
		this['on'].src = path+'images/design/buttons/on/'+imgName+'.gif';
		this['off'].src = path+'images/design/buttons/off/'+imgName+'.gif';}
	}

function buttonOn(which){
	if (pngAlpha){
	theButton=eval(which);
	theButton.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = '../../images/design/buttons/on/'+which+'.png';
	} else {
		document.images[which].src = Buttons[which]['on'].src;}
	}
 
function buttonOff(which){
	if (pngAlpha) {
	theButton=eval(which);
	theButton.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = '../../images/design/buttons/off/'+which+'.png';
	} else {
		document.images[which].src = Buttons[which]['off'].src;}
	}

function dropBy(theURL){
	width = 765;
	height = 485;
	var options = none+'width='+width+',height='+height;
	var livingRoomPath=(location.href.indexOf("tours")>0 ||location.href.indexOf("keywords")>0)? '../.': '';

	var text = '<FRAMESET cols="72%,18%" frameborder=0 border=0 framespacing=0 bordercolor=#cccccc>';
    text = text + '<FRAME marginHeight=0 marginWidth=0 name=room scrolling=no src="'+livingRoomPath+theURL+'">';
    text = text + '<FRAMESET border=false rows="23,*,23,*" frameBorder=0 frameSpacing=0>';
    text = text + '<FRAME marginHeight=0 marginWidth=0 name=one scrolling=no src="'+livingRoomPath+'./virtual/colors_label.htm">';
    text = text + '<FRAME marginHeight=0 marginWidth=0 name=colors scrolling=auto src="'+livingRoomPath+'./virtual/colors.htm">';
    text = text + '<FRAME marginHeight=0 marginWidth=0 name=three scrolling=no src="'+livingRoomPath+'./virtual/frames_label.htm">';
    text = text + '<FRAME marginHeight=0 marginWidth=0 name=frames scrolling=auto src="'+livingRoomPath+'./virtual/frames.htm">';
    text = text +  '</FRAMESET></FRAMESET>';
	var theRoom = window.open("","virtual",options);
	theRoom.document.open();
	theRoom.document.write(text);
	theRoom.document.close();
}

function frameIt(theSelector){
	theChoice = theSelector;
	theStub = "../../../images/design/frame"+theChoice;
	parent.room.document.images['upperleft'].src = theStub+"_top_left.gif"
	parent.room.document.images['uppermiddle'].src = theStub+"_top_middle.gif"
	parent.room.document.images['upperright'].src = theStub+"_top_right.gif"
	parent.room.document.images['middleleft'].src = theStub+"_middle_left.gif"
	parent.room.document.images['middleright'].src = theStub+"_middle_right.gif"
	parent.room.document.images['bottomleft'].src = theStub+"_bottom_left.gif"
	parent.room.document.images['bottommiddle'].src = theStub+"_bottom_middle.gif"
	parent.room.document.images['bottomright'].src = theStub+"_bottom_right.gif"
	parent.room.document.bgColor = theColor ;}

function navigate(theSelector){
	selectedItem = theSelector.selectedIndex;
	theChoice = "./"+theSelector.options[selectedItem].value+".htm";
	location.href=theChoice;}

function openArtistTour(theSelector){
	selectedItem = theSelector.selectedIndex;
	theChoice = theSelector.options[selectedItem].value;
	openKeyTour(theChoice);
	}

function openKeyTour(theURL){
  var options = none+'width='+tourWindowWidth+', height='+tourWindowHeight+', toolbar=0';
  var winname = "Keyword";
  var win = window.open(theURL,winname,options); 
}

function openKeyWithinTour(theURL){location.href=theURL;}
  
function paintIt(theSelector){
	theColor = theSelector;
	parent.room.document.getElementById('theWall').style.backgroundColor = theColor ;
	parent.room.document.bgColor = theColor ;}

function setImage(imgName, imgPath, imgWidth, imgHeight, divID, imgClass, altText) {	
	var strPath = imgPath+imgName;
	if (pngAlpha) {
		sourceCode = '<div style="height:'+imgHeight+'px;width:'+imgWidth+'px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+strPath+'.png\', sizingMethod=\'scale\')" id="'+divID+'" class="'+imgClass+'" title=\''+altText+'\'></div>';
	} else if (pngNormal) {
		sourceCode = '<img src="'+strPath+'.png" width="'+imgWidth+'" height="'+imgHeight+'" name="'+divID+'" border="0" class="'+imgClass+'" alt="'+altText+'" />';
	} else {
		sourceCode = '<img src="'+strPath+'.gif" width="'+imgWidth+'" height="'+imgHeight+'" name="'+divID+'" border="0" class="'+imgClass+'" alt="'+altText+'" />';
	}
	return sourceCode;
	}

function setWindowWidth(){
  if (document.body.clientWidth < 790) {
   /* window.resizeTo(790,560);*/}}
  
function slideShow(){
	var options = none+'width=360,height=440';
	winname = "player";
	var player = window.open('./slideshow.htm',winname,options);}

function viewBio(theURL){
	width = 765;
	height = 508;
	var options = withScroll+'width='+width+',height='+height;
	winname = "Biography";
	var win = window.open(theURL,winname,options);}
	
function oldzoomIn(theURL){
  	var options = base+'resizable=1,scrolling=0,scrollbars=0,width=780,height=550';
  	winname = "image_zoom";
  	var win = window.open(theURL,winname,options);}
  	
 function zoomIn(theURL){
 
 
	width = 780;
	height = 550;
  	var options = base+'resizable=1,scrolling=0,scrollbars=0,width=780,height=550';
	var text = '<FRAMESET rows="*,33" frameborder=0 border=0 framespacing=0 bordercolor=#cccccc>';
    text = text + '<FRAME marginHeight=0 marginWidth=0 name=zoom scrolling=yes>';
     text = text + '<FRAME marginHeight=0 marginWidth=0 name=toolbar scrolling=auto src="'+theURL+'">';
    text = text +  '</FRAMESET>';
	var theZoom = window.open("","zoom",options);
	theZoom.document.open();
	theZoom.document.write(text);
	theZoom.document.close();
}

function writeZoomImage(theURL,theWidth,theHeight,theTitle){
	var text = "<html><body><table border='0' width='100%' class='maintable'><tr><td align='center' valign='middle'>";
	text = text + "<img src='"+theURL+"' class='framed' width='"+theWidth+"' height='"+theHeight+"'>";
	text = text + "</td></tr></table></body></html>";
	parent.zoom.document.open();
	parent.zoom.document.write(text);
	parent.zoom.document.close();
parent.document.title = theTitle;
}


/* set browser and operating system environment */

function getBrowser() {
var pngAlpha = false;
var pngNormal = false;
	var ua = navigator.userAgent.toLowerCase(); 
	this.ua = ua;
	var oPos = ua.indexOf('opera');
	// browser name
	this.isGecko     = (ua.indexOf('gecko') != -1);
	this.isMozilla   = (this.isGecko && ua.indexOf("gecko/") + 14 == ua.length);
	this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (oPos == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
	this.isIE        = ( (ua.indexOf("msie") != -1) && (oPos == -1) && (ua.indexOf("webtv") == -1) ); 
	this.isOpera     = (oPos != -1); 
	this.isIcab      = (ua.indexOf("icab") != -1); 
	this.isWebtv     = (ua.indexOf("webtv") != -1); 
	this.isOmniweb   = (ua.indexOf("omniweb") != -1);
	this.isDreamcast   = (ua.indexOf("dreamcast") != -1);
	
	// spoofing and compatible browsers
	this.isIECompatible = ( (ua.indexOf("msie") != -1) && !this.isIE);
	this.isNSCompatible = ( (ua.indexOf("mozilla") != -1) && !this.isNS && !this.isMozilla);
	
	this.versionMinor = parseFloat(navigator.appVersion); 	// browser version
	
	if (this.isNS && this.isGecko) {
		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
	} 	// correct version number for NS6+
	
	else if (this.isIE && this.versionMinor >= 4) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	} 	// correct version number for IE4+ 
	
	else if (this.isOpera) {
		if (ua.indexOf('opera/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
		}	else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
		}
	}	// correct version number for Opera 
	
	else if (this.isIcab) {
		if (ua.indexOf('icab/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
		} else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
		}
	}	// correct version number for iCab 
	
	else if (this.isWebtv) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('webtv/') + 6 ) );
	}	// correct version number for WebTV
	
	this.versionMajor = parseInt(this.versionMinor); 
	
	// platform
	this.isWin   = (ua.indexOf('win') != -1);
	this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1) );
	this.isMac   = (ua.indexOf('mac') != -1);
	this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('linux') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
	
	// specific browser shortcuts
	this.isIE5x = (this.isIE && this.versionMajor == 5);
	this.isIE55 = (this.isIE && this.versionMinor == 5.5);
	this.isIE5up = (this.isIE && this.versionMajor >= 5);
	this.isIE6x = (this.isIE && this.versionMajor == 6);
	this.isIE6up = (this.isIE && this.versionMajor >= 6);
	
	this.isIE4xMac = (this.isIE4x && this.isMac);
}

var browser = new getBrowser();

// if IE5.5+ on win32, then display PNGs with AlphaImageLoader
if ((browser.isIE55 || browser.isIE6up) && browser.isWin32) {
	var pngAlpha = true;
// else, if the browser can display PNGs normally, then do that. 
} else if ((browser.isGecko) || (browser.isIE5up && browser.isMac) || (browser.isOpera && browser.isWin && browser.versionMajor >= 6) || (browser.isOpera && browser.isUnix && browser.versionMajor >= 6) || (browser.isOpera && browser.isMac && browser.versionMajor >= 5) || (browser.isOmniweb && browser.versionMinor >= 3.1) || (browser.isIcab && browser.versionMinor >= 1.9) || (browser.isWebtv) || (browser.isDreamcast)) {
	var pngNormal = true;
} 

/* style variants */

function resizePreview(){
	var windowHeight = (NS6)? window.innerHeight : document.body.offsetHeight;
	/* if (windowHeight>430){ */
	document.getElementById('footer').style.top = windowHeight - footerHeight+"px" ;}
 
function resizeZoom(){
	var windowHeight = (NS6)? window.innerHeight : document.body.offsetHeight;
	document.getElementById('footer').style.top = windowHeight - footerHeight+"px" ;}

function resizeCover(){
	var windowHeight = (NS6)? window.innerHeight : document.body.offsetHeight;
	if (windowHeight>430){
     document.getElementById('footer').style.top = windowHeight - footerHeight ;}}
     
/* button package */

if (isIE && (!isMac)){
var offset = document.styleSheets[0].rules.length-1;
var offObj = document.styleSheets[0].rules[offset-2].style;
var onObj = document.styleSheets[0].rules[offset-1].style;
var downObj = document.styleSheets[0].rules[offset].style;
} else {
var offset = document.styleSheets[0].cssRules.length-1;
var offObj = document.styleSheets[0].cssRules[offset-2].style;
var onObj = document.styleSheets[0].cssRules[offset-1].style;
var downObj = document.styleSheets[0].cssRules[offset].style;
}

var onText = onObj.color;
var onHighlight = onObj.borderTopColor;
var onLowlight = onObj.borderBottomColor;
var onBackground = onObj.backgroundColor;

var downText = downObj.color;
var downHighlight = downObj.borderTopColor;
var downLowlight = downObj.borderBottomColor;
var downBackground = downObj.backgroundColor;

var offText = offObj.color;
var offHighlight = offObj.borderTopColor;
var offLowlight = offObj.borderBottomColor;
var offBackground = offObj.backgroundColor;
 

function buttonOver(which){
	var nodeObj = document.getElementById(which);
	var copyObj = document.getElementById('over');
	nodeObj.style.backgroundImage =  'url('+buttonPath+'images/design/'+which+'_on.gif)';
	nodeObj.style.backgroundPositionY='4px';
	nodeObj.style.margin='0px';
	nodeObj.style.padding='0px';
	nodeObj.style.lineHeight='13px';
	nodeObj.style.backgroundPosition = 'left center';
	nodeObj.style.backgroundPositionX='3px';
	nodeObj.style.backgroundPositionX='3px';
	nodeObj.style.borderColor = onLowlight;
	nodeObj.style.backgroundColor =onBackground;
	nodeObj.style.borderLeftColor = onHighlight;
	nodeObj.style.borderTopColor = onHighlight;
	nodeObj.style.color = onText;}

function buttonOut(which){
	var nodeObj = document.getElementById(which);
	nodeObj.style.backgroundImage =   'url('+buttonPath+'images/design/'+which+'_off.gif)';
	nodeObj.style.lineHeight='13px';
	nodeObj.style.backgroundPositionY='4px';
	nodeObj.style.margin='0px';
	nodeObj.style.padding='0px';
	nodeObj.style.backgroundPosition = 'left center';
	nodeObj.style.backgroundPositionX='3px';
	nodeObj.style.fontWeight = 'normal';
	nodeObj.style.fontStyle = 'normal';
	nodeObj.style.borderColor = offLowlight;
	nodeObj.style.borderLeftColor = offHighlight;
	nodeObj.style.borderTopColor = offHighlight;
	nodeObj.style.backgroundColor = offBackground;
	nodeObj.style.color = offText;}

function buttonClick(which){
	var nodeObj = document.getElementById(which);
	nodeObj.style.backgroundImage =   'url('+buttonPath+'images/design/'+which+'_down.gif)';
	nodeObj.style.backgroundColor = downBackground;
	nodeObj.style.borderColor = downHighlight;
	nodeObj.style.color = downText;
	nodeObj.style.borderBottomColor = downLowlight;
	nodeObj.style.borderRightColor = downLowlight;
}


