/**
 * Graphics and Animation
 * Version: 1.0 Auguest 08, 2006
 * Version: 1.1 November 16, 2006
 *
 * @author Siri Chongasamethaworn (goonohc@gmail.com)
 * @version 1.1 November 16, 2006
 */
var Graphics=function(){};Graphics.getClip=function(B,C,A,D){if(document.all){return"rect("+C+","+A+","+D+","+B+")"}return"rect("+C+"px,"+B+"px,"+D+"px,"+A+"px)"};Graphics.changeOpacity=function(H,F,B,D){var A;if(H.nodeType&&H.nodeType==1){A=H.id}else{A=H}if(B&&D){var E=Math.round(D/100);var G=0;if(F>B){for(var C=F;C>=B;C--){setTimeout("Graphics.setOpacity('"+A+"',"+C+")",(G*E));G++}}else{if(F<B){for(var C=F;C<=B;C++){setTimeout("Graphics.setOpacity('"+A+"',"+C+")",(G*E));G++}}}}else{Graphics.setOpacity(H,F)}};Graphics.setOpacity=function(C,B){var A;if(C.nodeType&&C.nodeType==1){A=C}else{A=document.getElementById(C);if(A==null){return }}A.style.opacity=(B/100);A.style.MozOpacity=(B/100);A.style.KhtmlOpacity=(B/100);A.style.filter="alpha(opacity="+B+")"};Graphics.findBackgroundColor=function(B){if(B.style.backgroundColor){return B.style.backgroundColor}var A=B.parentNode;while(A){if(A.style.backgroundColor){return A.style.backgroundColor}A=A.parentNode}return null};Graphics.findX=function(A){var B=0;if(A.offsetParent){while(A.offsetParent){B+=A.offsetLeft;A=A.offsetParent}}else{if(A.x){B+=A.x}}return B};Graphics.findY=function(B){var A=0;if(B.offsetParent){while(B.offsetParent){A+=B.offsetTop;B=B.offsetParent}}else{if(B.y){A+=B.y}}return A};Graphics.findPosition=function(A){return new Point(Graphics.findX(A),Graphics.findY(A))};Graphics.findHeight=function(A){return A.clientHeight==0?A.offsetHeight:A.clientHeight};Graphics.findWidth=function(A){return A.clientWidth==0?A.offsetWidth:A.clientWidth};Graphics.withPixel=function(A){return document.all?A:A+"px"};Graphics.findBodySize=function(){var A;var B;if(self.innerHeight){A=self.innerWidth;B=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){A=document.documentElement.clientWidth;B=document.documentElement.clientHeight}else{A=document.body.clientWidth;B=document.body.clientHeight}}return{width:A,height:B}};var Point=function(A,B){this.x=A;this.y=B;this.toString=function(){return"Point("+this.x+","+this.y+")"}};Graphics.mousePosition=function(C){var B=0;var A=0;if(C.pageX||C.pageY){B=C.pageX;A=C.pageY}else{if(C.clientX||C.clientY){B=C.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;A=C.clientY+document.body.scrollTop+document.documentElement.scrollTop}}return new Point(B,A)};var Dimension=function(A,D,B,C){this.x=A;this.y=D;this.width=B;this.height=C;this.contains=function(E,F){return this.x<=E&&E<=this.x+this.width&&this.y<=F&&F<=this.y+this.height};this.toString=function(){return"Dimension("+this.x+","+this.y+","+this.width+","+this.height+")"}};Graphics.findDimension=function(A){return new Dimension(Graphics.findX(A),Graphics.findY(A),Graphics.findWidth(A),Graphics.findHeight(A))};var SWIPE_SW=1;var SWIPE_S=2;var SWIPE_SE=3;var SWIPE_W=4;var SWIPE_E=6;var SWIPE_NW=7;var SWIPE_N=8;var SWIPE_NE=9;var Content=function(){this.slideSpeed=15;this.slideTimer=5;this.imgShow=Content.imgShow;this.imgHide=Content.imgHide};var resourcesLocation=contextPath?contextPath:"";if(resourcesLocation!=""&&!/\/$/.test(resourcesLocation)){resourcesLocation=resourcesLocation+"/"}Content.imgShow=resourcesLocation+"images/down_triangle.gif";Content.imgHide=resourcesLocation+"images/right_triangle.gif";Content.repeatSlide=function(D,B){var C=document.getElementById(D);if(C!=null){if(C.offsetHeight<C.moveSize){clearTimeout(C.timerId);Graphics.setOpacity(C,0);C.style.display="none";C.inProgress=false}else{if(C.offsetHeight>=C.orgHeight){clearTimeout(C.timerId);Graphics.setOpacity(C,100);C.style.height=C.orgHeight+"px";C.style.overflow=C.orgOverflow;C.inProgress=false}else{var A=0;switch(B){case SWIPE_N:A=C.offsetHeight-C.moveSize;C.fade-=C.fadeSize;if(C.fade<50){Graphics.setOpacity(C,C.fade)}break;case SWIPE_S:A=C.offsetHeight+C.moveSize;C.fade+=C.fadeSize;if(C.fade>50){Graphics.setOpacity(C,C.fade)}break}C.style.height=A+"px";C.timerId=setTimeout('Content.repeatSlide("'+D+'",'+B+");",C.interval)}}}};Content.showHide=function(A,E,C,D){var B=new Content();B.showHide(A,E,C,D)};Content.prototype={showHide:function(A,E,C,D){if(C==null){C=this.slideSpeed}if(D==null){D=this.slideTimer}var B=document.getElementById(E);if(B.inProgress){return }B.inProgress=true;if(B.timerId!=null){clearTimeout(B.timerId)}if(!B.orgHeight){B.orgHeight=B.offsetHeight}B.orgOverflow=B.style.overflow;B.moveSize=Math.round(B.orgHeight/C);B.fadeSize=Math.round(100/C);B.interval=D;B.style.overflow="hidden";if(B.style.display=="none"){B.style.display="block";A.src=this.imgShow;B.style.height=B.moveSize+"px";B.fade=0;B.timerId=setTimeout('Content.repeatSlide("'+E+'",'+SWIPE_S+");",B.interval)}else{A.src=this.imgHide;B.style.height=(B.orgHeight-B.moveSize)+"px";B.fade=100;B.timerId=setTimeout('Content.repeatSlide("'+E+'",'+SWIPE_N+");",B.interval)}}};