function trim_spaces(from_where){
  var temp_string = this
  
  if (arguments.length == 0) {
  	from_where = "BOTH"
  }
  
  if (from_where.toUpperCase() == "LEFT" || from_where == "BOTH" ){
  	while( temp_string.left(1) == " "){
	  		temp_string = temp_string.substring(1)
  	}
  }
  
  if (from_where.toUpperCase() == "RIGHT" || from_where == "BOTH" ){
  	while( temp_string.right(1) == " "){
  		temp_string = temp_string.substring(0,temp_string.length-1)
  	}
  }

  return temp_string
}

function extract_left(total_chars){
  return this.substring(0,total_chars)
}

function extract_right(total_chars){
  return this.substring(this.length-total_chars)
}

String.prototype.right = extract_right
String.prototype.left = extract_left
String.prototype.trim = trim_spaces

function test_mail(mail){
  var reg_mail = /^[a-z][\w\-\.]*@[\w\-\.]+\.[a-z]{2,3}/i
  return reg_mail.test(mail) 
}


function open_center(source, title, Width, Height){

    var w_height=screen.availHeight-Height;
    var w_width=screen.availWidth-Width;
    var w_left=(screen.availWidth / 2) - (Width / 2);
    var w_top=(screen.availHeight / 2) - (Height / 2);
  
    var w_dimension = "height="+Height+",width="+Width+",left="+w_left+",top="+w_top;
    window.open(source, title, w_dimension);
 }//function
 
 function open_center_2(source, title, Width, Height){

    var w_height=screen.availHeight-Height;
    var w_width=screen.availWidth-Width;
    var w_left=(screen.availWidth / 2) - (Width / 2);
    var w_top=(screen.availHeight / 2) - (Height / 2);
  
    var w_dimension = "height="+Height+",width="+Width+",left="+w_left+",top="+w_top;
    window.open(source, title, w_dimension + ", status = yes, scrollbars=yes, resizable=yes, menubar=yes");
 }//function

function submenu_show ()
{
	if(document.all)
	{
		option_catalog.style.visibility = 'visible';
	}
}

function submenu_hide ()
{
	if(document.all)
	{
		option_catalog.style.visibility = 'hidden';
	}
} 
 //preload images
 /*
var img1 = new Image();
img1.src = "img/l_about.jpg";
var img2 = new Image();
img2.src = "img/l_about_2.jpg";
*/
