$(function(){

	$('a[rel=window]').live("click",function(){
		var url = $(this).attr("href");
		window.open(url,'','');

		return false;
	});

	$('a[rel=costume]').live("click",function(){
		var url = $(this).attr("href");
		window.open(url,'','width=840,height=450,scrollbars=yes,statusbars=no');
		return false;
	});

	$('a[rel=lightbox]').lightBox({
		overlayBgColor: '#333',
		overlayOpacity: 0.7,
		imageLoading: '/img/lightbox-ico-loading.gif',
		imageBtnClose: '/img/lightbox-btn-close.gif',
		imageBtnPrev: '/img/lightbox-btn-prev.gif',
		imageBtnNext: '/img/lightbox-btn-next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Image',
		containerBorderSize: '10',
		txtOf: 'of'
	});


	$("#otherText").hide();
	$("select[rel=domain]").change(function(){
		if($(this).val() == "other"){
			$("#otherText").show();
		}else{
			$("#otherText").hide();
		}
		
	});

	$("img[rel=swapImage],input[rel=swapImage]").hover(
		function () {
 		var imgUrl = $(this).attr("src");
			var ofterImgUrl = imgUrl.match(/(.*)\.jpg/);
			$(this).attr("src",ofterImgUrl[1]+"_on.jpg");
		},
		function () {
 		var imgUrl = $(this).attr("src");
			var ofterImgUrl = imgUrl.match(/(.*)_on\.jpg/);
			$(this).attr("src",ofterImgUrl[1]+".jpg");
		}
	);

	$("img[rel=openIconWindow],a[rel=openIconWindow]").click(function () {
		$("#iconWindow").fadeIn("slow");
	});

	$(".closeIconWindow").click(function () {
		$("#iconWindow").fadeOut("slow");
	});

	$(".closeIconWindow").hover(function(){
		$(this).css("cursor","pointer"); 
	},function(){
		$(this).css("cursor","default"); 
	});

	$("#iconWindow").draggable();

	$("#iconWindow").hover(function(){
		$(this).css("cursor","move"); 
	},function(){
		$(this).css("cursor","default"); 
	});
});

