$(document).ready(function() {
	mainRoll();
});

window.mainRoll = function() {
	$.getScript("/js/mainRoll.js",function() {
	var cnt = main_img.length;
	$("#main_spot").append( $("<img>").attr("src",main_img[0]).bind("click",function(){
		document.location.href= main_url[0];
	}));
	var ULS = $("<ul>");
	var main_cnts = '';
	var inum;
	for(a=0; a<cnt; a++) {
		main_cnts = $("<li>").append($("<a>").text(a+1)
			.bind("mouseover",function(){ 
				inum=$(this).text()-1;
				$("#main_spot").find("img").attr("src", main_img[inum]).click(function(){
				document.location.href= main_url[inum];
				}); 
			})
			.bind("click",function(){ 
				inum=$(this).text()-1;
				document.location.href= main_url[inum]; 
			})
		);
		$(ULS).append(main_cnts);
	}
	$("#main_spot").append(ULS);
	});
}


window.newbbs = function(mode){
	if(mode == 'bbs') {
		$("#new_comment").hide();
		$("#new_post").show();
		$("#new_bbs").addClass("sele");
		$("#new_reple").removeClass("sele");
	} else {
		$("#new_post").hide();
		$("#new_comment").show();
		$("#new_bbs").removeClass("sele");
		$("#new_reple").addClass("sele");
	}
}

var m = new Array(0,0,0);
var pg = new Array();
window.photos = function(gal,arrow) {
	if(arrow == 'prev') {
		if(m[gal] < 0) {
			m[gal] = m[gal]+440;
			ms = m[gal]+'px';
			pg[gal]++;
			$(".gal"+gal).animate( { left : ms } , 300 );
		}
	}  else {
		if(m[gal] >  -1300) {
			m[gal] = m[gal]-440;
			ms = m[gal]+'px';
			pg[gal]--;
			$(".gal"+gal).animate( { left : ms } , 300 );
		}
	}
}
