//editing the string replace function
String.prototype.replace = function(searchString,replaceString) {
	return this.split(searchString).join(replaceString);
}



//alert (isthisspace("\n\n\n\n"));
function isthisspace(str){
	//alert("String " + str);
	str_arr = str.split(" ");
	match = true;
	
	//alert("Number of spaces " + str_arr.length);
	
	for (i=0;i<str_arr.length;i++){
		//if(str_arr[i].length > 0){
			//match = false;
			//alert("Matched 1 " + str_arr[i]);
			
			str_arr2 = str_arr[i].split("\n");
		
			//alert("Number of returns in price# " + i + " is " + str_arr2.length);
			
			for (j=0;j<str_arr2.length;j++){
				piece = str_arr2[j].replace(String.fromCharCode(13), "");
				piece = piece.replace(String.fromCharCode(10), "");
				piece = piece.replace(" ", "");
				piece = piece.replace("\n", "");
				piece = piece.replace("\t", "");
				
				if(piece.length > 0){
					match = false;
					//alert("Matched 2 '" + str_arr2[j] + "' Char Code " + str_arr2[j].charCodeAt(0));
				}
			}
			
		//}
		
	}
	
	//alert(match);
	
	return match;
}



function toggleBox(szDivID) {
  if (document.layers) { // NN4+
    if (document.layers[szDivID].visibility == 'visible') {
      document.layers[szDivID].visibility = "hide";
      document.layers[szDivID].display = "none";
    } else {
      document.layers[szDivID].visibility = "show";
      document.layers[szDivID].display = "inline";
    }
  } else if (document.getElementById) { // gecko(NN6) + IE 5+
    var obj = document.getElementById(szDivID);

    if (obj.style.visibility == 'visible') {
      obj.style.visibility = "hidden";
      obj.style.display = "none";
    } else {
      obj.style.visibility = "visible";
      obj.style.display = "inline";
    }
  } else if (document.all) { // IE 4
    if (document.all[szDivID].style.visibility == 'visible') {
      document.all[szDivID].style.visibility = "hidden";
      document.all[szDivID].style.display = "none";
    } else {
      document.all[szDivID].style.visibility = "visible";
      document.all[szDivID].style.display = "inline";
    }
  }
}

function openBox(szDivID) {
  if (document.layers) { // NN4+
      document.layers[szDivID].visibility = "show";
      document.layers[szDivID].display = "inline";
  } else if (document.getElementById) { // gecko(NN6) + IE 5+
    var obj = document.getElementById(szDivID);
      obj.style.visibility = "visible";
      obj.style.display = "inline";
  } else if (document.all) { // IE 4
      document.all[szDivID].style.visibility = "visible";
      document.all[szDivID].style.display = "inline";
  }
}

function closeBox(szDivID) {
  if (document.layers) { // NN4+
      document.layers[szDivID].visibility = "hide";
      document.layers[szDivID].display = "none";
  } else if (document.getElementById) { // gecko(NN6) + IE 5+
    var obj = document.getElementById(szDivID);
      obj.style.visibility = "hidden";
      obj.style.display = "none";
  } else if (document.all) { // IE 4
      document.all[szDivID].style.visibility = "hidden";
      document.all[szDivID].style.display = "none";
  }
}

function changeBoxColor(me, hexbg, hexborder){
	me.style.background=hexbg;
	me.style.borderColor=hexborder;
}