/* $Id: index.js,v 1.1.2.6 2004/12/08 16:10:15 dima Exp $ */
        window.name = 'main_fs_window';

	function select(img1,img2) {
	    if (img1 != 's0') 
			document.images[img1].src = eval(img2+".src");
	}


	function get_normal_digits(tmp) {
		     tmp = tmp * 100;
		     tmp = Math.round(tmp);
		     tmp = tmp / 100;
		     tmp = tmp + '';
		     var aaa = tmp.split('.');
		     if (aaa.length == 1) {
			tmp = tmp + '.00';
		     } else {
		        if (aaa[1].length == 1) {
		 	   tmp = tmp + '0';
			}
		     }
		     return tmp;
	}


	function swapImage(image, newName) {
		var chImage = document.getElementById(image);
	    if (chImage != null) 
			chImage.src = "/images/main/"+newName;
	}

	function hide_shown_div(div_id) {
			document.getElementById(div_id).style.visibility = 'hidden';
	}

	function show_hidden_div(div_id,parent_id) {
		var div = document.getElementById(div_id);
		var parent = document.getElementById(parent_id);
		var delta = parent.offsetHeight - 1;
		// starting from 1.3 FreeBSD build has no -moz-opacity support :-(
		// this is workaround for the problem...
		if ( navigator.product == "Gecko" && navigator.oscpu.match('FreeBSD') )
			div.firstChild.setAttribute('style','');
			
		var ot = parent.offsetTop;
		var ol = parent.offsetLeft;
		while((parent = parent.offsetParent) != null) {
			ot += parent.offsetTop;
			ol += parent.offsetLeft;
		}
		div.style.left = ol + "px";
		div.style.top = ot + delta + "px";
		div.style.visibility = 'visible';
	}

	function open_w(name, link, width, height, wTitle) {
		newWindow = window.open('', name, 'resizable=yes, width='+width+', height='+height+', scrollbars=no, toolbar=no, titlebar=no, menubar=no');
		newWindow.document.write('<HTML><HEAD><TITLE>'+wTitle+'</TITLE><STYLE>	BODY {			padding: 0px px px 0px;			margin:  0px 0px 0px 0px;	}</STYLE></HEAD><BODY leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><img SRC="'+link+'" WIDTH="'+width+'" HEIGHT="'+height+'" ALT="'+wTitle+'"></BODY></HTML>');
	}
	
	function open_c(name, link, width, height, scroll) {
		var sc;
		if (scroll == 1) {
			sc = 'yes';
		} else {
			sc = 'no';
		}
		newWindow = window.open('', name, 'resizable=yes, width='+width+', height='+height+', scrollbars='+sc+', toolbar=no, titlebar=no, menubar=no');
		newWindow.document.location.replace(link);
	}

	function sizecalc(unitsf,width,length,sf) {
		if (!unitsf) {
			alert("You did not enter the m2 per unit.\n\n\nThe amount of m2 per unit is shown next to the price of each item listed.\n\n\nPlease enter this value and try again.");
			return;
		}
		if (sf) {
			document.sizer.units.value = Math.ceil(sf / unitsf);
			window.opener.document.form2.quan.value = document.sizer.units.value;
			return;
		}

		if (!width || !length) {
			alert("Please enter the a width and length value, or enter a total m2 amount and try again.");
			return;
		}

		sf1 = width * length * 0.05;
		sf = width * length + sf1;

		document.sizer.sf.value = sf;
		document.sizer.units.value = Math.ceil(sf / unitsf);
		window.opener.document.form2.quan.value = document.sizer.units.value;
	}
	
	function changeRootmenuImage(id,src, style) {
			var objectImage = document.getElementById(id);
			if (objectImage != null) {
				objectImage.src=src;
				objectImage.style.cssText = style;
			}
	}

	function bottom_menu(mode, id) {
			if (mode == 1) {
				changeRootmenuImage('_bt'+id, '/images/main/bt_'+id+'_.gif', 'cursor:hand; cursor:pointer;')
			} else {
				changeRootmenuImage('_bt'+id, '/images/main/bt_'+id+'.gif', '')
			}
	}

	function getStyleClass (className) {
			if (document.all) {
				for (var s = 0; s < document.styleSheets.length; s++)
					for (var r = 0; r < document.styleSheets[s].rules.length; r++)
						if (document.styleSheets[s].rules[r].selectorText == '.' + className)
						  return document.styleSheets[s].rules[r];
			} else if (document.getElementById) {
				for (var s = 0; s < document.styleSheets.length; s++)
					for (var r = 0; r < document.styleSheets[s].cssRules.length; r++)
						if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
						  return document.styleSheets[s].cssRules[r];
		    }
			return null;
	}

