/*=========================================================


	Site Name   Sellenatela
	File Name   function.js

	Create Date 2008/09/27
	Update Date 2008/09/27


==========================================================*/

/*========================================================*/
/*                                                        */
/*                                                        */
/*		1. Fullscreen Function                    */
/*                                                        */
/*		2. Pop Up Window Function                 */
/*                                                        */
/*		3. RollOver Images Function*              */
/*                                                        */
/*		4. Fade Effect 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").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).stop().fadeTo(100, 0.5);},
		function(){$(this).stop().fadeTo(100, 1);}
	);
})