/*スパム対策*/
<!--
function vspam(im,domain) {
  maddress = "mailto:" + im + "@" + domain;
  window.location.href = maddress;
}
// -->

//

var domain = window.location.hostname;
if(domain == ""){
	domain = "file:///Z:/00_active_client/wan：国際ペットワールド専門学校/1103_サイトリニューアル/40_development/wan-c.jp/";
}else{
	domain = "http://demo1.colletomo.com/wan_prev74610777/";
}

$(function(){
	
	h1Position();
	rollOver();
	pageScroll();
	
	$('#plArea .box').flatHeights();
	$('.entryArea').flatHeights();
	
	
	//gn
	var bodyIdName = $("body").attr('id');
	if(bodyIdName == "feature"){
		$("#g01 img").attr("src",domain + "/common/imgs/shared/gnav_01_on.gif");
	}else if(bodyIdName == "access"){
		$("#h03 img").attr("src",domain + "/common/imgs/shared/hnav_03_on.gif");
	}
	
	$("#hNav ul li.top").hover(function(){
		$("ul:not(:animated)",this).fadeIn("fast");
	},
	function(){
		$("ul",this).fadeOut("fast");
	})


	//
	$("#breadList li:last").addClass("last");
	$("#supportArea li:last").addClass("last");
	$("#plArea .box li:last").addClass("last");
	$("#newsArea dd:last").addClass("last");
	$("#blogArea dd:last").addClass("last");
	
		
	//JC
	function mycarousel_initCallback(carousel){
    	// Disable autoscrolling if the user clicks the prev or next button.
    	carousel.buttonNext.bind('click', function() {
        	carousel.startAuto(0);
    	});

    	carousel.buttonPrev.bind('click', function() {
        	carousel.startAuto(0);
    	});

    	// Pause autoscrolling if the user moves with the cursor over the clip.
    	carousel.clip.hover(function() {
        carousel.stopAuto();
    	}, function() {
        	carousel.startAuto();
    	});
	};
	
	//fb
    $('#fBannerArea').jcarousel({
		scroll:1,							
        auto: 3,
		wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
});


function pageScroll(){
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
   			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
   			if ($target.length) {
  				var targetOffset = $target.offset().top;
  				$('html,body')
  				.animate({scrollTop: targetOffset}, 1000);
    			return false;
			}
		}
 	});
}
	

function rollOver(){
	var postfix = '_on';
	$('ul.over li img, #gNav img, img.over').not('[src*="'+ postfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(
			function() {
				img.attr('src', src_on);
			},
			function() {
				img.attr('src', src);
			}
		);
	});
}

function h1Position(){
	var aaaa = $("#container").height();
	var bbbb = $("#sInfo").height();
	var cccc = $("h1").height();
	
	$("h1").css("top",aaaa - bbbb - cccc + 28);
}

function popupWin(url,wx,wy,wName){
	st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	if(wy == ''){
		wy = screen.height - (screen.height*0.15);
	}
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 30;
	newwin = window.open(url,wName,"left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*以下2010引継ぎ*/

/*ポップアップ
----------------------*/

function therapy(){
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	wx =700;
	wy = screen.height - (screen.height*0.15);
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 30;
	newwin = window.open("therapy.html","newWinTherapy","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

function therapyForm()
{
   newWindow=window.open('https://www.nsg.gr.jp/wan/form_therapy/','newWinTForm','width=640,height=500,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

function reserve()
{
   newWindow=window.open('https://www.nsg.gr.jp/wan/form_seminar/','newWin','width=640,height=500,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

/*2009/11/10追加*/
function reserve_sec()
{
   newWindow=window.open('https://www.nsg.gr.jp/wan/form_seminar_second/','newWin','width=640,height=500,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}



function oc()
{
   newWindow=window.open('https://www.nsg.gr.jp/wan/form/form_seminar.html','newWin','width=640,height=500,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

function require()
{
   newWindow=window.open('https://www.nsg.gr.jp/wan/form/','newWin','width=640,height=500,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}





/*Flv用ポップアップ*/
function mov01()
{
   newWindow=window.open('movie/movie01.html','movWin','width=830,height=610,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

function mov02()
{
   newWindow=window.open('movie/movie02.html','movWin','width=830,height=610,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

function mov03()
{
   newWindow=window.open('movie/movie03.html','movWin','width=830,height=610,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

function mov04()
{
   newWindow=window.open('movie/movie04.html','movWin','width=830,height=610,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}

function mov05()
{
   newWindow=window.open('movie/movie05.html','movWin','width=830,height=610,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}


function tv01()
{
   newWindow=window.open('tv/movie01.html','movWin','width=830,height=710,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
	 newWindow.focus();
}


/*学校説明会サポート*/
function oc_support(){
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	wx =700;
	wy = screen.height - (screen.height*0.15);
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 30;
	newwin = window.open("extra/oc_support.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*ポップアップ*/
function disp(url){ 
window.open(url, "popup", "width=640,height=550,scrollbars=yes");
}


var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


/*popup*/
function noguchiNotHara(url,wx,wy){
	st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	if(wy == ''){
		wy = screen.height - (screen.height*0.15);
	}
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 30;
	newwin = window.open(url,"newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}



/*2010夏イベント
------------------------------*/

/*Flash上からUserAgent変更*/
function getUserAgent() {
	uAgent = "";
	uAgent = navigator.userAgent;
	if((uAgent.indexOf("Safari") != -1)||(uAgent.indexOf("Opera") != -1)){
	uAgent = 1;
	}
	return uAgent;
}


function oc_summer2010(){
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	wx =1000;
	wy = 900;
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 50;
	newwin = window.open("extra/2010summerfes.html","summerWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}
