function textOnHover(item, stylename) {

	item.className = stylename;
}

function textOffHover(item, stylename) {

	item.className = stylename;
}

function goToSection(sectionName) {

contentref = document.getElementById('content_frame');
	
	contentref.src  = (sectionName + '.html');

}


//On Page Load

function check_url() {

	loaction = window.location.hash;
	contentdir = './html/';
	defaultpage = 'home';
	pagextension = '.html';


	if(loaction) {
	
		loaction = loaction.replace("#", "");	
		create_ajax_req( contentdir + loaction + pagextension, 'content_area' );
		
	} else {
	
		create_ajax_req( contentdir + defaultpage + pagextension, 'content_area' );
		
	}

}

function page_titler(pagetitle) {

	window.document.title = pagetitle;

}

function content_loader(section, ptitle) {

	
	if( section ) {

		window.location.hash =  section;

	} 
	
	
	 check_url() ;
	 page_titler(ptitle);
	 
}


//AJAX Functions

function create_ajax_req(url, target) {

  document.getElementById(target).innerHTML =
  '<img src="./images/loading.gif" ' +
  'align="center" valign="middle" hspace="4" vspace="4">' +
  '<span class="text_small">Loading...</span>';

  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ajax_page_loader(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}

function ajax_page_loader(url, target) {
  if (req.readyState == 4) { // request is "loaded"
    if (req.status == 200) { // status is "OK"
      document.getElementById(target).innerHTML = req.responseText;
    }
  }
}


