$.noConflict();
jQuery(document).ready(function($) {

	// Image rollover
	$('img.hover[src], input.hover[src]').live('mouseover mouseout', function(event) {
		var hovimgend = "_on";
		var pattern = /\.(jpg|jpeg|png|gif)$/;
		var imgsrc = $(this).attr("src");
		var extmatch = imgsrc.match(pattern)[0];
		var matches = imgsrc.match(/hovimgend/);

		if (!matches && event.type == 'mouseover') {
			$(this).attr("src", imgsrc.replace(pattern, hovimgend + extmatch));
		}
		else {
			$(this).attr("src", imgsrc.replace(hovimgend + extmatch, extmatch));
		}

		$(window).bind( 'unload', function(){
				$(this).attr("src", imgsrc.replace(hovimgend + extmatch, extmatch));
		});
	});
	
	
	var pathname = window.location.pathname;
	
	var splitpath = pathname.split("/");

	for (var i = 0; i < splitpath.length; i++) {
		if (splitpath[i] == "" || splitpath[i] == "index.html") {         
			splitpath.splice(i, 1);
			i--;
		}
	}

	$('#nav').find('li').each(function(){
		var liHrefPath = "";
		var liHrefPath = $(this).find('a').attr('href');
		
		if(liHrefPath){
			var splitLiHref = liHrefPath.split("/");
			if(splitpath[0] == splitLiHref[1]){
				$(this).addClass('cur');	
			}
		}

	});

	
});
