$(function(){
	$("#gNav ul").droppy();
})


/**********************************************************
pageScroll
--------
ページをスムーズにスクロール（ href属性値が#で始まるものが対象 ）
@param / @return
**********************************************************/
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}, 500);
				return false;
			}
		}
	});
}


/**********************************************************
実行処理
**********************************************************/
$(document).ready(pageScroll);






/*ホスト名によるパスの設定*/
hostname_w = window.location.hostname;
if (hostname_w == "demo1.colletomo.com"){ //プレビューサーバー
	from_rootpath = "/ndg2010_prev484533";
}else if (hostname_w == ""){
	from_rootpath = "/制作データ/yamano-bc.jp（山野美容専門学校）/最新public_htmlファイル/public_html";
}else{ //本番サーバー
	from_rootpath = "";
}


/*汎用ポップアップ*/
function popWin(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(from_rootpath + url,"newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}




/*OBOG学園祭告知ポップ*/
function festaObOg() { 
	wx = 500;
	wy = 750;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open("extra/festa_info_obog.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*シブヤプロダクツポップ*/
function shibuyaWin(directory) { 
	wx = 860;
	wy = 750;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open(directory + "shibuyaproducts/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

function shibuya02Win(directory) { 
	wx = 860;
	wy = 750;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open(directory + "../shibuyaproducts/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*オリコポップアップ*/
function oricoWin(directory) { 
	wx = 680;
	wy = 700;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open(directory + "orico.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*卒業作品展ポップ*/
function exhibitionWin(directory) { 
	wx = 900;
	wy = 800;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open("http://www.ndg.ac.jp/exhibition.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*イラストレーターズポップ*/
function illustratorsWin(directory) { 
	wx = 1050;
	wy = 600;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open(from_rootpath + "/illustrators/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*オープンキャンパス*/
function openWin() { 
	wx = 920;
	wy = 600;
	x = (screen.width  - wx) / 2;
	y = (screen.height - wy) / 2;
	st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	newwin = window.open(from_rootpath + "/oc/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}



/*swf内から呼び出し*/
function disp(url){
	if(!window.opener || window.opener.closed){ // メインウィンドウの存在をチェック
		location.href=url;
	}
	else{
	window.opener.location.href = url;
	window.close();
	}
}
