String.prototype.trim = function() {return this.replace(/(^ *)|( *$)/g, "");}
function showLoad () {
	$('load').style.display = 'block';
}

//================= Defalut Ajax =======================
function getDef(url,pars,Div) {
	var myAjax = new Ajax.Updater(
									{success: Div}, 
									url, 
									{
									 method: 'get', 
									 parameters: pars, 
									 evalScripts: true
									});
}
//================= MENU =======================
function getCat1_only(cat1) {
//	alert(id);
	var url = '/inc/sm_menu.asp';
	var pars = 'p_cate=' + cat1 ;
//	alert(pars);
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse1} );		
	//getCat4(cat1,''); // Cate4 ÃÊ±âÈ­ getCat2¿¡¼­ °°ÀÌ ÃÊ±âÈ­ µÊ.
	getfo1();
}

function getCat1(cat1) {
//	alert(id);
	var url = '/inc/sm_menu.asp';
	var pars = 'p_cate=' + cat1 ;
//	alert(pars);
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse1} );		
	getCat2(cat1,''); // Cate2 ÃÊ±âÈ­
	getCat3('',''); // Cate3 ÃÊ±âÈ­
	//getCat4(cat1,''); // Cate4 ÃÊ±âÈ­ getCat2¿¡¼­ °°ÀÌ ÃÊ±âÈ­ µÊ.
	getfo1();
}

function getfo1(){
	$('cat1content').style.fontWeight='bold';
	$('cat1content').style.fontWeight='normal';
	$('cat1content').style.fontWeight='bold';
}

function showResponse1 (originalRequest) {
	var newData = originalRequest.responseText;
	//$('load').style.display = 'none';
	//alert(newData);
	$('cat1content').innerHTML = newData;
}

//================= CATEGORY =======================
function getCat2_only(cat1,cat2) {
//	alert(id);
	var url = '/inc/sm_cate.asp';
	var pars = 'p_cate=' + cat1+ '&m_cate=' + cat2;
//	alert(pars);
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse2} );	
//	getCat3(cat2,''); // Cate3 ÃÊ±âÈ­
//	getCat4(cat1,''); // Cate4 ÃÊ±âÈ­
	getfo2();
}

function getCat2(cat1,cat2) {
//	alert(id);
	var url = '/inc/sm_cate.asp';
	var pars = 'p_cate=' + cat1+ '&m_cate=' + cat2;
//	alert(pars);
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse2} );	
	getCat3(cat2,''); // Cate3 ÃÊ±âÈ­
	getCat4(cat1,''); // Cate4 ÃÊ±âÈ­
	getfo2();
}

function getfo2(){
	$('cat2content').style.fontWeight='bold';
	$('cat2content').style.fontWeight='normal';
	$('cat2content').style.fontWeight='bold';
}

function showResponse2 (originalRequest) {
	var newData = originalRequest.responseText;
	//$('load').style.display = 'none';
	//alert(newData);
	$('cat2content').innerHTML = newData;
}

//================= STYLE =======================
function getCat3(cat2,sty_idx) {
//	alert(id);
	var url = '/inc/sm_style.asp';
	var pars = 'm_cate=' + cat2 + '&sty_idx=' + sty_idx
//	alert(pars);
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse3} );
	getfo3();
}

function getfo3(){
	$('cat3content').style.fontWeight='bold';
	$('cat3content').style.fontWeight='normal';
	$('cat3content').style.fontWeight='bold';
}

function showResponse3 (originalRequest) {
	var newData = originalRequest.responseText;
	//$('load').style.display = 'none';
	//alert(newData);
	$('cat3content').innerHTML = newData;
}

//================= COLLECTION =======================
function getCat4(cat1,cll_idx) {
//	alert(id);
	var url = '/inc/sm_collection.asp';
	var pars = 'p_cate=' + cat1 + '&cll_idx=' + cll_idx;
//	alert(pars);
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse4} );
	getfo4();
}

function getfo4(){
	$('cat4content').style.fontWeight='bold';
	$('cat4content').style.fontWeight='normal';
	$('cat4content').style.fontWeight='bold';
}

function showResponse4 (originalRequest) {
	var newData = originalRequest.responseText;
	//$('load').style.display = 'none';
	//alert(newData);
	$('cat4content').innerHTML = newData;
}

function getVND(vnd_idx,mode) {
	var url = '/inc/sm_vnd_info.asp';
	var pars = 'vnd_idx=' + vnd_idx + '&mode=' + mode ;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse_vnd} );		
}

function getVND2(vnd_idx,mode) {
	var url = '/inc/proc_addVnd.asp';
	var pars = 'vnd_idx=' + vnd_idx + '&mode=' + mode ;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse_vnd} );		
}

function showResponse_vnd (originalRequest) {
	var newData = originalRequest.responseText;
	$('vnd_info').innerHTML = newData;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////

function pop_notice()
{
	var WinHandle = window.open("/notice/notice_view.asp","notice","top=100,left=200,width=700,height=550");
	if(WinHandle!=null) WinHandle.focus();
}

function SetNum(obj){
val=obj.value;
re=/[^0-9]/gi;
obj.value=val.replace(re,"");
}

function SetNumUS(obj){
val=obj.value;
re=/[^0-9.]/gi;
obj.value=val.replace(re,"");
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var g_fIsSP2 = (window.navigator.userAgent.indexOf("SV1") != -1); 

if(!e) var e = window.event;
document.onkeydown=keypressed;

function keypressed(e)
{
	if (e) {
		var kc = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;	
		if (kc == 122 || kc == 17 || kc == 18 || kc == 112 || kc == 25 || kc == 21 )
		{
				kc = 0;
				return false;
		}
	}
}

function t_oncontextmenu()
{
	return false;
}
function t_onselectstart()
{
	return false;
}
function t_ondragstart()
{
	return false;
}

function f_resize()
{
	var rcOpen = 1;
	try{
		if(opener.rclickOpenYN==0) rcOpen = 0;
	}catch(e){}

	if(rcOpen==1)
	{
		document.oncontextmenu=t_oncontextmenu;
		document.onselectstart=t_onselectstart;
		document.ondragstart=t_ondragstart;
	}	
}


function getCookie( name ) {
	var allCookie = document.cookie;
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ) {
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) {
				endOfCookie = document.cookie.length;
			}
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 ) break;
	}
	return "";
}


function setCookie( name, value, expiredays ) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function toggle_obj(v)
{
	$(v).style.display=($(v).style.display=='none'?'block':'none');
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++