$(document).ready(function(){
	$( '[rel=newpage]' ).attr( 'target', '_blank' );
	$( 'a.anchorSlide' ).anchorSlide();
});
$.fn.anchorSlide = function() {
	return this.each(function(){
		var obj = this;
		$( obj ).click(function ( event ) {	
			event.preventDefault();
			var clicked = $( obj ).attr( 'href' );
			var loc = $( clicked ).offset().top;
			$( 'html,body' ).animate({ scrollTop: loc}, 1000, function() {
				window.location.hash = clicked;
			});
		  	return false;
		});
	});
}
$.fn.coverSlide = function( o, d ) {
	return this.each(function(){
		var obj = this;
		$( obj ).hover(
			function () {
				$(this).find( o ).stop().animate({'top': d}, 'fast');

			},
			function () {	
				$(this).find( o ).stop().animate({'top': 0}, 'fast');
			}
		);
	});
}
function checkFields(m, v, f, t, i, k) {
	var tempValue;
	var missingdata = "";
	for(var n = 0; n < i.length; n++) {
		tempValue = f[i[n]].value;
		if(tempValue != "") {
			if(k[n] != 0) {
				if(k[n] == 'num' && isNaN(tempValue)) {
					missingdata += "\n     -  "+t[n]+' '+v;
				}
			}
		} else {
			missingdata += "\n     -  "+t[n];
		}
	}
	if (missingdata != "") {
		missingdata = m + missingdata;
		alert(missingdata);
		return false;
	} else {
		return true;
	}
}
