/****************************************
| ** Global.js
|
| Created by: Rob Hayward
| Date Created: 2008-18-06
| Copyright 2008 Lightmaker Manchester
|
****************************************/
jQuery.noConflict();
var $j = jQuery;
var isIE6 = false; var isIE7 = false; var isSafari = false; appPath = '';
$j(document).ready(function() {
	/* Browser Detection: IE6/IE7/IE8/Safari apply bug fixes */
	if( ($j.browser.msie) && (parseInt($j.browser.version) == "6" )) { isIE6 = true; try { document.execCommand('BackgroundImageCache', false, true); } catch(e) { } }
	if( ($j.browser.msie) && (parseInt($j.browser.version) == "7" )) { isIE7 = true; }
	if( ($j.browser.msie) && (parseInt($j.browser.version) == "8" )) { isIE8 = true; }
	/* Browser Detection: Safari */
	if($j.browser.safari) { isSafari = true; }
	//Hide required elements
	$j('.hide').hide();
	//load and eval additional scripts ** TEST IN SAFARI 2+ **
	//Run global functionality
	inputValueReplace();
	textResize();
});
function inputValueReplace() {
  $j('input.value-replace').each(function() { var o = new valueReplace($j(this)); });
	function valueReplace(e) {
		var o = {
		  init : function() {
				o.field = $j(e); 
				o.isSet = false;
				o.defaultValue = o.field.val();
				o.isPasswordCheck();
				o.monitor();
			},
			isPasswordCheck : function(){
				if(o.field.hasClass('value-replace-password') == true) { o.isPassword = true; }
				else { o.isPassword = false; }
			},
			monitor : function() {
				o.field.focus(function(){
					if( $j(this)[0].value == o.defaultValue) { $j(this)[0].value = ''; }
					if ( o.isPassword ) { $j(this)[0].type = 'password'; }
				});
				o.field.blur(function(){
					if($j(this)[0].value == '') { 
						$j(this)[0].value = o.defaultValue;
						if ( o.isPassword ) { $j(this)[0].type = 'text'; }
					}
				});
			}
		}
		o.init();
		return o;
	}
}
function textResize(){
	$j('#TextResize ul li a').hover(
		function(){
			$j(this).css({cursor: 'pointer'});
		},
		function(){
			$j(this).css({cursor: 'default'});
		}
	);
	$j('#FontSize1').click(function(){
		$j('#Container').css({fontSize: '100%'});
	});
	$j('#FontSize2').click(function(){
		$j('#Container').css({fontSize: '120%'});
	});
	$j('#FontSize3').click(function(){
		$j('#Container').css({fontSize: '140%'});
	});
}
