
var c_menu		= new Array();
var c_menu_on	= new Array();
var c_menu_off	= new Array();
c_menu_off[1]	= 'img/snb/btn_company.gif';
c_menu_off[2]	= 'img/snb/btn_artists.gif';
c_menu_off[3]	= 'img/snb/btn_audition.gif';
c_menu_off[4]	= 'img/snb/btn_pr.gif';

c_menu_on[1]	= 'img/snb/btn_company_on.gif';
c_menu_on[2]	= 'img/snb/btn_artists_on.gif';
c_menu_on[3]	= 'img/snb/btn_audition_on.gif';
c_menu_on[4]	= 'img/snb/btn_pr_on.gif';

c_menu[1]	= 'img/snb/btn_company.gif';
c_menu[2]	= 'img/snb/btn_artists.gif';
c_menu[3]	= 'img/snb/btn_audition.gif';
c_menu[4]	= 'img/snb/btn_pr.gif';


var yooneunhye = false;
var SiteSelectDone = false;

var menu_1_src	= 'img/bt_m1_off.png';
var menu_2_src	= 'img/bt_m2_off.png';
var menu_3_src	= 'img/bt_m3_off.png';
var menu_4_src	= 'img/bt_m4_off.png';
var menu_5_src	= 'img/bt_m5_off.png';
var menu_6_src	= 'img/bt_m6_off.png';
var menu_7_src	= 'img/bt_m7_off.png';

var menu_1_src_out	= 'img/bt_m1_off.png';
var menu_2_src_out	= 'img/bt_m2_off.png';
var menu_3_src_out	= 'img/bt_m3_off.png';
var menu_4_src_out	= 'img/bt_m4_off.png';
var menu_5_src_out	= 'img/bt_m5_off.png';
var menu_6_src_out	= 'img/bt_m6_off.png';
var menu_7_src_out	= 'img/bt_m7_off.png';

var menu_1_src_off	= 'img/bt_m1_off.png';
var menu_2_src_off	= 'img/bt_m2_off.png';
var menu_3_src_off	= 'img/bt_m3_off.png';
var menu_4_src_off	= 'img/bt_m4_off.png';
var menu_5_src_off	= 'img/bt_m5_off.png';
var menu_6_src_off	= 'img/bt_m6_off.png';
var menu_7_src_off	= 'img/bt_m7_off.png';

var menu_1_src_sel	= 'img/bt_m1_sel.png';
var menu_2_src_sel	= 'img/bt_m2_sel.png';
var menu_3_src_sel	= 'img/bt_m3_sel.png';
var menu_4_src_sel	= 'img/bt_m4_sel.png';
var menu_5_src_sel	= 'img/bt_m5_sel.png';
var menu_6_src_sel	= 'img/bt_m6_sel.png';
var menu_7_src_sel	= 'img/bt_m7_sel.png';

var menu_1_src_on	= 'img/bt_m1_on.png';
var menu_2_src_on	= 'img/bt_m2_on.png';
var menu_3_src_on	= 'img/bt_m3_on.png';
var menu_4_src_on	= 'img/bt_m4_on.png';
var menu_5_src_on	= 'img/bt_m5_on.png';
var menu_6_src_on	= 'img/bt_m6_on.png';
var menu_7_src_on	= 'img/bt_m7_on.png';

var menu_1_src_on_sel	= 'img/bt_m1_on_sel.png';
var menu_2_src_on_sel	= 'img/bt_m2_on_sel.png';
var menu_3_src_on_sel	= 'img/bt_m3_on_sel.png';
var menu_4_src_on_sel	= 'img/bt_m4_on_sel.png';
var menu_5_src_on_sel	= 'img/bt_m5_on_sel.png';
var menu_6_src_on_sel	= 'img/bt_m6_on_sel.png';
var menu_7_src_on_sel	= 'img/bt_m7_on_sel.png';


/**************************************
	이미지 롤오버 스크립트
***************************************/
function MM_swapImobjstore() { //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_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_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];}
}


function email_chk() {
	var f	= eval("document.FRM");

	if(!f.TITLE.value) {
		alert("제목을 입력하여 주십시오");
		f.TITLE.focus();
	} else if(!f.TEL.value) {
		alert("연락처를 입력하여 주십시오");
		f.TEL.focus();
	} else if(!f.CONTENTS.value) {
		alert("내용을 입력하여 주십시오");
		f.CONTENTS.focus();
	} else {
		f.action = "./_process/email.php";
		f.target = "send_data";
		f.submit();
	}
}

function searchid_chk() {
	var f	= eval("document.FRM");

	if(!f.NAME.value) {
		alert("이름을 입력하여 주십시오");
		f.NAME.focus();
	} else if(!f.EMAIL1.value) {
		alert("이메일을 입력하여 주십시오");
		f.EMAIL1.focus();
	} else {
		f.action = "./_process/searchid.php";
		f.target = "send_data";
		f.submit();
	}
}


function searchpw_chk() {
	var f	= eval("document.FRM");

	if(!f.ID.value) {
		alert("ID를 입력하여 주십시오");
		f.NAME.focus();
	} else if(!f.EMAIL2.value) {
		alert("이메일을 입력하여 주십시오");
		f.EMAIL1.focus();
	} else {
		f.action = "./_process/searchpw.php";
		f.target = "send_data";
		f.submit();
	}
}



/**************************************
	회사 사이트 불러오기
***************************************/
function loadCompanySite() {
	$.ajax({
		type: "GET",  
		url: "_company/main.php",   
		data: "",
		success: function(msg) {
				$("#house").html(msg);
			}
		}
	);
}

function loadCompanySiteDoneAfter() {
	$("#main_menu").animate({ top : '0px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { $(this).stop(); } });	 
}

var nowMenu;

function c_subPage(m,sm) {
	var BBSCODE;
	var mnum;

	for(i=1;i<=4;i++) {
		switch(i) {
			case 1:
				mnum = 4;
				break;
			case 3:
				mnum = 0;
				break;
			default :
				mnum = 2;
				break;
		}
		for(j=1;j<=mnum;j++) {
			var imgt	= document.getElementById("c_m" + i + "_" +j);
			var temp	= imgt.src;
			var imgname	= temp.split("/");
			var onoff	= imgname[imgname.length-1].substr(imgname[imgname.length-1].length-7,7);

			if(i != m || j != sm) {
				if(onoff == "_on.png") {
					imgt.src = "img/snb/" + imgname[imgname.length-1].substr(0,imgname[imgname.length-1].length-7) + ".png";
				}
			} else {
				if(onoff != "_on.png") {
					imgt.src = "img/snb/" + imgname[imgname.length-1].substr(0,imgname[imgname.length-1].length-4) + "_on.png";
				}
			}
		}
	}

	nowMenu = m + "_" + sm;

	if(m == 1) {
		switch(sm) {
			case 1:
				ajaxpage("business","");
				break;
			case 2:
				ajaxpage("history","");
				break;
			case 3:
				ajaxpage("partners","");
				break;
			case 4:
				ajaxpage("contactus","");
				break;
		}
	}
	else if(m == 2) {
		switch(sm) {
			case 1:
				ajaxpage("eunhye","");
				break;
			case 2:
				ajaxpage("jadu","");
				break;
		}
	}
	else if(m == 3) {
		ajaxpage("audition","");
	}
	else if(m == 4) {
		BBSCODE	= "CompanyNews";
		if(sm == 1) BBSCODE	= "CompanyNotice";
		ajaxpage("board","BBSCODE=" + BBSCODE);
	}
	else {
		ajaxpage("first","");
	}
}

function ajaxpage(urlpage,param) {
	$.ajax({
		type: "GET",  
		url: "_company/" + urlpage + ".php",
		data: param,
		success: function(msg) {
				$("#c_contents").html(msg);
			}
		}
	);
}

function cmenu(num) {
	for(i=1;i<=4;i++) {
		var t = document.getElementById("c_m" + i);
		if(num == i) {
			$("#menu" + i).slideDown(500);
			t.src = c_menu_on[i];
		} else {
			$("#menu" + i).slideUp("slow");
			t.src = c_menu[i];
		}
	}
}



function audition_write() {
	var f	= eval("document.FRM");

	if(!f.NAME.value) {
		alert("이름을 입력해 주십시오");
		f.NAME.focus();
	} else if(!f.PW.value) {
		alert("비밀번호를 입력해 주십시오");
		f.PW.focus();
	} else if(!f.EMAIL.value) {
		alert("이메일을 입력해 주십시오");
		f.EMAIL.focus();
	} else if(!f.TITLE.value) {
		alert("제목을 입력해 주십시오");
		f.TITLE.focus();
	} else if(!f.FILE.value) {
		alert("지원서를 입력해 주십시오");
		f.FILE.focus();
	} else {
		if(!f.CONTENTS_INPUT.value) f.CONTENTS.value = "";
		f.action = "_process/audition.php";
		f.target = "send_data";
		f.submit();
	}
}

/**************************************
	첫 페이지 메인 배경 이미지 커서따라 움직이기
***************************************/
/*
var oX = false;
var oY = false;
function moveBG(imgid,xx,yy) {
	if(SiteSelectDone == false) {
		var t	= document.getElementById(imgid);
		var dd = document.documentElement;	//최신버전의 브라우저들
		var db = document.body;				//구 버전의 브라우저들
		var scrollLeft=-xx;scrollTop=-yy;
		var oX = xx;oY = yy;
	 
		if(dd){
			scrollLeft	+= dd.scrollLeft; 
			scrollTop	+= dd.scrollTop;
		}
		else if(db){
			scrollLeft	+= db.scrollLeft;
			scrollTop	+= db.scrollTop;
		}

		var mouseX = event.clientX;
		var mouseY = event.clientY;

		// 위치 조정
		xpos = scrollLeft - Math.floor(mouseX/3);
		ypos = scrollTop - Math.floor(mouseY/3);

		// 레이어 이동
		t.style.left = xpos + 'px';
		t.style.top = ypos + 'px';
	}
}
*/

/**************************************
	윤은혜 사이트 불러오기
***************************************/
function loadSite() {
	$.ajax({
		type: "GET",  
		url: "_yoon/main.php",   
		data: "",
		success: function(msg) {
				$("#eunhye").html(msg);
			}
		}
	);
}


/**************************************
	윤은혜 : SCHEDULE
***************************************/
var schedule_year;
var schedule_month;
var schedule_day;

function schedule() {
	$.ajax({
		type: "GET",  
		url: "_yoon/schedule.php",   
		data: "",
		success: inner_schedule
		}
	);
}

function inner_schedule(msg){
	$("#schedule").html(msg);
}

// 작은 팝업 레이어 띄우기(요일,날짜,내용)
function schedule_on(w,d,m,color) {

	schedule_day	= d;

	$("#schedule_on").show();
	$("#schedule_on").css("margin-left",(d * 30 + 140) + "px");
	$("#schedule_on_week").css("color",color);
	$("#schedule_on_day").css("color",color);
	$("#schedule_on_week").html(w);
	$("#schedule_on_day").html(d);
	$("#schedule_on_memo").html(m);
}


/**************************************
	윤은혜 : GALLERY
***************************************/
function gallery(d) {
	$.ajax({
		type: "GET",  
		url: "_yoon/gallery.php",   
		data: d,
		success: function(msg) {
				$("#gallery").html(msg);
			}
		}
	);
}

function resizeRock() {
	var imgHeight = 0;

	if($("#GalleryImg").length > 0) {
		imgHeight = (document.body.clientHeight - 100) * 0.9;
		if (imgHeight < 400) imgHeight = 400;
		$("#GalleryImg").css("height",imgHeight + "px");
	}
}


/**************************************
	윤은혜 : CF / ETC
***************************************/
function cfetc(d) {
	$.ajax({
		type: "GET",  
		url: "_yoon/cfetc.php",   
		data: d,
		success: function(msg) {
				$("#cfetc").html(msg);
			}
		}
	);
}


var profile_nowpage = 1;
function profile_page(page) {
	var t	= document.getElementById("history_img");
	if(page < 1) page = 1;
	if(page > 5) page = 5;
	profile_nowpage = page;

	t.src	= "img/m5/page" + page + ".png";

}
/**************************************
	윤은혜 : FAN WORLD
***************************************/
function fanworld(t,d) {
	$.ajax({
		type: "GET",  
		url: "_yoon/fanworld_" + t + ".php",   
		data: d,
		success: function(msg) {
				$("#fanworld").html(msg);
			}
		}
	);
}

function fanworldbt(num) {
	for(var i = 1 ; i<=3 ;i++) {
		var t	 = document.getElementById("fanworld_bt_"+i);
		if(i == num) t.src = "./img/m6/menu_select.png";
		else t.src = "./img/_blank.gif";
	}
}

function qna_chk() {
	var f	= eval("document.FRM");

	if(!f.NAME.value) {
		alert("이름을 입력해 주십시오");
		f.NAME.focus();
	} else if(!f.EMAIL.value) {
		alert("이메일을 입력해 주십시오");
		f.EMAIL.focus();
	} else if(!f.CONTENTS.value) {
		alert("내용을 입력해 주십시오");
		f.CONTENTS.focus();
	} else {
		f.action = "_process/write.php";
		f.target = "send_data";
		f.submit();
	}
}

function fanworld_write() {
	var f	= eval("document.FRM");

	if(!f.TITLE.value) {
		alert("제목을 입력해 주십시오");
		f.TITLE.focus();
	} else if(!f.CONTENTS.value) {
		alert("내용을 입력해 주십시오");
		f.CONTENTS.focus();
	} else {
		f.action = "_process/write.php";
		f.target = "send_data";
		f.submit();
	}
}

/**************************************
	윤은혜 메뉴 애니메이션
***************************************/
function showEunhyeMenu() {
	//chgMenu(nowPosition);
	$("#eunhye_manubar").animate({ right : 0 }, { duration : 600, complete : function() {  }} );
}


/**************************************
	팝업 레이어 띄우기/숨기기
***************************************/
function onLayerBox(t,d) {
	$.ajax({
		type: "GET",  
		url: "_yoon/" + t + ".php",   
		data: d,
		success: function(msg) {
				$("#blackbox").show();
				$("#blackbox").html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:100% ; height : 100%\"><tr><td align=\"center\">" + msg + "</td></tr></table>"); //innerHTML 을 이런 방식으로 사용함
			}
		}
	);
}

function onLayerBoxClose() {
	$("#blackbox").html(" ");
	$("#blackbox").hide();
}

$("#blackbox").click(function() {
	onLayerBoxClose();
});

/**************************************
	페이지 로딩시 시작되는 이벤트
***************************************/
function onLoadEvent() {
	loadCompanySite();
	loadSite();
}

/**************************************
	페이지 로딩시 시작되는 이벤트
***************************************/
function SiteSelect(m) {
	if(SiteSelectDone == false) {
		$("#footer").animate({ bottom : '0' }, { queue : false , duration : 500 , easing : 'easeOutQuad' } );
		$("#blackbox_yoon").hide();
		$("#blackbox_house").hide();
		login_ok();
		$("#s_1").hide();
		$("#s_2").hide();
		$("#house").css("cursor","default");
		$("#eunhye").css("cursor","default");

		if(m == 1) {
			$("#house").show();
			c_subPage(0,0);
			$("#c_main").animate({ width : '0px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
			$("html,body").animate({scrollTop: 0 }, { duration : 700 , easing : 'easeOutQuad' , compelete : function() { } } );
			//$("#main_menu").animate({ top : '0px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
			$("#quick_link1").animate({ right : '0px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
			$("#quick_link2").animate({ left : '-200px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
			$("#house").animate({ width : '100%' }, { duration : 700 , easing : 'easeOutQuad', complete : function() { 
				//loadCompanySiteDoneAfter();
				$("#house").css("min-height","840px");
				$("#eunhye").hide(); 
				$(this).stop();
			}} );
		} 
		if(m == 2) {
			$("#eunhye").show(); 
			$("#quick_link1").animate({ right : '-200px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
			$("#quick_link2").animate({ left : '0px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
			$("#house").animate({ width : '0' }, { duration : 700 , easing : 'easeOutQuad', complete : function() { 
				//$("#eunhye").css("height","5040px");
				//$("#yoon_1").css("height","840px");
				$("#eunhye").animate({ height : '5040px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
				$("#yoon_1").animate({ height : '840px' }, {queue : false, duration : 500 , easing : 'easeOutQuad' , compelete : function() { } });	 
				$("#yoon_2").show();
				$("#yoon_3").show();
				$("#yoon_4").show();
				$("#yoon_5").show();
				$("#yoon_6").show();
				//$("#yoon_7").show();
				schedule();
				//cfetc();
				gallery();
				fanworld("list","BBSCODE=News");
				showEunhyeMenu();
				$("#house").hide(); 
				//$(this).stop();
				//alert("asdf");
			}} );
		}
		SiteSelectDone = true;
	}

}

/**************************************
	로그인
***************************************/
function login() {
	var f	= eval("document.FRM");
	if(!f.id.value) {
		alert("아이디를 입력해 주십시오");
		return false;
	} else if(!f.pw.value) {
		alert("비밀번호를 입력해 주십시오");
		return false;
	} else {
		f.target = "send_data";
		f.action = "_process/login.php";
		f.submit();
	}
}

function login_ok(d) {
	$.ajax({
		type: "GET",  
		url: "_yoon/login_ok.php",
		data : d,
		success: function(msg) {
			$("#pop_login").html(msg);
		}
	});
}

function logout() {
	/*
	var f	= eval("document.FRM");
	f.target = "send_data";
	f.action = "_process/logout.php";
	f.submit();
	*/
	send_data.location.href = "_process/logout.php";
}


/**************************************
	맨 첫화면 움직이는 효과
***************************************/
var nowSiteMouseOn = "";
function FirstSelect(m) {
	if(SiteSelectDone == false) {
		switch(m) {
			case 1:
				SiteSelectDone = true;
				if(nowSiteMouseOn == "" || nowSiteMouseOn != 1) {
					$("#blackbox_yoon").hide();
					$("#blackbox_house").css("width","75%");
					$("#blackbox_house").show();
					$("#blackbox_house").animate({ width : '25%' }, { duration : 400 , easing : 'easeOutQuad', complete : function() {  }});
					$("#house").animate({ width : '25%' }, { duration : 400 , easing : 'easeOutQuad', complete : function() { nowSiteMouseOn = 1; }});
					$("#s_1").show();
					$("#s_2").hide();
				}
				SiteSelectDone = false;
				break;
			case 2:
				SiteSelectDone = true;
				if(nowSiteMouseOn == "" || nowSiteMouseOn != 2) {
					$("#blackbox_house").hide();
					$("#blackbox_yoon").show();
					$("#house").animate({ width : '75%' }, { duration : 400 , easing : 'easeOutQuad', complete : function() { nowSiteMouseOn = 2; }});
					$("#s_1").hide();
					$("#s_2").show();
				}
				SiteSelectDone = false;
				break;
		}
	}
}




/**************************************
	중복 아이디 체크
***************************************/
function join_idchk() {
	var f	= eval("document.FRM");
	var id	= f.ID.value;
	if(!id) {
		alert("ID 입력후 시도 하여 주십시오.");
		f.ID.focus();
	} else {
		if(id.length < 4) {
			alert("ID는 4글자 이상 입력하여 주십시오.");
			return;
		}
		$.ajax({
			type: "GET",  
			url: "_process/idchk.php",   
			data: "id="+id,
			success: function(msg) {
					if(msg == "SUCCESS") {
						f.IDCHK.value = "1";
						alert("사용해도 좋은 ID입니다. 가입을 진행하여 주십시오.");
					} else {
						f.IDCHK.value = "";
						alert("중복된 ID입니다. 다른 ID를 입력해 주십시오");
						f.ID.value = "";
						f.ID.focus();
					}
				}
			}
		);
	}
}


/**************************************
	중복 별명 체크
***************************************/
function join_nickchk() {
	var f	= eval("document.FRM");
	var nick	= f.NICK.value;
	if(!nick) {
		alert("별명입력후 시도 하여 주십시오.");
		f.NICK.focus();
	} else {
		if(nick.length < 3) {
			alert("별명은 3글자 이상 입력하여 주십시오.");
			return;
		}
		$.ajax({
			type: "GET",  
			url: "_process/nickchk.php",   
			data: "nick="+nick,
			success: function(msg) {
					if(msg == "SUCCESS") {
						f.NICKCHK.value = "1";
						alert("사용해도 좋은 별명입니다. 가입을 진행하여 주십시오.");
					} else {
						f.NICKCHK.value = "";
						alert("중복된 별명입니다. 다른 별명를 입력해 주십시오");
						f.NICK.value = "";
						f.NICK.focus();
					}
				}
			}
		);
	}
}




/**************************************
	플래시 뿌려주는 스크립트
***************************************/
function swfRunnerParam(varUrl, varID, varWidth, varHeight, varParams) {
	document.write('<object id="'+varID+'" width="'+varWidth+'" height="'+varHeight+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">');
	document.write('<param name="movie" value="'+ varUrl +'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<param name="allowScriptAccess" value="Always" />');
	document.write('<param name="flashvars" value="'+varParams+'" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed name="'+varID+'" src="'+ varUrl +'" quality="high" bgcolor="#ffffff"');
	document.write('width="'+varWidth+'" height="'+varHeight+'" align="middle"');
	document.write('play="true"	loop="false" quality="high"');
	document.write('allowScriptAccess="Always"');
	document.write('flashvars="'+varParams+'"');
	document.write('type="application/x-shockwave-flash"');
	document.write('pluginspage="http://www.adobe.com/go/getflashplayer">');
	document.write('</embed>');
	document.write('</object>');
}



// png 스크립트
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src=''; 
    return '';
}

// 탭 내비게이션
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}



function popup(url,target,w,h) {
	var pop;

	screentop	= (screen.height/2) - (h/2);
	screenleft	= (screen.width/2) - (w/2);

	pop	= window.open(url,target,"width=" + w + "px, height=" + h + ", top=" + screentop + ", left=" + screenleft + ", scrollbars = no");

}
