/*
 * ----------------------------------------------
 *
 * @create   2007/01/17
 * @modify   2007/02/26
 * @author   mute <mute0116@hotmail.com>
 *
 * ----------------------------------------------
 */

// 비동기 호출 할때 기본 도메인 위치
// var paygateDomain = 'http://www.paygate.net:8080';
var paygateDomain = 'http://192.168.2.26';
//var paygateDomain = 'http://192.168.1.60';
//var paygateDomain = 'http://211.53.212.60';

// 메인 화면에서 플레쉬를 사용할지 이미지를 사용할지 여부의 태그값
var useMainFlash = false;


//비동기 호출 할때 호출중에 다른호출이 안되도록 하기 위한 태그값
//showloading() 함수에서 값을 변경시킴
var nowworking = false;		

// 현재 어느 페이지에 있는지 구분을 위한 변수
var currentPageId = "main";	

// 이전 페이지의 변수 (Top부분의 플레쉬를 다시 로드 안하기 위해서 이전 페이지 정보를 가지고 있어야 함)
var oldPageId = "";			



/* png으로 저장시 IE7과 FF에서는 png 지원이 되지만, IE6에서는 투명으로 빠지지 않습니다.*/
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 ''; 
}



// Element ID로 개체를 반환
function GetObj(tagid){
	var obj = document.getElementById(tagid);
	return obj;
}

// SWF를 호출
function GetSWF(src,width,height,bgcolor){
	if (bgcolor==undefined){bgcolor="#ffffff"}
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+width+'" height="'+height+'">';
	html += '<param name="movie" value="'+src+'"/>';
	html += '<param name="quality" value="high"/>';
	html += '<param name="allowScriptAccess" value="sameDomain"/>';
	html += '<param name="bgcolor" value="'+bgcolor+'"/>';
	html += '<param name="swliveconnect" value="true"/>';
	html += '<param name="wmode" value="transparent"/>';
	html += '<embed src="'+src+'" quality=high bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" wmode="transparent" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	html += '</object>';
	document.write(html);
}


// SWF를 변수로 넘어온 obj(Element ID)에 호출
function GetSWFTo(obj,src,width,height,bgcolor){
	if (bgcolor==undefined){bgcolor="#ffffff"}
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+width+'" height="'+height+'">';
	html += '<param name="movie" value="'+src+'"/>';
	html += '<param name="quality" value="high"/>';
	html += '<param name="bgcolor" value="'+bgcolor+'"/>';
	html += '<param name="swliveconnect" value="true"/>';
	html += '<param name="wmode" value="transparent"/> ';
	html += '<embed src="'+src+'" quality=high bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" wmode="transparent" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	html += '</object>';
	obj.innerHTML =html;
}

function isObject(a) {return (a && typeof a == 'object');} 


// 사이트의 전반적인 정보를 담고 있는 배열객체(JSON Data)
var SiteDatas =
{
	pageDatas:
	[

    //ABOUT US
	{pageId: "main",			  group:"main",	   name:"main",				  rootLocation:"Home ",					contentsURI: "/jn/index.php",									swf: "/jn/images/flash/main.swf",	 img:""  },
	{pageId: "admin",			  group:"about",   name:"Admin",			  rootLocation:"Home > Admin > ",		contentsURI:"/jn/admin/admin_content.php",						swf:"/jn/images/about.jpg",			 img:"/jn/jn/about/images/title_1.png" },
	{pageId: "notice_list",		  group:"about",   name:"Notices",			  rootLocation:"Home > About us > ",	contentsURI:"/jn/about/notice_list_content.php",				swf:"/jn/images/about.jpg",	 		 img:"/jn/about/images/title_1.png" },
	{pageId: "notice_view",		  group:"about",   name:"Notices",			  rootLocation:"Home > About us > ",	contentsURI:"/jn/about/notice_view_content.php",			    swf:"/jn/images/about.jpg",	 		 img:"/jn/about/images/title_1.png" },
	{pageId: "notice_edit",		  group:"about",   name:"Notices",			  rootLocation:"Home > About us > ",	contentsURI:"/jn/about/notice_edit_content.php",				swf:"/jn/images/about.jpg",	 		 img:"/jn/about/images/title_1.png" },
	{pageId: "notice_write",	  group:"about",   name:"Notices",			  rootLocation:"Home > About us > ",	contentsURI:"/jn/about/notice_ins_content.php",				    swf:"/jn/images/about.jpg",	 		 img:"/jn/about/images/title_1.png" },
	 	
	{pageId: "what_we_do",		  group:"about",   name:"What We Do",	      rootLocation:"Home > About us > ",    contentsURI:"/jn/about/company_content.php",				    swf:"/jn/images/about.jpg",  img:"/jn/about/images/title_2.png" },
	{pageId: "why_paygate",	      group:"about",   name:"Why PayGate",	      rootLocation:"Home > About us > ",    contentsURI:"/jn/about/whypagate_content.php",		            swf:"/jn/images/about.jpg",  img:"/jn/about/images/title_3.png" },
	{pageId: "contact_us",		  group:"about",   name:"Contact us",		  rootLocation:"Home > About us > ",    contentsURI:"/jn/about/contact_content.php",				    swf:"/jn/images/about.jpg",  img:"/jn/about/images/title_4.png" }, 
	

    //SERVICE
	{pageId: "001",				  group:"service",  name:"PayGate Service",		    rootLocation:"Home > Service > ",	 contentsURI:"/jn/service/001_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_1.png" },
	{pageId: "002",				  group:"service",  name:"Credit Card",				rootLocation:"Home > Service > ",    contentsURI:"/jn/service/002_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_2.png" },
	{pageId: "003",				  group:"service",  name:"Bank Transfer",			rootLocation:"Home > Service > ",    contentsURI:"/jn/service/003_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_3.png" },
	{pageId: "004",				  group:"service",  name:"CVS Payment",				rootLocation:"Home > Service > ",    contentsURI:"/jn/service/004_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_4.png" },
	{pageId: "005",				  group:"service",  name:"China UnionPay",			rootLocation:"Home > Service > ",    contentsURI:"/jn/service/005_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_5.png" },
	{pageId: "006",				  group:"service",  name:"Alipay",					rootLocation:"Home > Service > ",    contentsURI:"/jn/service/006_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_6.png" },
	{pageId: "007",     		  group:"service",  name:"Mobile Payment",		rootLocation:"Home > Service > ",    contentsURI:"/jn/service/007_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_7.png" },
	{pageId: "008",				  group:"service",  name:"PDA Payment Service",	    rootLocation:"Home > Service > ",    contentsURI:"/jn/service/008_content.php",			swf:"/jn/images/service.jpg",  img:"/jn/service/images/title_8.png" },


	//SOLUTIONS
   
	{pageId: "gateway",			   group:"solutions",  name:"Payment Gateway Solution",				rootLocation:"Home > Solutions > ",	    contentsURI:"/jn/solutions/gateway.php",		swf:"/jn/images/solution.jpg",  img:"/jn/solutions/images/title_1.png" },
	{pageId: "virtual",			   group:"solutions",  name:"Virtual Banking System (Seyfert)",	 	rootLocation:"Home > Solutions > ",	    contentsURI:"/jn/solutions/virtual.php",		swf:"/jn/images/solution.jpg",  img:"/jn/solutions/images/title_2.png" },
	{pageId: "pda",				   group:"solutions",  name:"PDA Payment Solution",					rootLocation:"Home > Solutions > ",		contentsURI:"/jn/solutions/pda.php",			swf:"/jn/images/solution.jpg",  img:"/jn/solutions/images/title_3.png" },
	{pageId: "paysystem",		   group:"solutions",  name:"OpenPaySystem",						rootLocation:"Home > Solutions > ",		contentsURI:"/jn/solutions/paysystem.php",		swf:"/jn/images/solution.jpg",  img:"/jn/solutions/images/title_4.png" },
	{pageId: "shopping",		   group:"solutions",  name:"Shopping Mall Solution",				rootLocation:"Home > Solutions > ",     contentsURI:"/jn/solutions/shopping.php",		swf:"/jn/images/solution.jpg",  img:"/jn/solutions/images/title_5.png" },
	{pageId: "miscellaneous",	   group:"solutions",  name:"Miscellaneous",						rootLocation:"Home > Solutions > ",     contentsURI:"/jn/solutions/miscellaneous.php",	swf:"/jn/images/solution.jpg",  img:"/jn/solutions/images/title_6.png" },

  	
	//CUSTOMER SUPPORT
	{pageId: "faq_list",		   group:"customer",	name:"FAQ",						rootLocation:"Home > Customer Support > ", contentsURI:"/jn/customer/faq_list_content.php",			swf:"/jn/images/customer.jpg", img:"/jn/customer/images/title_1.png" },
	{pageId: "faq_view",		   group:"customer",	name:"FAQ",						rootLocation:"Home > Customer Support > ", contentsURI:"/jn/customer/faq_view_content.php",			swf:"/jn/images/customer.jpg", img:"/jn/customer/images/title_1.png" },
	{pageId: "faq_edit",		   group:"customer",	name:"FAQ",						rootLocation:"Home > Customer Support > ", contentsURI:"/jn/customer/faq_edit_content.php",			swf:"/jn/images/customer.jpg", img:"/jn/customer/images/title_1.png" },
	{pageId: "faq_write",		   group:"customer",	name:"FAQ",						rootLocation:"Home > Customer Support > ", contentsURI:"/jn/customer/faq_ins_content.php",		    swf:"/jn/images/customer.jpg", img:"/jn/customer/images/title_1.png" },
	{pageId: "payment_check",	   group:"customer",	name:"Payment Details",			rootLocation:"Home > Customer Support > ", contentsURI:"/jn/customer/payment_check_content.php",	swf:"/jn/images/customer.jpg", img:"/jn/customer/images/title_2.png" },


    //JOIN US
	{pageId: "member_1",			group:"joinus",		name:"New to PayGate? Sign Up",				rootLocation:"Home > joinus > ", contentsURI:"/jn/joinus/member_1_content.php",				swf:"/jn/images/joinus.jpg",  img:"/jn/joinus/images/title_1.png" },
	{pageId: "member_2",			group:"joinus",		name:"New to PayGate? Sign Up",				rootLocation:"Home > joinus > ", contentsURI:"/jn/joinus/member_2_content.php",				swf:"/jn/images/joinus.jpg",  img:"/jn/joinus/images/title_1.png" },
	{pageId: "partner_1",			group:"joinus",		name:"PayGAte Partner",						rootLocation:"Home > joinus > ", contentsURI:"/jn/joinus/partner_1_content.php",			swf:"/jn/images/joinus.jpg",  img:"/jn/joinus/images/title_2.png" },
	{pageId: "partner_2",			group:"joinus",		name:"PayGAte Partne Form",					rootLocation:"Home > joinus > ", contentsURI:"/jn/joinus/partner_2_content.php",		    swf:"/jn/images/joinus.jpg",  img:"/jn/joinus/images/title_2.png" },
	{pageId: "partner_3",			group:"joinus",		name:"PayGAte Partne Form",					rootLocation:"Home > joinus > ", contentsURI:"/jn/joinus/partner_3_content.php",			swf:"/jn/images/joinus.jpg",  img:"/jn/joinus/images/title_2.png" },
	{pageId: "id_pw",				group:"joinus",		name:"Forgot ID/Password?",					rootLocation:"Home > joinus > ", contentsURI:"/jn/joinus/id_pw.php",						swf:"/jn/images/joinus.jpg",  img:"/jn/joinus/images/title_3.png" }
 
	]
};


//페이지 아이디로 배열에 담겨있는 정보를 읽어옴
function GetPageData(pageid){
	var obj = SiteDatas.pageDatas;
	for(var i=0; i < obj.length; i++){
		if (obj[i].pageId == pageid){
			return obj[i];
		}
	}
	return 'undefined';
}




// 메인 페이지의 상단 레이아웃 HTML
function mainBase(){
	var html = '';
	
	//  플레쉬를 사용할 경우
	if (useMainFlash == true)
	{
	html += '						<form name="PGIOForm"><input type="hidden" name="mid" value="pggate"></form>';
	html += '						<table width=680 cellspacing=0 cellpadding=0>';
	html += '						<tr><td style="padding-top:30;"><div id="TopSWF" style="z-index:2"></div></td></tr>';
	html += '						</table>';
	} else {
	//  이미지를 사용 할 경우
	html += '						<form name="PGIOForm"><input type="hidden" name="mid" value="pggate"></form>';
	html += '						<table width=680 cellspacing=0 cellpadding=0 border="0">';
	html += '                       <tr><td height="480" rowspan="2" style="padding-top:28px; padding-left:3px;" valign="top"><a href="/jn/index.php"  onFocus="this.blur();"><img src=/jn/images/logo.gif></a></td>';
	html += '                       <td height="302">&nbsp;</td>';
	html += '                       <td width="180" valign="top" style="padding-top:275px; padding-left:15px;" rowspan="2">';
	html += '						<table width="180" height="170" cellspacing=0 cellpadding=0 border="0">'; //버튼 여백없애기 위한 테이블
	html += '                       <tr><td height="34"><a href="javascript:GetRequest(002);"><img src=/jn/images/credit_ov.gif   id="credit_img"   OnMouseOver=javascript:main_roll("credit_ov");      OnMouseOut=javascript:main_roll("credit_out");></a></td></tr>';
	html += '                       <tr><td height="34"><a href="javascript:GetRequest(003);"><img src=/jn/images/bank.gif        id="bank_img"     OnMouseOver=javascript:main_roll("bank_ov");        OnMouseOut=javascript:main_roll("bank_out");></a></td></tr>';
	html += '                       <tr><td height="34"><a href="javascript:GetRequest(005);"><img src=/jn/images/china.gif       id="china_img"    OnMouseOver=javascript:main_roll("china_ov");       OnMouseOut=javascript:main_roll("china_out");></a></td></tr>';
	html += '                       <tr><td height="34"><a href="javascript:GetRequest(006);"><img src=/jn/images/alipay.gif      id="alipay_img"   OnMouseOver=javascript:main_roll("alipay_ov");      OnMouseOut=javascript:main_roll("alipay_out");></a></td></tr>';
	html += '                       <tr><td height="34"><a href="javascript:GetRequest(004);"><img src=/jn/images/cvs.gif         id="cvs_img"      OnMouseOver=javascript:main_roll("cvs_ov");         OnMouseOut=javascript:main_roll("cvs_out");></a></td></tr>';
	html += '                       <tr><td height="34"><a href="javascript:GetRequest(007);"><img src=/jn/images/phone.gif       id="phone_img"    OnMouseOver=javascript:main_roll("phone_ov");       OnMouseOut=javascript:main_roll("phone_out");></a></td></tr>';
	html += '						</table>';
	html += '                       </td></tr>';
	html += '						<tr><td width="400" height="280" align="right" valign="top"><div id="TopSWF" style="z-index:2;"><img src="/jn/images/credit_img.jpg" id="main_img"></div></td>';
	html += '						</table>';
	}
	return html;
}



// 서브 페이지들의 상단 레이아웃 HTML
function subBase(){
var html = ''
	html += '						<table width="100%" cellspacing=0 cellpadding=0 border = 0>';
//	html += '						<tr><td colspan=2 style="border-bottom:1 solid #C9CAD9;"><div id="TopSWF" style="z-index:2"></div></td></tr>';
    html += '						<tr><td colspan=2 style="border-bottom:1 solid #C9CAD9;"><img id="TopSWF" src="" usemap="#mymap"></td></tr>';
	html += '						<tr>';
	html += '							<td width=50% ><img id="topTitle" src="" class=""></td>';
	html += '							<td width=50% align=right valign=top id="location" style="padding-top:7;"><span id="rootLocation"></span><span id="location_now"></span></td>';
	html += '						</tr>';
	html += '						</table>';
    html += '						<map name="mymap">';
    html += '						<area shape="rect" coords="2,23,104,55" onFocus="this.blur();" href="/jn/index.php"; />';
    html += '						</map>';
	return html;
}




function main_roll(inja3){

    var img_arr = new Array("/jn/images/credit_img.jpg","/jn/images/bank_img.jpg","/jn/images/china_img.jpg","/jn/images/alipay_img.jpg","/jn/images/cvs_img.jpg","/jn/images/phone_img.jpg");
    var img_ov = new Array("/jn/images/credit_ov.gif","/jn/images/bank_ov.gif","/jn/images/china_ov.gif","/jn/images/alipay_ov.gif","/jn/images/cvs_ov.gif","/jn/images/phone_ov.gif");
	var img_out = new Array("/jn/images/credit.gif","/jn/images/bank.gif","/jn/images/china.gif","/jn/images/alipay.gif","/jn/images/cvs.gif","/jn/images/phone.gif");
   

 	var main_img = GetObj("main_img");
	var credit_img = GetObj("credit_img");
	var bank_img = GetObj("bank_img");
	var china_img = GetObj("china_img");
	var alipay_img = GetObj("alipay_img");
	var cvs_img = GetObj("cvs_img");
    var phone_img = GetObj("phone_img");

    if (inja3 == "credit_ov" || inja3 == "credit_out")
    {   
		main_img.src = img_arr[0];
		credit_img.src = img_ov[0];
    }

	if (inja3 == "bank_ov")
    {
		main_img.src = img_arr[1];
		bank_img.src = img_ov[1];
		credit_img.src = img_out[0];	
    }

	if (inja3 == "bank_out")
	{
		main_img.src = img_arr[0];
		bank_img.src = img_out[1];	
		credit_img.src = img_ov[0];
	}

	if (inja3 == "china_ov")
    {
		main_img.src = img_arr[2];
		china_img.src = img_ov[2];
		credit_img.src = img_out[0];
    }

	if (inja3 == "china_out")
	{
		main_img.src = img_arr[0];
		china_img.src = img_out[2];	
		credit_img.src = img_ov[0];
	}

	if (inja3 == "alipay_ov")
    {
		main_img.src = img_arr[3];
		alipay_img.src = img_ov[3];
		credit_img.src = img_out[0];
    }

	if (inja3 == "alipay_out")
	{
		main_img.src = img_arr[0];
		alipay_img.src = img_out[3];	
		credit_img.src = img_ov[0];
	}

	if (inja3 == "cvs_ov")
    {
		main_img.src = img_arr[4];
		cvs_img.src = img_ov[4];
        credit_img.src = img_out[0];
    }

	if (inja3 == "cvs_out")
	{
		main_img.src = img_arr[0];
		cvs_img.src = img_out[4];	
		credit_img.src = img_ov[0];
	}

	if (inja3 == "phone_ov")
	{
		main_img.src = img_arr[5];
		phone_img.src = img_ov[5];
		credit_img.src = img_out[0];
	}

	if (inja3 == "phone_out")
	{
		main_img.src = img_arr[0];
		phone_img.src = img_out[5];	
		credit_img.src = img_ov[0];
	}
		
}



// 파라미터로 넘어온 페이지를 현재의 페이지 변수를 변경하고 기존의 페이지변수를 이전페이지 변수에 적용
function SetPageId(newId){
	oldPageId = currentPageId;
	currentPageId = newId;
}


// 메인 페이지 호출 
function LoadMainpage()
{
	roll.className = "body1"  //메인 페이지 일때 body1 스타일을 적용한다.
	
	SetPageId("main");
	showloading(false);
	var topArea = GetObj('topArea');
	topArea.innerHTML = mainBase();	// 메인 레이아웃을 먼저 호출
			
	var contentArea = GetObj('contentArea');
	var swf = GetObj('TopSWF');
    if (useMainFlash == true)
		{
			GetSWFTo(swf,"/images/flash/main.swf",680,374);
		}
		contentArea.innerHTML = "";
}


/*
'로딩중...' 레이어 제어
 request할때 호출 -> showloading(true)
 request callback에서 호출 -> showloading(false)
*/
function showloading(bool){
	nowworking =bool;
	var loading = GetObj('loading');
	if ( bool == true){
		loading.innerHTML = '<div class="loading-indicator">Loading...</div>';
		loading.style.visibility ='';
	}else{
		loading.innerHTML = '';
		loading.style.visibility ='hidden';
	}
}


var urlstring;

function callback(jData) {


	var returnpage = parseResult(jData);
	var pageInfo = GetPageData(currentPageId);
	var oldpageInfo = GetPageData(oldPageId);  // 이전 페이지 
	if (returnpage!='')
	{
		roll.className = "body2" //메인 이미지가 아닐때 body2 스타일을 적용한다.
		// 이전 페이지가 없었거나 이전페이와 현재 페이지의 그룹이 다른경우
		// 상단 플레쉬를 변경 (en,cn,jn 은 상단 플래쉬를 이미지로 교체했음)
		if( (oldpageInfo == "undefined") || (pageInfo.group != oldpageInfo.group) )
		{
			if ( (oldpageInfo == "undefined") || (oldpageInfo.pageId=='main'))
			{
			var topArea = GetObj('topArea');
			topArea.innerHTML = subBase();
			}
			var swf = GetObj('TopSWF');
			//GetSWFTo(swf,pageInfo.swf,680,148);
			swf.src = pageInfo.swf;
		}

		var topArea = GetObj('topArea');   //상단 swf 이미지로 교체 작업...569line 까지..
		topArea.innerHTML = subBase();
		var swf = GetObj('TopSWF');
		swf.src = pageInfo.swf;

        //detectPlatform(); // png 바탕을 투명처리하기 위한 처리 루틴...

		//if (platform == "MSIE_WIN") //익스플로러 일떄만....
		//{
		//	setPng24(swf);
		//}

		var contentArea = GetObj('contentArea');	// 본문이 표시될곳
		var rootLocation =GetObj('rootLocation');	// 현재 위치 표시 부분중 상위
		var location_now = GetObj('location_now');  // 현재 위치 표시 부분준 현재 위치
		var topTitle = GetObj('topTitle');			// 현재 위치를 나타내는 이미지
		rootLocation.innerHTML = pageInfo.rootLocation ;
		location_now.innerHTML = pageInfo.name; 
		topTitle.src = pageInfo.img;

		
		detectPlatform(); // png 바탕을 투명처리하기 위한 처리 루틴...

		if (platform == "MSIE_WIN") //익스플로러 일떄만....
		{
			setPng24(topTitle);
        }

		//alert(returnpage);
		if ( returnpage.indexOf('PGIOForm') == -1 ) // 오류등의 이유로 PGIOForm이 없으면 기본폼을 넣어줌
		{returnpage = returnpage+'<form name="PGIOForm"><input type="hidden" name="mid" value="pggate"></form>';}
		contentArea.innerHTML = returnpage;
	}else{
		
		var contentArea = GetObj('contentArea');
		contentArea.innerHTML='<form name="PGIOForm"><input type="hidden" name="mid" value="pggate"></form>';
	}
	 
	showloading(false);
}


// 실제 페이지 호출하는 함수
function GetRequest(pageid, strURI, strCallbackName){
	var sUrl='';
	var callbackName = '';
	urlstring = '';

	if (nowworking == false){
		//loading.. 레이어 보이기 
		showloading(true);
		//현재 페이지아이디를 저장
		SetPageId(pageid);
		if (pageid == "main"){
			LoadMainpage();
		}
		else{
            
			//직접 호출할 페이지가 없으면 pageid로 호출할 URL을 만듬
			if((typeof strURI=="undefined") ||  (strURI=="") ){
			 //sUrl = paygateDomain + GetPageData(currentPageId).contentsURI;
			   sUrl = paygateDomain + GetPageData(currentPageId).contentsURI;
			}else{
				sUrl = strURI
			}

			//사용자정의 callback이 없으면 기본 callback 호출
			if((typeof strCallbackName=="undefined") ||  (strCallbackName=="") ){
				callbackName ='callback';
			}else{
				callbackName = strCallbackName
			}
			DOMRequest(sUrl, urlstring, 'GET', callbackName,'','UTF-8');
		}
	}
}



// 링크 페이지 호출하는 함수
function GetRequestParams(pageid, params){
     
	if (nowworking == false){
		showloading(true);
		SetPageId(pageid);
		if (pageid == "main"){
			LoadMainpage();
		}else{
			//var sUrl =paygateDomain + GetPageData(currentPageId).contentsURI;
			var sUrl = paygateDomain + GetPageData(currentPageId).contentsURI;
			DOMRequest(sUrl, params, 'GET', 'callback','','UTF-8');

		}
	}
}


// create the NavigationMenu application (single instance)
/*
body가 스크롤 될때 네비게이션도 같이 스크롤 시키기위해서
onScroll 이벤트를 사용 하고 
스크롤 될때 플레쉬등이 깨지지 않게 하기 위해서 약간의 딜레이를 줌
*/
var nowScroll = true;	//현재 스크롤 되어서 네이게이션을 이동시키는중인지 검사하는 태그값
var tt;					// timer 개체 변수

// 네비게이션 이동 작업 함수
function naviScroll(){
	clearTimeout(tt);
	var navi = document.getElementById('navi-dlg');
	navi.style.top  = document.body.scrollTop + document.body.clientHeight - 200-30;

	nowScroll = false;
}

// Body 스크롤 이벤트 핸들러
function bodyScroll(){
	if(nowScroll == false){
		nowScroll = true;
		tt = setTimeout( naviScroll, 2);
	}
}

//Document onload시 처리할것들
var documentInit =function(){
    nowScroll = false;
	GetRequest(currentPageId);
}

var NavigationMenu = function(){
    var dialog, showBtn;
    return {
        init : function(){
             showBtn = getEl('btnNavi');
             showBtn.on('click', this.showDialog, this, true);
        },
        showDialog : function(){
            if(!dialog){ // lazy initialize the dialog and only create it once
                dialog = new YAHOO.ext.BasicDialog("navi-dlg", { 
						autoCreate:false,
                        modal:false,
                        autoTabs:true,
                        width:600,
                        height:155,
						x:document.body.clientWidth/2 - (500/2),
						y:document.body.clientHeight - 150-60,
                        shadow:false,
                        minWidth:300,
                        minHeight:150,
                        proxyDrag: true,
						fixedcenter: false
                });
                dialog.addKeyListener(27, dialog.hide, dialog);
                dialog.addButton('Close', dialog.hide, dialog);
            }
            dialog.show(showBtn.dom);
        }
    };
}();

YAHOO.ext.EventManager.onDocumentReady(NavigationMenu.init, NavigationMenu, true);
YAHOO.ext.EventManager.onDocumentReady(documentInit, "", true);
