jQuery.fn.extend({
	backgroundPositionX: function(){
		var coordinates = $(this).css('backgroundPosition').split(' ');
		var x = coordinates[0];
		return x;
	},
	backgroundPositionY: function(){
		var coordinates = $(this).css('backgroundPosition').split(' ');
		var y = coordinates[1];
		return y;
	},
	backgroundPosition: function(){
		var coordinates = $(this).css('backgroundPosition').split(' ');
		var x = coordinates[0];
		var y = coordinates[1];
		return x + ' ' + y;
	}
});

$(document).ready(function(){
	
	// Setup javascript for rollovers
	$('.RollOver').hover(function(){
		imgsrc = $(this).attr("src");
		ext = imgsrc.match(/(.{3}$)/)[1];
		matches = imgsrc.match(/.over/);
		if(!matches){
			imgsrcON = imgsrc.replace('.' + ext, ".over." + ext);
			$(this).attr("src", imgsrcON);
		}
	}, function(){
		$(this).attr("src", imgsrc);
	})


	$('.Menu').hover(function(){
		if($(this).backgroundPositionY() != '0px') $(this).css('backgroundPosition', $(this).backgroundPositionX() + ' -40px');
	}, function(){
		if($(this).backgroundPositionY() != '0px') $(this).css('backgroundPosition', $(this).backgroundPositionX() + ' -80px');
	});

});


var win = null;
function popup(pagelink,myname,w,h,scroll) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings  ='height='+h+',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='scrollbars='+scroll+',';
		settings +='resizable=yes';		
  win=window.open(pagelink,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}