/*******************************************************************************
*      
*  Web Site  :  http://
*  Author    :  cyclops.co.,ltd. 
*  Modified  :  2006.8.16
*
*******************************************************************************/

/*
 * general.js
 * @requires jQuery v1.2.3
 *
 * Copyright (c) 2009 cyclops.co.,ltd.
 * $Date: 2009.4.16
 *
 */
 
 
/**
 *	Initialization
 */
$(function(){
	$.cyc.init();
});

$(window).load(function () {
	$.cyc.load();
 });

/**
 *	Initialization
 */

$.cyc = {
	init: function() {
		for (module in $.cyc) {
			if ($.cyc[module].init){
				$.cyc[module].init();
			}
		}
	},
	load:function(){
		for (module in $.cyc) {
			if ($.cyc[module].load){
				$.cyc[module].load();
			}
		}
	}
};


/* mailto
*******************************************************************************/
function mail(tgt){
	if(!tgt || tgt=="info"){
		var s=",1)2`)M%5,\'$/N-3",r="";
		for(i=0;i<s.length;i++)r+=String.fromCharCode((s.charCodeAt(i)+28)%93+33);
	}
	eval("location.href=\"mailto:" + r + "\";");
}


/* open new window
*******************************************************************************/
function display(url,w,h) {
	mediumWin = window.open(url, 'display','resizable=1,scrollbars=auto,status=1,toolbar=1,width=' + w + ',height=' + h);
     	mediumWin.focus(); 
}

/* page Scroll To Top
*******************************************************************************/
var scrj = 1;
function toPageTop() {
   if(navigator.appName == "Microsoft Internet Explorer" && document.compatMode == "CSS1Compat")
      var scdist = document.body.parentNode.scrollTop;
   else
      var scdist = document.body.scrollTop;
   if(scrj<50 && scdist) {
      scdist = (scdist>2) ? Math.ceil(scdist*.2) : 1;
      scrj++;
      scrollBy(0,-scdist);
      setTimeout("toPageTop()",20);
   } else {
      scrollTo(0,0);
      scrj = 1;
   }
}

/* popup Viewer
*******************************************************************************/
function popup(url,w,h){
	viewerObj = window.open('../image-view.php?i='+url, 'viewer','resizable=0,scrollbars=0,status=0,toolbar=0,width=' + w + ',height=' + h);

}

/* access report*/
function report(dir){
document.write("<img src='../cgi-bin/access/report.cgi?");
document.write("dir="+dir+"&amp;");
document.write("pix=",screen.width,"x",screen.height,"&amp;");
document.write("ref=",document.referrer);
document.write("' width='1' height='1' alt=''>");
}














/**
 *	thumbnails list height fix
 */
 
 $.cyc.thumbnails = {
 	init:function(){
	 	$("li",".thumbnails").css('height','auto');
	 },
	load:function(){
		//list height even
		$(".thumbnails").each(function(){
			var liSize = 0;
			$('li',this).each(function(){
				var h = $(this).height();
				if(liSize < h) liSize = h;
			}).css('height', (liSize) + 'px');
		});
	}
};

/**
 *	lightbox
 */
$.cyc.lightbox = {
	init:function(){
		$('a[@rel*=lightbox]').lightBox();
	}
};
