

//clear field 
function clearField() {
	
	$("form").find("input").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
	  
}

sfHover = function() {
	
	var sfEls = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfHover";
			$('#menu_holder').addClass('menuHover');
		}
		sfEls[i].onmouseout=function() {
			$(this).removeClass("sfHover");
			$('#menu_holder').removeClass('menuHover');
		}
	}
}


//Print Function
function printPage() {

	//Print Button
	$("#print").click( function() {
		if (window.print) window.print();
		else if (VBS) printIt();
		else alert('This script does not work in your browser');
		return false;
	});	
}



//Text Resizer
function textResize() {
  var originalFontSize = $('html').css('font-size');
  $(".resetFont").click(function(){
  $('html').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $('#font-increase a').click(function(){
  	var currentFontSize = $('html').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.1;
	if ( newFontSize < 26 ) {
	$('html').css('font-size', newFontSize);
	}
	return false;
  });
  // Decrease Font Size
  $('#font-decrease a').click(function(){
  	var currentFontSize = $('html').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
	var newFontSize = currentFontSizeNum*0.9;
	if ( newFontSize > 11 ) {
	$('html').css('font-size', newFontSize);
	}
	return false;
  });
}

/*function bookmark() {
// add a "rel" attrib if Opera 7+
	if(window.opera) {
		if ($("#bookmark a").attr("rel") != ""){
			$("#bookmark a").attr("rel","sidebar");
		} 
	}

	$("#bookmark a").click(function(event){
		event.preventDefault();
		var url = this.href;
		var title = this.title;
		
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		} else if(window.opera) { // Opera 7+
			return false; // do nothing
		} else { 
			 alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
		}
	
	});

}
*/



//**********************************
//Load Functions
//**********************************
$(document).ready( function() {
							
	$('#menu_holder').prepend('<div class="underlay"><!--clearer--></div>');					

	$('.main_content').prepend('<div class="utility"><ul><li id="bookmark"><a href="http://www.ozminerals.com/media/docs/OZSustainability_Report_2008-079ca66f-616f-4b1a-82a5-6ef63300f0cd-0.pdf" title="Download report" alt="Download report"><span>Download report</span></a></li><li id="print"><a href="" title="Print this page" alt="Print this page"><span>Print</span></a></li><li id="font-increase"><a href="" title="Increase font size" alt="Increase font size"><span>Increase Font</span></a></li><li id="font-decrease"><a href="" title="Decrease font size" alt="Decrease font size"><span>Decrease Font</span></a></li></ul></div><!--end utility-->');					

	//external link
	$("a.newwindow").click( function() {
        this.target = "_blank";
    });	
	
	clearField(); 	
	
	sfHover();
	
	printPage();
	
	textResize();
	
	/*bookmark();
*/		
});