if (!document.getElementById){
	alert("your browser is very old, and should have been laid to rest a while ago.  Please upgrade?");
}

String.prototype.trim = function() {

 // skip leading and trailing whitespace
 // and return everything in between
  var x=this;
  x=x.replace(/^\s*(.*)/, "$1");
  //  x=x.replace(/(.*?)\s*$/, "$1");
  return x;
}

function getEl(name){
	return document.getElementById(name);
}

function showHideDiv(name){
	var divvie = getEl(name);
	divvie.style.visibility = (divvie.style.visibility == "hidden")?"visible":"hidden";
}

// pic funcs

var last_pic;

var pre_load_pics = [];

function changeRandomPic(pics,pic_div) {
  var index = Math.floor(Math.random()*pics.length);

  if (index != last_pic){
    var pic = getEl(pic_div);
    pic.src = "pics/"+pics[index];
    last_pic=index;
  }else{
    changeRandomPic(pics,pic_div);
  }  
}

function preLoadPics(pics,pic_dir){
  for (i=0;i<pics.length;i++){
    if (i!=last_pic) pre_load_pics.push((new Image()).src = "pics/"+(pic_dir?pic_dir+"/":"")+pics[i]); 
  }
}

function getWidthHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [myWidth,myHeight];
}

function changeLineSize() {
  
  var screen_dims = getWidthHeight();
  var width = 0;

  width = screen_dims[0] < 960?"960":screen_dims[0];

  getEl("top_line_div").style.width = (width - 240)+"px";
  getEl("bottom_line_div").style.width = (width - 240) +"px";

}

