// JavaScript Document
	var butImage = new Array();
	butImage[0] = 'h_tilecatalogbutton.jpg';
	butImage[1] = 'h_blendcatalogbutton.jpg';
	butImage[2] = 's_tilecatalogbutton.jpg';
	butImage[3] = 's_blendcatalogbutton.jpg';
	
	var butImageOver = new Array();
	butImageOver[0] = 'ho_tilecatalogbutton.jpg';
	butImageOver[1] = 'ho_blendcatalogbutton.jpg';
	butImageOver[2] = 'so_tilecatalogbutton.jpg';
	butImageOver[3] = 'so_blendcatalogbutton.jpg';
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function hoverButton(pg,cat,status) {
		// (home or sub, tc or bc for tile or blend catalog, 1 over, 0 off )
		if ( pg == 'h' ) {
			tile = 0 ;
			blend = 1;
		} else {
			tile = 2 ;
			blend = 3;
		}
		
		if ( status == 1 ) {
			arrImage = butImageOver;
		} else {
			arrImage = butImage;
		}
		
		if ( cat == 'tc' ) {
			part = tile ;
		} else {
			part = blend ;
		}
		
		button = pg+cat ; 
		newImage = '/images/site/'+arrImage[part];
		document.getElementById(button).src = newImage;
	}

	menus = new Array("tile-accessories","about-grout","tile-installation","by-room","by-surface","in-commerce","tile-styles","tv-appearances");
	var fh = 0;
	onDiv =0;

	function show(id,mode) {
		if (id == onDiv) {
			id =0;	
		}
		
		for (x=0;x<menus.length;x++) {
			if (id-1==x) {
			document.getElementById(menus[x]).style.display = 'block';
			} else {
			document.getElementById(menus[x]).style.display = 'none';
			}
		}
		onDiv = id ;
		
		if (mode == 0) {
			setPageHeight(1);
		} else {
			setPageHeightHome(1);
		}
	}
	

	function setPageHeight(id) {
		document.getElementById('leftcolumnSub').style.height = 'auto';
		document.getElementById('contentSub').style.height = 'auto';
		document.getElementById('rightcolumn').style.height = 'auto';
			
		lh = document.getElementById('leftcolumnSub').offsetHeight ;
		ch = document.getElementById('contentSub').offsetHeight ;
		rh = document.getElementById('rightcolumn').offsetHeight ;
		
		fh = lh;
		if (ch > fh) {fh = ch;}	
		if (rh > fh) {fh = rh;}	
			
		if (id==1) {
		fh=(fh+10)+'px';
		} else {
		fh=(fh+10)+'px';
		}

		document.getElementById('leftcolumnSub').style.height = fh;
		document.getElementById('contentSub').style.height = fh;
		document.getElementById('rightcolumn').style.height = fh;

	}
	
	function setPageHeightHome(id) {
		document.getElementById('leftcolumn').style.height = 'auto';
		document.getElementById('content').style.height = 'auto';
		document.getElementById('rightcolumn').style.height = 'auto';
			
		lh = document.getElementById('leftcolumn').offsetHeight ;
		ch = document.getElementById('content').offsetHeight ;
		rh = document.getElementById('rightcolumn').offsetHeight ;
		
		fh = lh;
		if (ch > fh) {fh = ch;}	
		if (rh > fh) {fh = rh;}	
			
		if (id==1) {
		fh=(fh+10)+'px';
		} else {
		fh=(fh+10)+'px';
		}

		document.getElementById('leftcolumn').style.height = fh;
		document.getElementById('content').style.height = fh;
		document.getElementById('rightcolumn').style.height = fh;

	}

	
	function f_clientWidth() {
		return f_filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	}
	function f_clientHeight() {
		return f_filterResults (
			window.innerHeight ? window.innerHeight : 0,
			document.documentElement ? document.documentElement.clientHeight : 0,
			document.body ? document.body.clientHeight : 0
		);
	}
	function f_scrollLeft() {
		return f_filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	}
	function f_scrollTop() {
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}


	
	function showDiv(id) {
		x = f_scrollTop();
		x = x - 150;
		document.getElementById('preview_'+id).style.top = x+'px';
		document.getElementById('preview_'+id).style.display = 'block';
	}
	
	function hideDiv(id) {
		document.getElementById('preview_'+id).style.display = 'none';
	}
	
	function send_to_a_friend() {
		current_url = parent.document.location;
		title = parent.document.title;	
		URL = '/send_to_a_friend.php?page='+current_url+'&title='+title;
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=600,height=400,left = 340,top = 200');");
	}

	function bookmark_page() {
		url = parent.document.location;
		title = 'Susan Jablon Mosaics - '+parent.document.title;	
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title); }
		else if(window.opera && window.print) { // Opera Hotlist
			return true; 
		}
	}