// scroller
$(function() {
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var sclpos = 10;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutBack"});
				return false;
			}
		}
	});
});

// smartrollover
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

//blank
$(document).ready( function () {
    $(".blank").append();
    $(".blank img").css();
    $(".blank").after('&nbsp;');
    $('.blank').click(function(){
        window.open(this.href, '_blank');
        return false;
    });
});

//box
$(document).ready(function(){  
    //To switch directions up/down and left/right just place a "-" in front of the top/left attribute  
    //Vertical Sliding  
    $('.boxgrid.slidedown').hover(function(){  
        $(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});  
    }, function() {  
        $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});  
    });  
    //Horizontal Sliding  
    $('.boxgrid.slideright').hover(function(){  
        $(".cover", this).stop().animate({left:'180px'},{queue:false,duration:500});  
    }, function() {  
        $(".cover", this).stop().animate({left:'0px'},{queue:false,duration:500});  
    });  
    //Diagnal Sliding  
    $('.boxgrid.thecombo').hover(function(){  
        $(".cover", this).stop().animate({top:'180px', left:'180px'},{queue:false,duration:500});  
    }, function() {  
        $(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:500});  
    });  
    //Partial Sliding (Only show some of background)  
    $('.boxgrid.peek').hover(function(){  
        $(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});  
    }, function() {  
        $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});  
    });  
    //Full Caption Sliding (Hidden to Visible)  
    $('.boxgrid.captionfull').hover(function(){  
        $(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});  
    }, function() {  
        $(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});  
    });  
    //Caption Sliding (Partially Hidden to Visible)  
    $('.boxgrid.caption').hover(function(){  
        $(".cover", this).stop().animate({top:'170px'},{queue:false,duration:160});  
    }, function() {  
        $(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});  
    });  
});  
