/*=========================================================





	Site Name   HONDA STREAM

	File Name   function.js



	Create Date 2009/06/05

	Update Date 2008/06/05





==========================================================*/



/*========================================================*/

/*                                                        */

/*                                                        */

/*		1. Fullscreen Function                    */

/*                                                        */

/*		2. Pop Up Window Function                 */

/*                                                        */

/*		3. RollOver Images Function*              */

/*                                                        */

/*		4. Fade Effect Function*                  */

/*                                                        */

/*		5. Smooth Scroll Function*                */

/*                                                        */

/*		6. Add Pseudo Class Function*             */

/*                                                        */

/*		* Require jquery.js                       */

/*                                                        */

/*                                                        */

/*========================================================*/



/*----------------------------------------------------------



	1. Fullscreen Function



-----------------------------------------------------------*/



function getFullscreen(thePage){

	var winWidth = screen.availWidth;

	var winHeight = screen.availHeight;

	window.open(thePage,"title","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=0,top=0,width="+winWidth+",height="+winHeight);

}



/*----------------------------------------------------------



	2. Pop Up Window Function



-----------------------------------------------------------*/



function openBrWindow(url, name, myW, myH, scrollAndResize) {

	posX = (screen.availWidth - myW) / 2;

	posY = (screen.availHeight - myH) / 2;

	newWin = window.open(url, name, "left="+posX+", top="+posY+",width="+myW+", height="+myH+", scrollbars="+scrollAndResize+", resizable="+scrollAndResize);

}



/*----------------------------------------------------------



	3. RollOver Images Function (require jquery.js)



-----------------------------------------------------------*/



$(function(){

	var image_cache = new Object();



	$("img.btn, input.btn").each(function(i){

		var imgsrc = this.src;

		var dot = this.src.lastIndexOf(".");

		var imgsrc_on = this.src.substr(0, dot) + "_o" + 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;}

		);



	});

})



/*----------------------------------------------------------



	4. Fade Effect Function (require jquery.js)



-----------------------------------------------------------*/



$(function(){

	$("img.fadeImg").hover(

		function(){$(this).dequeue().fadeTo(300, 0);},

		function(){$(this).dequeue().fadeTo(300, 1);}

	);

	$("img.fadeImgEx, img.fadeImg2").hover(

		function(){$(this).dequeue().fadeTo(300, 0.5);},

		function(){$(this).dequeue().fadeTo(300, 1);}

	);

});



/*----------------------------------------------------------



	5. Smooth Scroll Function (require jquery.js && jquery_easing.js)



-----------------------------------------------------------*/



$(function() {

	$("a.pageLink").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 = 0;

				var scldurat = 1000;

				var targetOffset = target.offset().top - sclpos;

				$("html,body")

					.animate({scrollTop:targetOffset},{duration:scldurat,easing:"easeOutExpo"});

				return false;

			}

		}

	});

});



/*----------------------------------------------------------



	6. Add Pseudo Class Function (require jquery.js)



-----------------------------------------------------------*/



$(function(){

	$(':first-child').addClass('firstChild');

	$(':last-child').addClass('lastChild');

})
