/* for testing but won't hurt to leave it here */
/*
if($(location).attr('href').toLowerCase().indexOf('file:///') >= 0 ){
	$('a').attr('href', function() {
   		return this.href + '?v=' + Math.floor(Math.random()*10001);
	});
}
*/
/* end */

/* anchor link scrolling */
jQuery.fn.anchorAnimate = function(settings) {
 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
			/* $(elementClick).closest('p').css({'position' : 'relative'}).append('<span style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #F35A14; z-index: 2; display: block;" class="hilite"></span>');
			$('.hilite').css({opacity: 0.2});
			$('.hilite').delay(1600).fadeOut(); */
			$(elementClick).closest('strong').delay(0).animate({fontSize: '18px'},0).delay(1300).animate({fontSize: '13px'},400);

		  	return false;
		})
	})
}

/* http://www.shadowbox-js.com/usage.html */
Shadowbox.init({
    handleOversize: "drag",
    modal: true,
	overlayOpacity: 0.8
});

jQuery(document).ready(function() { 
/* start jQ */

/* set up and mod the search box */
$('#searchform .box').val('Search').css({'color' : '#7d7d7d'}).click(function(){
	$(this).val('').css({'color' : '#363636'});
});

/* jump links */
$('a[href*=#]').each(function(){
	$(this).addClass('anchorLink');
});
$("a.anchorLink").anchorAnimate();

/* insert form modal */
$('span#iform').html('<a href="businesscredit.html" rel="shadowbox;height=240;width=300">Click here</a> to search now.');

/* newstable zebra stripes */
$('#newstable tr:odd').css({'background' : '#f7f7f7'}).each(function(){
	$('td:eq(0)', this).css({'background' : '#f2f8dc'});
});
$('#newstable tr:even').each(function(){
	$('td:eq(0)', this).css({'background' : '#e8f3bf'});
});
$('#newstable tr').each(function(){
	$('td', this).css({'border' : '1px solid #fff', 'border-bottom' : 0, 'border-left' : 0})
});
$('#newstable tr:eq(0) td:eq(0)').css({'border-top' : 0});


/* end jQ */
});
