
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];}
}

//»óÇ°»ó¼¼º¸±â
function prodDetail(townCode,productCode){
	document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode;
}

//»óÇ°Å«ÀÌ¹ÌÁöº¸±â
function showBigImg(productCode){
	url	= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=popupimage'
		+'&productCode='+productCode;
	//alert(url);
	window.open(url,"prodImgView","width=600,height=717");			
}

//»óÇ°Æòº¸±â
function commentView(townCode,productCode){
	document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode
		+'#menu04';
}

//Àå¹Ù±¸´Ïº¸±â
function basketView(townCode){
	document.location.href
		= 'http://www.invil.com/basket/PpCatalogueBasketView.jsp'
		+'?townCode='+townCode;
}

//¸ÞÀÎÈ­¸é ¸µÅ©
function marketLink(townName,param) {
	url = 'http://www.invil.com/village/'+townName+'/index.jsp?'+param;
	document.location.href = url;
}

//»óÇ°¸®½ºÆ®¸µÅ©
function buyLink(townName,param) {
	url = 'http://www.invil.com/village/'+townName+'/buy/index.jsp?'+param;
	document.location.href = url;
}

//´ë·®±¸¸Å»óÇ°¸®½ºÆ®
function heavyLink(townName,param) {
	url = 'http://www.invil.com/village/'+townName+'/heavy/index.jsp?'+param;
	document.location.href = url;
}

//»ý»êÀÚ¸®½ºÆ®¸µÅ©
function productorLink(townName,param) {
	url = 'http://www.invil.com/village/'+townName+'/productor/index.jsp?'+param;
	document.location.href = url;
}

//°³ÀÎ»óÁ¡¸®½ºÆ®¸µÅ©
function indiLink(townName,param) {
	url = 'http://www.invil.com/village/'+townName+'/indi/index.jsp?'+param;
	document.location.href = url;
}

//»ý»êÀÚ Á¤º¸º¸±â
function showProductor(productorCode){		
	url = 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=productor'
		+'&productorCode='+productorCode;
	window.open(url,"productorView","width=600,height=664");																																																											
}

//·Î±×ÀÎ
function commerceLogin(townCode,return_url){
	document.location.href = 'http://secure.invil.org/login_new/index_local.jsp?first_page=1'
		+'&village_code='+townCode
		+'&return_url='+return_url;
}

//·Î±×¾Æ¿ô
function commerceLogout(return_url){
	document.location.href = 'http://www.invil.org/login/PhLogOut.jsp?'
		+'&return_url='+return_url;
}

//¸ÞÀÏ
function commerceMail(townCode,townName,return_url){
	document.location.href = 'https://secure.invil.org/login_new/index_local.jsp?'
		+'&village_code='+townCode
		+'&return_url=http://www.invil.org/mypage_new/local/?village_code='+townCode;
}

//ÂÊÁö
function commerceMemo(townCode,townName,return_url){
	document.location.href = 'http://memo.invil.org/index.jsp?'
		+'&village_code='+townCode
		+'&region_abbr='+townName;
}

//¾Æ¹ÙÅ¸
function commerceAvatar(townCode,townName,return_url){
	document.location.href = 'http://avatar.invil.org/default.jsp?s_url=myroom_myitem.jsp'
		+'&return_url='+return_url
		+'&region_abbr='+townName;
}

//¸¶ÀÌÆäÀÌÁö
function commerceMypage(townCode,townName,return_url){
	document.location.href = 'http://www.invil.org/mypage_new/local/index.jsp?'
		+'&return_url='+return_url
		+'&village_code='+townCode;
}

//¼îÇÎ³ëÆ®
function commerceNote(townCode){
	document.location.href = 'http://www.invil.org/mypage_new/local/index.jsp?'
		+'village_code=' + townCode
		+'&return_url=http://www.invil.org/mypage_new/local/index.jsp?village_code=' + townCode;
}
//layerSet(top,left,width) 
//³×ºñ°ÔÀÌÅÍ(È¨ > ¸¶À»ÀåÅÍ > Æ¯»ê¹°ÆÇ¸ÅÄÚ³Ê) À§Ä¡¼³Á¤ ÇÏ´Â ÇÔ¼ö
//ÀÌ³à¼®Àº <body>´ÙÀ½¿¡ ½áÁà¾ß ÇÕ´Ï´Ù...
//<script>layerSet(100,100,900)</script> ÀÌ·± ½ÄÀ¸·Î....
function layerSet(t,l,w,tw){
	var layer_top = t;
	var layer_left = l;
	var layer_width = w;
	var table_width = tw;

	if ( document.body.clientWidth > layer_width ) {
		layer_left = (document.body.clientWidth-layer_width)/2 + layer_left;
	}
	document.write("<style>#path_layer {position: absolute; top:expression("+layer_top+"); left:"+layer_left+"; width:"+table_width+";}</style>");
}
function layerSet_notCenter(t,l,w,tw){
	var layer_top = t;
	var layer_left = l;
	var layer_width = w;
	var table_width = tw;
	document.write("<style>#path_layer {position: absolute; top:"+layer_top+"; left:"+layer_left+"; width:"+table_width+";}</style>");
}
function goForeign()	{
	win = window.open("","")
	
	if ( document.all.input_foreign.value == '1' ) {
		win.location.href = "http://www.invil.org/";
	} else if ( document.all.input_foreign.value == '2' ){
		win.location.href = "http://www.invil.org/english/";
	} else if ( document.all.input_foreign.value == '3' ){
		win.location.href = "http://www.invil.org/chinese/";
	} else if ( document.all.input_foreign.value == '4'){
		win.location.href = "http://www.invil.org/japanese/";
	}
}

//´ë·®±¸¸Å ¿äÃ»ÇÏ±â
function goHeavyWrite(){
	window.open('/servlet/common/InvilServlet?module=heavyBuy&action=list','','width=618,height=425,scrollbars=yes,status=yes');
//	document.oneForm.target = "create";
//	document.oneForm.action = "/servlet/common/InvilServlet?module=heavyBuy&action=preInsert";
//	document.oneForm.submit();
//	document.location.href = "/servlet/common/InvilServlet?module=heavyBuy&action=preInsert";
}

//¿ì¼ö»ý»êÀÚ ¸µÅ©
function goBestProductorDetail(url){
	window.open(url);
}

function bestProductorDetail(url){
	window.open(url);
}

//Àå¹Ù±¸´Ï ´ã±â
function insertVillageBasket(prodCode, productorCode, townCode){
	document.location.href="http://www.invil.com/servlet/common/InvilServlet?module=commercebasket&action=insert&prodCode="+prodCode+"&productorCode="+productorCode+"&townCode="+townCode;
}

//¹Ù·Î±¸¸ÅÇÏ±â
function makeVillageOrder(prodCode, productorCode, townCode){
	document.location.href="http://www.invil.com/servlet/ord/PpOrdControlSrv?methods=prepareProduct&prodCode="+prodCode+"&productorCode="+productorCode+"&townCode="+townCode;
}

//»óÇ°¹®ÀÇº¸±â
function prodQueView(townCode,productCode){
	document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode
		+'&tapOrder=3';
}

//»óÇ°¹®ÀÇº¸±â
function queView(townCode,productCode){
	document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode
		+'&tapOrder=4';
}

//Àå¹Ù±¸´Ï ´ã±â
function insertVillageBasket2(prodCode, productorCode, townCode){
	parent.document.location.href="/servlet/common/InvilServlet?module=commercebasket&action=insert&prodCode="+prodCode+"&productorCode="+productorCode+"&townCode="+townCode;
}

//¹Ù·Î±¸¸ÅÇÏ±â
function makeVillageOrder2(prodCode, productorCode, townCode){
	parent.document.location.href="/servlet/ord/PpOrdControlSrv?methods=prepareProduct&prodCode="+prodCode+"&productorCode="+productorCode+"&townCode="+townCode;
}

//»óÇ°¹®ÀÇº¸±â
function prodQueView2(townCode,productCode){
	parent.document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode
		+'&tapOrder=3';
}

//»óÇ°¹®ÀÇº¸±â
function queView2(townCode,productCode){
	parent.document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode
		+'&tapOrder=4';
}

//»óÇ°»ó¼¼º¸±â
function prodDetail2(townCode,productCode){
	parent.document.location.href
		= 'http://www.invil.com/servlet/common/InvilServlet?module=productdetail&action=view'
		+'&productCode='+productCode
		+'&townCode='+townCode;
}

function vil_theSearchCheck(village_code, S1) {

	var f = document.scSearch;
	var search_word = f.S1.value;
	var search_option = f.search_option.value;

	search_word = trimString(f.S1.value);

	if(hasSpecialCharacter(search_word))
	{
		alert("Æ¯¼ö¹®ÀÚ´Â ¿Ã¼ö¾ø½À´Ï´Ù.");
		return;
	}

	if(search_word == "")
		f.Sterm.value ="@docn";
	else
		f.Sterm.value = MakeBSquery(search_word);

	f.showQuery.value = search_word;
	f.D.value = "D100" ;

	if (search_option == "H"){
		f.action="http://www.invil.org/search/html4/total/total_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "L"){
		f.action="http://www.invil.org/search/html4/village/village_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "S"){
		f.action="http://www.invil.org/search/html4/speciality/speciality_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "N"){
		f.action="http://www.invil.org/search/html4/news/news_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "P"){
		f.action="http://www.invil.org/search/html4/mall/mall_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "T"){
		f.action="http://www.invil.org/search/html4/tour/tour_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "R"){
		f.action="http://www.invil.org/search/html4/travel/travel_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "C"){
		f.action="http://www.invil.org/search/html4/comm/comm_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "B"){
		f.action="http://www.invil.org/search/html4/info/info_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else if(search_option == "I"){
		f.action="http://www.invil.org/search/html4/image/image_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}else{
		f.action="http://www.invil.org/search/html4/total/total_search.jsp?village_code="+village_code+"&search_word="+search_word+'&query_word=%28'+search_word+'%29';
	}
	f.submit();
}


//17. ¸¶ÀÌÆäÀÌÁö(5Â÷) - 2006/10.18¼öÁ¤
function go_vilMypage(village_code, s_UserID, village_URL)
{

	if (s_UserID == '') {
		alert("·Î±×ÀÎÀ» ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		location.href="https://secure.invil.org/login_new/index_local.jsp?village_code="+village_code+"&first_page=1&return_url="+village_URL;

	} else {
		location.href="http://www.invil.org/mypage_new/index.jsp?village_code="+village_code;
	}
}


// 18. °Ë»ö ÆäÀÌÁö ¿¬°á(5Â÷)
	function go_vilSearchPage(village_code) {
		location.href=" http://www.invil.org/search/html4/total/total_search.jsp?village_code="+village_code;
	}
		
function ObjectWrite(id){
	document.writeln(id.text);
}		