// JavaScript Document

//Target_Blank
$(function(){
     $("a[href^='http://']").attr("target","_blank");
});


//RollOver
function initRollOverImages() {
  var image_cache = new Object();
  $(".swap").each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_on;
    $(this).hover(
      function() { this.src = imgsrc_on; },
      function() { this.src = imgsrc; });
  });
}

$(document).ready(initRollOverImages);


//form 

function btnConform(){
	var inputs = document.getElementsByTagName("input");
	for( var i=0,j=inputs.length; i<j; i++){
		var btn = inputs[i]; 
		if(btn.getAttribute("class") == "input_btn"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = 'left -20px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = 'left top';
				return false;
			}
		}
		if(btn.getAttribute("className") == "input_btn"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = 'left -20px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = 'left top';
				return false;
			}
		}

		if(btn.getAttribute("class") == "input_btn02"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = 'left -41px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = 'left top';
				return false;
			}
		}
		if(btn.getAttribute("className") == "input_btn02"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = 'left -41px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = 'left top';
				return false;
			}
		}

	}
}

window.onload = btnConform;

//nav

$(function(){
	
	$('.nav').flashyNav({
		rolloverColor: '#000',	//the default color of the rollover element
		rolloverDuration: 500,	//the default duration for the rollover
		easingMethod: 'easeInOutQuint'	//easing method used for animation
	});	
});

//scroll

$(function() {
	$('ul.nav a, ul.btn a, ul.wbtn a, ul.works_nav a').bind('click',function(event){
		var $anchor = $(this);
		$('html, body').stop().animate({
			scrollLeft: $($anchor.attr('href')).offset().left-222+"px"
		}, 1000);
		event.preventDefault();
	});
});

//

