function mapbysid(sid)
{
	var thestring = '/geturtable/maps.html?supplier_id=' + sid;
	popup(thestring,'maps_popup', 700, 'scrollbars=yes,width=640,height=480')
	return true;
}

function showElement(element_id) 
{
   if (document.getElementById &&
         document.getElementById(element_id) &&
         document.getElementById(element_id).style)
      document.getElementById(element_id).style.visibility="visible";
}

function hideElement(element_id) 
{
   if (document.getElementById &&
         document.getElementById(element_id) &&
         document.getElementById(element_id).style)
      document.getElementById(element_id).style.visibility="hidden";
 	
}


function stripNonDigits(str) {
	var i
	var newstring = ""
	for (i = 0;  i < str.length; i++) {
		mychar = str.charAt(i)
		if (isDigits(mychar)) 
			newstring += mychar
	}
	return newstring
}
// Returns true if character c is a digit 
// (0 .. 9).

function isDigits (c)
{   return ((c >= "0") && (c <= "9"))
}


function stripChars(str, chars) {
	var i
	var newstring = ""
	for (i = 0;  i < str.length; i++) {
		mychar = str.charAt(i)
		if (chars.indexOf(mychar) == -1)
			newstring += mychar
	}
	return newstring
}


var  styleSwitch;  
  
function highlight(img, location, desc) {
    if (document.images) {
		document.images[img].src = location + "2bt" + img + ".gif";
    }
	window.status=desc;
	return true;
}

function unhighlight(img, location) {
    if (document.images && img) {
		document.images[img].src = location + "bt" + img + ".gif";
    }	
	window.status="DinnerBroker ";
	return true;
}
//INITS
	if (navigator.appName == "Netscape") {
		layerRef="document.layers";
		styleSwitch="";
	}else{
		layerRef="document.all";
		styleSwitch=".style";
	}

	var current_sub_showing="Home";
	var current_tab="home";
	var layerRef;
	
//HIDE SHOW LAYER FUNCTIONS
	function showLayer(layerName){
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
	}
	function hideLayer(layerName){
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
	}
//ROLLOVER CODE
	function doRollover(sub_name,tab){
		hideLayer(current_sub_showing);
		showLayer(sub_name);
		current_sub_showing=sub_name;
		document.images[current_tab].src = "/shared/bt"+current_tab+".gif";		
		current_tab=tab;
	}
	
	function current(sub_name,tab){
		showLayer(sub_name);
		current_sub_showing=sub_name;
		document.images[tab].src = "/shared/2bt"+tab+".gif";
		current_tab=tab;
	}
	
	function MM_goToURL() { //v2.0
	  for (var i=0; i< (MM_goToURL.arguments.length - 1); i+=2) //with arg pairs
	    eval(MM_goToURL.arguments[i]+".location='"+MM_goToURL.arguments[i+1]+"'");
	  document.MM_returnValue = false;
	 }

	function openBrWindow(theURL,winName,features) {
	  window.open(theURL,winName,features);
	}	 

    function popup(mylink, windowname, width, features)
	{
	var sx = screen.width;
	var sy = screen.height;
	var wx = sx - width - 10;
	var wy = (sy / 2) - 200;

	features=features+",resizable=yes,menubar=0,status=0,titlebar=0,toolbar=0,left=0,top=0,left=" + wx + ",top=0";

//		if (! window.focus)return true;
		var href;
		if (typeof(mylink) == 'string')
		   href=mylink;
		else
		   href=mylink.href;
		window.open(href, windowname,features);
		return false;
	}
	
    function popup_backup(mylink, windowname, features)
	{
	var sx = screen.width;
	var sy = screen.height;
	var wx = (sx / 2) + 80;
	var wy = (sy / 2) - 200;

	features=features+",resizable=yes,menubar=0,status=0,titlebar=0,toolbar=0,left=0,top=0,left=" + wx + ",top=0"

		if (! window.focus)return true;
		var href;
		if (typeof(mylink) == 'string')
		   href=mylink;
		else
		   href=mylink.href;
		window.open(href, windowname,features);
		return false;
	}
	
    function popup_middle(mylink, windowname, features)
	{
	var sx = screen.width;
	var sy = screen.height;
	var wx = (sx / 2) - 200;
	var wy = (sy / 2) - 175;

	features=features+",resizable=yes,menubar=0,status=0,titlebar=0,toolbar=0,left=" + wx + ",top=" + wy

		if (! window.focus)return true;
		var href;
		if (typeof(mylink) == 'string')
		   href=mylink;
		else
		   href=mylink.href;
		window.open(href, windowname,features);
		return false;
	}	
function popup_middle_pass_features(mylink, windowname, features)
        {
        var sx = screen.width;
        var sy = screen.height;
        var wx = (sx / 2) - 200;
        var wy = (sy / 2) - 175;

        features=features+",left=" + wx + ",top=" + wy

                if (! window.focus)return true;
                var href;
                if (typeof(mylink) == 'string')
                   href=mylink;
                else
                   href=mylink.href;
                window.open(href, windowname,features);
        return false;
        }
	
function image_preloader() {
	for (var k = 0; k < arguments.length; k++) {
		x = new Image();
		x.src = arguments[k];
	}
	return;
}
