// $Id$

// OPEN NEW WINDOW

var win = null;

function NewWindow(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=yes';
	win = window.open(mypage,myname,settings);
}

function NewWindowToolbar(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=no,status=yes,menubar=yes,toolbar=yes,resizable=yes';
	win = window.open(mypage,myname,settings);
}

$(window).load(function()
{
	// add css class to last child item of header menu
	$("ul.menu li ul li:last-child").addClass("last");
	$("ul li.last").hover(function()
	{
		$("li:first-child a",this).css("border-bottom", "solid 1px black");
	});
	// add css class to inputs as required
	$(":text, :password").addClass("text");
	// add hover class to buttons (for IE6 etc)
	$("button").hover(function()
	{
		$(this).addClass("buttonHover");
	},
	function()
	{
		$(this).removeClass("buttonHover");
	});
	// open rel external links in a new window
	$("a[rel=external]").attr("target","_blank");
	// LiveChat link 
	$('a#osLiveChat').click(function()
	{
		var osHTTPprotocol = (("https:" == document.location.protocol) ? "https://" : "http://");
		var osLiveChatURL = osHTTPprotocol + "server.iad.liveperson.net/hc/78022045/?cmd=file&amp;file=visitorWantsToChat&amp;site=78022045&amp;byhref=1&amp;imageUrl=" + osHTTPprotocol + "www.outsourcery.co.uk/assets/images/liveperson";
		NewWindow(osLiveChatURL,'LiveChat','472','320','yes');
		return false;
	});
});