$(function(){



	//targetBlank

	$("a.blank").click(function(){

		window.open(this.href);

		return false;

	});



	//scrollUp

	$("a[href^=#]").click(function() {  

		var hash = this.hash;  

		 if(!hash || hash == "#")  

		 return false;  

		$($.browser.safari ? 'body' : 'html')  

		 .animate({scrollTop: $(hash).offset().top}, 500, "swing");  

		 return false;  

	});



	//rollOver

	var rollOver = (function(){

		var preLoad = new Object();

		$('img.rollOver,input.rollOver').not("[src*='_on.']").each(function(){

			var imgSrc = this.src;

			var fType = imgSrc.substring(imgSrc.lastIndexOf('.'));

			var imgName = imgSrc.substr(0, imgSrc.lastIndexOf('.'));

			var imgOver = imgName + '_on' + fType;

			preLoad[this.src] = new Image();

			preLoad[this.src].src = imgOver;

			$(this).hover(

				function (){

					this.src = imgOver;

				},

				function (){

					this.src = imgSrc;

				}

			);

		});

	})();	



	//グローバルナビゲーション

	$("#glNavi li").hover(function(){

		$(this).children("ul").show();

	},function(){

		$(this).children("ul").hide();  

	});



	

	//求人の画像切り替え

	$("div.ulBox > ul > li > a").hover(function(){

		var src = $(this).attr("href");

		$("#jobImage").attr("src",src);

		return false;

	});

	

	//求人の店舗画像切り替え

	$("div.photoSection > ul > li > a").hover(function(){

		var src = $(this).attr("href");

		$("#jobShopImage").attr("src",src);

		return false;

	});



	// 広報各拡張箇所非表示

	$("div.section > div.explain").css("display","none");

	

	// 広報の拡張スライド

	$("div.section > div.btn > img").click(function(){

		var uppath="/shop/media/img/press/up.gif";

		var downpath="/shop/media/img/press/down.gif";

		

		var dis=$(this).parent().prev().css("display");

		if(dis=='block'){

			//$(this).parent().prev().css("display",'none');

			$(this).parent().prev().slideUp("slow");

			$(this).attr("src",uppath);

		}else{

			//$(this).parent().prev().css("display",'block');

			$(this).parent().prev().slideDown("slow");

			$(this).attr("src",downpath);

			

		}

		

	});

	

	// プライベートフォトページング

	$(".albumAjax").click(function(){

		var src = $(this).attr("href");

		$("#photoArea").load(src);

		return false;

	});

	// コレクションページング

	$(".collectionAjax").click(function(){

		var src = $(this).attr("href");

		$("#collectionArea").load(src);

		return false;

	});



	$('#MainView_Area').iiSlider();

	/*

    //ツイッター表示

    $('#twitter dd').twitTicker({

        userName: '',

        numTweets: 5,

        tFmtJp: false

    });

    */



	//Collection
	if($("a.collections")[0]){
		$("a.collections").fancybox({
			'width': 800,
			'height': 600,
			'overlayColor':'#000',
			'autoScale':true,
			'transitionIn':'none',
			'transitionOut':'none',
			'type':'iframe',
			'scrolling':'auto',
			'showCloseButton':true,
			'padding' : 0
		});
	}
	
	//Collection Fonts
	//コレクション詳細フォント調整
	if($("#collectionDetail")[0]){
		if($.os.name=='mac'){
			$('#collectionDetail #prof #model dd').css({'font-size':'18px','left':'48px'});
			$('#collectionDetail #prof #shop dd').css({'font-size':'10px','left':'50px'});
			$('#collectionDetail dl').css({'font-size':'9px'});
			$('#collectionDetail #prof #shop dt').css({'left':'8px'});
			if($.browser.name=='firefox'){
				$('#collectionDetail #prof #model dd').css({'bottom':'26px'});
			}
		}
	}



	if($("a.privatephoto")[0]){

		$("a.privatephoto").fancybox({

			'width'				: 330,

			'height'			: 330,

			'overlayColor' : '#000',

			'autoScale'			: true,

			'transitionIn'		: 'none',

			'transitionOut'		: 'none',

			'type'				: 'iframe',

			'scrolling':'auto',

			'showCloseButton':true,

			'padding' : 0

		});

	}

	

  $("a.lightBox").fancybox({

            'overlayOpacity': 0.7,

            'overlayColor': '#000000',

            'titlePosition': 'inside',

            'speedIn': 600,

            'speedOut': 200,

            'overlayShow': true

  });

  

	//右カラムバースデイ

	$(".bdySection dt a").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});

	$(".bdySection a img").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});

	

	//右カラムNEWLY GIRLS BLOG

	$(".newly .photo .fade").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().parent().css({"background-color":"#DFEFF9"});

        }, function () {

            $(this).parent().parent().parent().css({"background-color":"#FFF"});

        })

	

  	});	

	

	

	if(!$(".ranking")[0]){

	//GIRLS BLOG

	$("#reuse #mainC table td a").each(function () {

		$(this).hover(function () {

            $(this).parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});	

	

	$("#reuse #mainC table td dl span a").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().parent().parent().stop(true, false).fadeTo(100, 0.5);

			$(this).parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().parent().parent().stop(true, false).fadeTo(100, 1.0);

			$(this).parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});

  }

	//ranking

	$("#reuse .ranking table td a").each(function () {

		$(this).hover(function () {

            $(this).parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});	

	

	$("#reuse .ranking table td p a").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});	

	

	$("#reuse .rankTableA td a").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});	

	

	$("#reuse .rankTableA td p a").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});		

	$("#reuse .rankTable td.photoTd a.fadeImg").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});	

	

	$("#reuse .rankTable td p.name a.fadeName").each(function () {

		$(this).hover(function () {

            $(this).parent().parent().parent().parent().parent().stop(true, false).fadeTo(100, 0.5);

        }, function () {

            $(this).parent().parent().parent().parent().parent().stop(true, false).fadeTo(100, 1.0);

        })

	

  	});			

	

	

});



function tabChange(flag) {

	if(flag==1){

		jQuery("#section01").css("display","none");	

		jQuery("#section02").css("display","block");	

	}else{

		jQuery("#section01").css("display","block");	

		jQuery("#section02").css("display","none");	

	}

}



function ck(src) {

	document.getElementById("bigPhoto").src=src;

}



function clearFormAll() {

    for (var i=0; i<document.forms.length; ++i) {

        clearForm(document.forms[i]);

    }

}

function clearForm(form) {

    for(var i=0; i<form.elements.length; ++i) {

        clearElement(form.elements[i]);

    }

}

function clearElement(element) {

    switch(element.type) {

        case "hidden":

        case "submit":

        case "reset":

        case "button":

        case "image":

            return;

        case "file":

            return;

        case "text":

        case "password":

        case "textarea":

            element.value = "";

            return;

        case "checkbox":

        case "radio":

            element.checked = false;

            return;

        case "select-one":

        case "select-multiple":

            element.selectedIndex = 0;

            return;

        default:

    }

}


function checkCookie() {
    if(jQuery('input[name=auto_login]:checked').val() != 1) {
        return true;
    }
    tmp = "cookiecheck="+escape('true')+"; ";
    document.cookie = tmp;
    cookiecheck = getCookie("cookiecheck");
    tmp = "cookiecheck="+escape('')+"; ";
    document.cookie = tmp;
    if ( cookiecheck == "true" ) {
       return true;
    } else {
       alert('自動ログインをご利用頂く際はCookieを有効にして下さい。');
       return false;
    }
}

function getCookie( key, tmp1, tmp2, xx1, xx2, xx3 )
{
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) 
    {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) 
        {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}
