function extWin (url, title, w, h) {
	if ((url != "") && (title != "")) {
		if ((w == 0) && (h == 0)) {
			window.open(url, title);
		} else {
			window.open(url, title, "width=" + w + ", height=" + h + ", scrollbars=yes, resizable=yes");
		}
	}
	return false;
}

$(document).ready(function(){
	$("a[rel='external']").click(function(){
		if ($(this).attr("href") != "") {
			if ((! $(this).attr("id")) && ($(this).attr("id") != "")) {
				window.open($(this).attr("href"), $(this).attr("id"));
			} else {
				window.open($(this).attr("href"));
			}
		}
		return false;
	});
});


function openWin(file,w,h){
	window.open(file,"","width=" + w + ",height=" + h + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes");
}

function setidxtab() {
	var current = "#idxnew";
	var currentbox = "#idxnewbox";
	$(".idxmenu li").click(function(){
		var tmp = "#" + $(this).attr("id");
		var tmpbox = "#" + $(this).attr("id") + "box";
		if(tmpbox != currentbox){
			$("#" + $(this).attr("id")).css("backgroundPositionY","-27px");
			$(current).css("backgroundPositionY","0px");
			$(currentbox).hide();
			$(tmpbox).slideDown("fast");
			current = tmp;
			currentbox = tmpbox;
		}
	});
}


function setrandomimg() {
	var s = (new Date()).getSeconds();
	
	if(navigator.userAgent.match("MSIE 6")){
		if(s%2 == 0){
			$(".idxheaderarea").css("backgroundImage","url('imgs/index/mainbkg2.gif')")
		} else {
			$(".idxheaderarea").css("backgroundImage","url('imgs/index/mainbkg1.gif')")
		}
	} else {
		if(s%2 == 0){
			$(".idxheaderarea").css("backgroundImage","url('imgs/index/mainbkg2.png')")
		} else {
			$(".idxheaderarea").css("backgroundImage","url('imgs/index/mainbkg1.png')")
		}
	}
	
	
}



function setPhotoViewer(){
	var current = "001";
	$(".detailthumb img").css("opacity","0.5");
	$("#" + current).css("opacity","1");
	
	$(".detailthumb img").mouseover(function(){
		$(this).css("opacity","1");
	});
	$(".detailthumb img").mouseout(function(){
		if($(this).attr("id") != current){
			$(this).css("opacity","0.5");
		}
	});
	$(".detailthumb img").click(function(){
		$("#" + current).css("opacity","0.5");
		var thissrc = $(this).attr("src");
		thissrc = thissrc.substr(0,thissrc.indexOf("th"));
		thissrc += ".jpg";
		$("#mainphoto").hide().attr("src",thissrc).fadeIn("fast");
		$(this).css("opacity","1");
		current = $(this).attr("id");
	});
}
