// JavaScript Document

function show(n){
 if ($(n)){
  	$(n).style.display = "block"
 }
}
function hide(n){
 if ($(n)){
  	$(n).style.display = "none"
 }
}
function toggle() {
	
	for (var i=0; i<toggle.arguments.length; i++) {
		var element = $(toggle.arguments[i]);
		element.style.display = (element.style.display == "none" || element.style.display == "") ? "block" : "none";
	}
}
function replaceContent(x,n) {
	x = $(x)
	//alert(n)
	x.innerHTML = n; 
}
function ClearText(n){
  	n.value = ""
}
function redirect(url) {
	window.location.href = url
	}
function reloadPage(){window.location.reload()}

function openPopup(url,name,options) {
	win = window.open(url,name,options);
	if (window.focus) {	win.focus();}
}
function formValidator(theForm) {
	// first var for form name, second for alert text...
	var textFields = [["first", "first name"],["last", "last name"],["email", "email"],["city", "city"],["comments","comments"]];
	// check all the text boxes...
	for (i=0; i<textFields.length; i++) {
		if (!theForm[textFields[i][0]].value)	{
			alert("Please enter your "+textFields[i][1]+".");
			theForm[textFields[i][0]].focus();
			return (false);
		}
	}
	return (true);
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function ajaxUpdateBox(x) {
	top = $(window).scrollTop() + "px"
	$(".ajax-updating").css("top",top)
	if (x == "in") {		
		$(".ajax-updating").fadeIn("slow")
	}
	if (x == "out") {
		$(".ajax-updating").fadeOut("slow")
	}
}






