
function rollOver(img1,ref1) {
    if (document.images) {
        document.images[img1].src = eval(ref1 + ".src")
    }
}

//sitemap functions
function hide_collapse(parent_elemt){

	var item = document.getElementById(parent_elemt);
	if (item.style.display == 'none'){
		item.style.display = 'block';
	}else{
		item.style.display = 'none';
	}
}

function expand_it(){

	var lists = document.getElementsByTagName('UL');
	for (var i = 0; i < lists.length; i++) {
		if (lists[i].style.display == 'none'){
			lists[i].style.display = 'block';
		}
	}

}
function collapse_it(){

	var lists = document.getElementsByTagName('UL');
	for (var i = 0; i < lists.length; i++) {
		if (lists[i].style.display == 'block'){
			lists[i].style.display = 'none';
		}
	}

}

	//Main Nav Hover
	function main_nav_hover(cell_id){

		if(document.getElementById(cell_id).className=='home_menu_item'){
			document.getElementById(cell_id).className='home_menu_item_sel';
		}else{
			document.getElementById(cell_id).className='home_menu_item';
		}

	}
	
//flash detection
// looks for version 6 or above
var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
    x = navigator.plugins["Shockwave Flash"];
    if (x)
    {
        flashinstalled = 2;
        if (x.description)
        {
            y = x.description;
            flashversion = y.charAt(y.indexOf('.')-1);
            if(flashversion < 6)
            { // Set desired flash version here
                flashinstalled = 1;
            }
        }
    }
    else
        flashinstalled = 1;
    if (navigator.plugins["Shockwave Flash 6.0"])
    {
        flashinstalled = 2;
        flashversion = 2;
    }
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
    x = navigator.mimeTypes['application/x-shockwave-flash'];
    if (x && x.enabledPlugin)
        flashinstalled = 2;
    else
        flashinstalled = 1;
}
else
    MSDetect = "true";

//Rotating Image Script
var pcode;
var position;
var stringa;
var stringb;
var stringc;
var spot = new Array(7);
stringa = '<a href="http://colorandglass.com/gallery/w';
stringb = '.html"><img src="/images/130s/';
stringc1 = '.jpg" alt="Gallery Image" width="25" height="25" border="0"></a>';
stringc2 = '.jpg" alt="Gallery Image" width="50" height="50" border="0"></a>';
stringc3 = '.jpg" alt="Gallery Image" width="90" height="90" border="0"></a>';
stringc4 = '.jpg" alt="Gallery Image" width="130" height="130" border="0"></a>';


//randomly select & display header photos:
function rand_order(numavail) {
var numavail;
var order_value = -1;
while ( (order_value < 1) || (order_value > numavail) || (isNaN(order_value)) ) 
{
order_value = parseInt(Math.random() * (numavail + 1));
}
return order_value;
}

if (document.location.search.length == 3) {position = eval(document.location.search.substring(1,3));}
else {
position = rand_order(15);
}
for (var i = 1; i < 8; i++) {
if ((i + position - 4) > 15){
spot[i] = i + position - 19;
}
else if ((i + position - 4) < 1){
spot[i] = i + position + 11;
}
else {
spot[i] = i + position - 4;
}
if (spot[i] < 10) {spot[i] = '0' + spot[i]};
}
var rotatea = '<a onclick=\"location.href = \'http://colorandglass.com/gallery.html?';
var rotatebleft = '\'\"><img src="/images/arrowleft.jpg" width="40" height="32"></a>';
var rotatebright = '\'\"><img src="/images/arrowright.jpg" width="40" height="32"></a>';
/*spot[1] = '01';
spot[2] = '01';
spot[3] = '01';
spot[4] = '01';
spot[5] = '01';
spot[6] = '01';
spot[7] = '01';
*/
//quickfind menu:
function goto_URL(newPage)
 {
   nextPage = newPage.options[newPage.selectedIndex].value
   if (nextPage != "")
   { document.location.href = nextPage }
 }
 
 
/*function goto_URL(targ,selObj,restore){ //v3.0
    
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
   if (restore) selObj.selectedIndex=0;
}*/