//***********************************************************************************************************************************/
//	LyteBox v3.20 modification
//
//	 Author: Markus F. Hay
//  Website: http://www.dolem.com/lytebox
//  Website: http://pavel.kuzub.com/lytebox
//	   Date: October 2, 2007
//	License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
//				* Firefox: 2.0.0.7, 1.5.0.12
//				* Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
//				* Opera: 9.23
//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
//			 information please visit http://huddletogether.com/projects/lightbox2/
//***********************************************************************************************************************************/
function LyteBox() {
	/*** Start Global Configuration ***/
		this.theme				= 'grey';	// themes: grey (default), red, green, blue, gold
		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden
		this.outerBorder		= false;	// controls whether to show the outer grey (or theme) border
		this.resizeSpeed		= 10;		// controls the speed of the image resizing (1=slowest and 10=fastest)
		this.maxOpacity			= 50;		// higher opacity = darker overlay, lower opacity = lighter overlay
		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions
		// 2007-10 coyaba, extended adnimation + fade in/out options
		this.doAnimations		= true;		// controls whether or not to "animate" Lytebox, i.e. resize transition between images, etc.
		this.doFade				= true;		// controls whether or not to use fade in/out effects
		this.doDetailAnimations	= false;	// controls whether or not to use animations for details area
		this.doInfoFade			= true;		// controls whether or not to use fade in/out effects for info overlay
		this.infoMaxOpacity		= 60;		// opacity for info overlay
		this.borderSize			= 12;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
	/*** End Global Configuration ***/

	/*** Configure Slideshow Options ***/
		this.slideInterval		= 5000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide
		this.showClose			= true;		// true to display the Close button, false to hide
		this.showDetails		= true;		// true to display image details (caption, count), false to hide
		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide
		this.pauseOnNextClick	= true;		// true to pause the slideshow when the "Next" button is clicked
		this.pauseOnPrevClick 	= true;		// true to pause the slideshow when the "Prev" button is clicked
		// 2007-10 coyaba, extended slideshow options
		this.slideAutoStart		= 0;		// 0 = always paused, 1 = autostart only on first frame, 2 = autostart always
		this.slideAutoEnd		= false;	// true to automatically close Lytebox after the last image is reached, false to keep open
		this.slideLoop			= true;		// true to continue on first image after the last image is reached
	/*** End Slideshow Configuration ***/

	/*** Start Addon Configuration ***/
		this.easySave			= true;		// true to enable Easy Save (To save image - right click and select Save Target As/Save Link As)
		this.clickToClose		= true;		// true to exit Lytebox when clicking on image (if Navigation buttons are not overlapping). navType=1 only.
		this.C2CrightSided		= true;		// true to use right side style close area on groups with single image
		this.showCloseInFrame	= true;		// true to display the Close button in frame mode despite it is swinched off globaly, false to hide.
		this.showHints			= true;		// true to display Hint messages over the buttons. Good to inform user about shortcuts
		this.showSave			= false;	// true to display Save button next to close button, false to hide
		this.showResize			= false;	// true to display Resize button next to close button, false to hide
		this.showInfo			= false;	// true to display info button next to close button, false to hide. Searches Special Parameter for [info]Additional text[/info]
											// 2007-10 coyaba:
											// if true then the new info overlay is deactivated
											// if false an available info will be displayed as overlay in the lower left corner of the image
		this.showExif			= true;		// true to display exif button next to close button, false to hide. Searches Special Parameter for [exif=true]
		// 2007-10 coyaba, geo support
		this.showGeo			= true;		// true to display geo button next to close button, false to hide. Searches Special Parameter for [geo=true]
		this.showBack			= true;		// true to display back button next to close button, false to hide
		// 2007-10 coyaba, easier hotkey assignment
		this.hotkeyResize		= 'r';// 리사이즈
		this.hotkeyInfo			= 'i';// 정보
		this.hotkeyExif			= 'e';// EIF
		this.hotkeyGeo			= 'g';// 구글맵
		this.hotkeyPrevious		= 'z';// 이전
		this.hotkeyNext			= 'w';// 다음
		this.hotkeyClose		= 'b';// 닫기
	/*** End Addon Configuration ***/

	/*** Start Tag Configuration ***/
		this.tagBox				= 'lytebox';	// Catch the following name in Anchor REV parameter for LyteBox
		this.tagShow			= 'lyteshow';	// Catch the following name in Anchor REV parameter for LyteShow
		this.tagFrame			= 'lyteframe';	// Catch the following name in Anchor REV parameter for LyteFrame
	/*** Start Tag Configuration ***/

	/*** Configure Info, Exif and Geo Configuration ***/
		this.specialParam		= 'rev';				// says to Lytebox, which parameter use to get Info and Exif data
		this.linkInfo			= AB_ROOT_DIR +'tools/lytebox_info.php?info=%1&file=%2';	// This link will be openned in Lyteframe, information string will be added at the end
		this.linkExif			= AB_ROOT_DIR +'tools/pel_exif.php?filename=';
		// 2007-10 coyaba, geo support
		this.linkGeo			= AB_ROOT_DIR +'tools/geoImg.php?filename=';
		this.LyteframeStyle		= 'width: 400px; height: 400px; scrolling: auto';	// Default style of Lyteframe (Not really style, but form for sure)
		this.TempFrameStyle		= 'width: 572px; height: 424px; scrolling: auto';	// Default style of Temp Frame to show Info and Exif (Same here)
	/*** End Info, Exif and Geo Configuration ***/

	/*** Start String Configuration ***/
		this.hintClose			= "닫기 (단축키: X, C)";	// Shortcut: 'Escape' or 'X' or 'C'
		this.hintPlay			= "슬라이드쇼 계속";
		this.hintPause			= "슬라이드쇼 멈춤";
		this.hintNext			= "다음 이미지 (단축키: →, N) \n";	// Shortcut: 'Right Arrow' or 'N'
		this.hintPrev			= "이전 이미지 (단축키: ←, P) \n";	// Shortcut: 'Left Arrow' or 'P'
		this.hintSave			= "현재 이미지를 저장하려며 이 버튼을 누르세요.";
		this.hintResize			= "이 이미지를 브라우저 크기가 맞게 줄여주거나, 원래 크기로 돌아갈 수 있습니다. (단축키: R, S)";		// Shortcut: 'R' or 'S'
		this.hintInfo			= "현재 이미지에 대한 추가정보 보기 (단축키: i)";	// Shortcut: 'i'
		this.hintExif			= "현재 이미지의 EXIF 정보 보기 (단축키: E)";	// Shortcut: 'E'
		this.hintBack			= "돌아가기 (단축키: ←, P)";	// Shortcut: 'Left Arrow' or 'P'
		this.hintEasySave		= "현재 이미지를 저장하려면 마우스 오른쪽 클릭후 '다른 이름으로 대상 저장'을 누르세요.";
		this.hintClickToClose	= "클릭하면 이미지를 닫습니다. \n";
		this.textImageNum		= "이미지 %1 / %2"; // %1 - current, %2 - total
		this.textPageNum		= "페이지 %1 / %2";	// %1 - current, %2 - total
		this.textNavPrev		= "&laquo; 이전";	// &laquo; prev
		this.textNavNext		= "다음 &raquo;";	// next &raquo;
		this.textNavDelim		= "||";	// Separates Prev and Next
	/*** End String Configuration ***/

	if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
	if(this.resizeSpeed < 1) { resizeSpeed = 1; }
	this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
	this.resizeWTimerArray		= new Array();
	this.resizeWTimerCount		= 0;
	this.resizeHTimerArray		= new Array();
	this.resizeHTimerCount		= 0;
	this.showContentTimerArray	= new Array();
	this.showContentTimerCount	= 0;
	this.overlayTimerArray		= new Array();
	this.overlayTimerCount		= 0;
	this.imageTimerArray		= new Array();
	this.imageTimerCount		= 0;
	// 2007-10 coyaba, fade in/out for info box
	this.infoTimerArray			= new Array();
	this.infoTimerCount			= 0;
	this.timerIDArray			= new Array();
	this.timerIDCount			= 0;
	this.slideshowIDArray		= new Array();
	this.slideshowIDCount		= 0;
	this.imageArray	 = new Array();
	this.activeImage = null;
	this.frameArray	 = new Array();
	this.activeFrame = null;
	this.checkFrame();
	this.isSlideshow = false;
	this.isLyteframe = false;
	this.isShowTempFrame = false;
	this.TempFrame = new Array();
	// 2007-11 coyaba, for vertically centered tempFrame display
	this.lastMainTop = 0;
	this.HasInfo = false;
	this.HasExif = false;
	// 2007-10 coyaba, geo support
	this.HasGeo = false;
	// 2007-10 coyaba, for storage of scroll position
	this.yPos = 0;
	// 2007-11 coyaba, save dimensions of blank lytebox
	this.startWidth = 0;
	this.startHeight = 0;
	/*@cc_on
		/*@if (@_jscript)
			this.ie = (document.all && !window.opera) ? true : false;
		/*@else @*/
			this.ie = false;
		/*@end
	@*/
	this.ie7 = (this.ie && window.XMLHttpRequest);
	this.classAttribute = this.ie ? 'className' : 'class';
	this.initialize();
};
var myLytebox=null;

//	초기화 함수 (공통)
function ActiveBox_initLibrary() {
	if(ABinf==true) {//	프레임을 사용하지 않거나, 사용할 경우 프레임 안에 있을 경우에만
		myLytebox=new LyteBox()
	}
}




/*-------------------------------------*
**	TAG INITIALIZE FUNCTION
**	for Lightbox 2
**-------------------------------------*/
//	A = <A> object , B = <IMG> object , c = Caption(.title or .alt attribute)
function ActiveBox_addAttributesToAnchor_Html(A,B,c) {
	A.title=c;
	A.rel='lyteframe['+ ((ABgid[1]=='comment')?ABgid[0]:ABgid[1]) +']';
	A.rev='width:'+ ABpW +'px; height:'+ ABpH +'px; scrolling:auto;';
}

function ActiveBox_modifyAttributesToAchor_Img(A,B,c) {
	A.title=c;
	A.rel='lytebox['+ ((ABgid[1]=='comment')?ABgid[0]:ABgid[1]) +']';

	var rev='';
	if (B.lb_info) rev+= '[info]'+ B.lb_info +'[/info]';
	if (B.lb_infoa) rev+= '[onLoadInfo='+ (B.lb_infoa=='Y'?'true':'false') +']';
	if (B.lb_infob=='Y') rev+= '[noTitleInfo='+ (B.lb_infob=='Y'?'true':'false') +']';
	if (B.lb_exif) rev+= '[exif='+ (B.lb_exif=='Y'?'true':'false') +']';
	if (B.lb_geo) rev+= '[geo='+ (B.lb_geo=='Y'?'true':'false') +']';
	if (rev.length>0) A.rev=rev;
}

function ActiveBox_addAttributesToAchor_Img(A,B,c) {
	A.href=B.src;

	ActiveBox_modifyAttributesToAchor_Img(A,B,c);
}
