<!--

//Copyright e-Business Systems Limited  www.e-businesssystems.co.uk





//version 10 - 24/01/10
//version 9 - 06/01/09




function Ebsl_show_x(id_prefix){
	Ebsl_show_hide_x(id_prefix,true);
}

function Ebsl_hide_x(id_prefix){
	Ebsl_show_hide_x(id_prefix,false);
}

function Ebsl_show_hide_x(id_prefix,show){
	var i,id_name,element_ref;
	var finished = false;
	
	if (document.getElementById && document.getElementsByTagName && document.createTextNode) 
	{
    	for (i = 1; !finished; i++)
    	{
    		id_name = id_prefix + i;
    		element_ref = document.getElementById(id_name);
    		if (element_ref != null)
    		{
    			element_ref.style.visibility = (show ? "visible" : "hidden");
    			element_ref.style.display = (show ? "block" : "none");
    			
    		}
    		else
    		{
    			finished = true;
    		}
    		
    	}
	}

}





function Ebsl_show_hide(k)
{
    if (document.getElementById && document.getElementsByTagName && document.createTextNode) 
    {
    	var element = document.getElementById(k);
        if (element.style.display == 'block') 
        {
               element.style.display = 'none';
        }
        else 
        {
               element.style.display = 'block';
      	}
    }
 }






function Not_yet_ready(){
	window.alert("Sorry.  This option has not yet been implemented");
}


function Right_click(e) 
{
	var msg = "Sorry, images are copyright.";
	if (navigator.appName == 'Netscape' && e.which == 3) 
	{
		alert(msg);
		return false;
	}
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) 
	{
	alert(msg);
	return false;
	}
	else return true;
}

function Rc_set() 
{
	if(document.images)
	{
	for(i=0;i<document.images.length;i++)
	    {
			document.images[i].onmousedown = Right_click;
			document.images[i].onmouseup = Right_click;
	    }
	}
}








function Change_style_attribute(attribute_name,id_name,change_to)
{
	
	
		eval("document.getElementById('" + id_name + "').style." + attribute_name + " = change_to");
	
}




function Visibility_off(k)
{
	
	{
		
		Change_style_attribute("visibility",k,"hidden");
	}
}



function Visibility_on(k)
{
	//if (ebsl_setup_complete)
	{
		
		Change_style_attribute("visibility",k,"visible");
	}
}


function Display_on(k)
{
	
	{
		
		Change_style_attribute("display",k,"block");
	}
}



function Display_off(k)
{
	//if (ebsl_setup_complete)
	{
		
		Change_style_attribute("display",k,"none");
	}
}






function Notice_clicked(id_name)
{
	Visibility_off(id_name);
}







function Change_text(id,old_text,new_text)
{
	
	var regexp;
	eval("regexp = /" + old_text + "/g");
	document.getElementById(id).innerHTML = document.getElementById(id).innerHTML.replace(regexp,new_text);
	
}



//------------------------------------------------------




 function HTMLencode(text) 
 {
    return text.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
 }
  
  
 function HTMLdecode(text) 
 {
    return text.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"');
 }












function FormatNumber(num,decimal_places)
{ 
	try
	{
		num = parseFloat(num);
		
		if (num.toFixed)
		{
			return num.toFixed(decimal_places);
		}
		else
		{
			return num;
		}
	}
	catch (e)
	{
		return num;

	}
}



function Window_scroll_dimension(dimension) 
{
  
  var scrOfX = 0, scrOfY = 0;	//this is the scroll offset - amount scrolled
  if( typeof( window.pageYOffset ) == 'number' ) 
  {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
  {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
  {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  if (dimension == "w")
  {
	return scrOfX;
  }
  if (dimension == "h")
  {
	return scrOfY;
  }

}




function Document_height() 
{
	var body = document.body, html = document.documentElement; 
	return Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 
}


function Document_width() 
{
	var body = document.body, html = document.documentElement; 
	return Math.max( body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth ); 
}













function Window_size(dimension) 
{
  var window_width = 0, window_height = 0;
  if(typeof(window.innerWidth) == 'number') 
  {
    //Non-IE
    window_width = window.innerWidth;
    window_height = window.innerHeight;
  } 
  else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
  {
    //IE 6+ in 'standards compliant mode'
    window_width = document.documentElement.clientWidth;
    window_height = document.documentElement.clientHeight;
  } 
  else if(document.body && (document.body.clientWidth || document.body.clientHeight)) 
  {
    //IE 4 compatible
    window_width = document.body.clientWidth;
    window_height = document.body.clientHeight;
  }
  if (dimension == "w")
  {
	return window_width;
  }
  if (dimension == "h")
  {
	return window_width;
  }
}




//------------------------------------------------------

function isInteger (s)
{
    var i;

    if (isEmpty(s))
    if (isInteger.arguments.length == 1) return 0;
    else return (isInteger.arguments[1] == true);

    for (i = 0; i < s.length; i++)
    {
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    return true;
}






function isEmpty(s)
{
    return ((s == null) || (s.length == 0))
}






function isDigit (c)
{
    return ((c >= "0") && (c <= "9"))
}







function Gebid(id)
{
	return document.getElementById(id);
}









//--------- simple timer class ------------------
function Ebsl_timer_simple()
{
	this.timer_is_being_used = false;
	this.time_allowed = 0; //seconds
	this.Time_taken = Calculate_time_taken_simple;
	this.external_action_function = "";	//called when time is up
	this.timeout_id;
	this.time_started;
	this.Start_timer = Ebsl_start_timer_simple;
	this.Clear_timer = Ebsl_clear_timer_simple;
}


function Ebsl_start_timer_simple(time_allowed_x,action_function)
{
	this.timer_is_being_used = true;
	this.external_action_function = action_function;
	this.time_allowed = time_allowed_x;
	this.time_started = new Date();
	
	this.timeout_id = setTimeout(action_function,(1000 * time_allowed_x));
}



function Calculate_time_taken_simple()
{
	
	var current_time = new Date();
	return Math.floor((current_time - this.time_started) / 1000);
}



function Ebsl_clear_timer_simple()
{
	if (this.timer_is_being_used)
	{
		clearTimeout(this.timeout_id);	
	}
}

//--------- end simple timer class ------------------






//-->