var nowLocation = top.location.href;
len = nowLocation.split("/").length;

if(len > 3){
	if(nowLocation.split("/")[3]=="" || nowLocation.split("/")[3]=="index.html" || nowLocation.split("/")[3].substring(0,11) == "?sublocate="  );
	else 
		top.location.href = "/?sublocate="+ escape(nowLocation);
}

//Áñ°ÜÃ£±â Ãß°¡
function bookmark(){
window.external.AddFavorite('http://www.vaimi.com', '::: ¹ÙÀÌ¹Ì, ³»°¡ ¸¸µå´Â µðÀÚÀÎ¼ÒÇ°. :::')
}

//ÇÃ·¡½¬ ±×¸®±â
function flashDraw(objName,swfUrl,width,Height,bgColor,transparent) {
	if(transparent==null) transparent = false;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
	document.write(' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
	document.write(' width=' + width + ' height="'+ Height +'" name="' + objName + '" id="' + objName + '" align="middle">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="' + swfUrl + '" />');
	document.write('<param name="quality" value="high" />');
	if(transparent)
		document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+swfUrl+'" width="'+width+'" height="'+Height+'" quality=\"high\" wmode=\"transparent\"');
	document.write('pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\"></embed>');
	document.write('<param name="bgcolor" value="#'+bgColor+'" />');
	document.write('</object>');
}



function go_fn_TOPval(f_mname)
{
    var ff = document.searchTopForm;			
	ff.f_mname.value=f_mname 	
    ff.method='post';
	ff.submit(); 

}
function fn_find_Top(ff)
{   
    var ff = document.searchTopForm;   
    var fv = smTrim(ff.f_mname.value);	
	if( fv.length < 1 ) 	
	{ 
	  alert('°Ë»ö¾î¸¦ 1ÀÚ ÀÌ»ó ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
      ff.f_mname.focus();
      return false;	 	
	}		 
	
    ff.method='post';
	ff.submit(); 
	return;
}


function readbbs(stat,cate,tbl,id,grp)
{
    if(stat==2){ 
	     var theURL="../smstboard/read.php?cate=" + cate + "&mode=read&tbl=" + tbl + "&id=" + id ; 
         window.open(theURL,'','scrollbars=yes,resizable=no,copyhistory=no,width=650,height=500');	}  
	else { 
	     var theURL="../shop/home_bbs.php3?cate=" + cate + "&mode=read&tbl=" + tbl + "&id=" + id + "&grp="+grp ; 
         window.location.href=theURL;
	}
}

function view_goodsinfo(stat,gnum,target)
{  
  if(stat==2){ var theURL="/detail.php?gnum="+gnum; }  
	else { var theURL="/detail.php?gnum="+gnum; }
	
	window.location.href=theURL + ( target ? '#'+target:'' );

	top.hiddenMakingtool();
   
}

// ¹Ì´Ï¼¥ »óÇ°º¸±â ½ºÅ©¸³Æ® Ãß°¡ //
function view_goodsinfomini(stat,gnum,target,suid)
{
  if(stat==2){ var theURL="/mini_detail.php?gnum="+gnum+"&suid="+suid; }  
	else { var theURL="/mini_detail.php?gnum="+gnum+"&suid="+suid; }
	
	window.location.href=theURL + ( target ? '#'+target:'' );

	top.hiddenMakingtool();
   
}



function shop_goodsinfo(stat,gnum)
{
    var theURL="../shop/detail.php?mode=subview&gnum="+gnum;	
    window.location.href=theURL;
}



//Á¦Ç°¸¸µé±â ÀÓ½Ã ÇÔ¼ö
//³ªÁß¿¡¸µÅ© °É¶§ ÀÌÂÊÀ¸·Î
function open_create_product(designNum,productNum){
	if(!designNum) designNum = '';
	if(!productNum) productNum = '';
	top.showMakingtool(designNum,productNum);
	
	//location = '/makingtool/?designNum='+designNum +'&productNum='+productNum;
}

//08.11.18 : Ä¿½ºÅÒ ·Îµù

function open_custom_item(designNum,productNum){
	top.showCustomMakingtool(designNum,productNum);
}

//ÇÁ¸®¼¿¸µ °¡ÀÌµå
//³ªÁß¿¡¸µÅ© °É¶§ ÀÌÂÊÀ¸·Î
function open_free_guide(){
	window.open("/pop_freeselling.html","pop_freesell","width=560,height=430,status=no");
	
}


function number_format(num){
	var str = num+"";
	var len = num.length;
	if(len<=3) return str;
	
	var rstr = str.substring(0,len%3);
	for(var i=len%3;i<len;i+=3){
		rstr += ","+str.substring(i,i+3);
	}
	return rstr;
}

function toXML(requestResult) {
	var resultXML;
	var resultText = requestResult.responseText;
	
	try{
		var resultText = requestResult.responseText;
	  resultXML=new ActiveXObject("Microsoft.XMLDOM")
	resultXML.async="false";
	resultXML.loadXML(resultText);
	}
	catch(e) {
		var parser=new DOMParser();
		var resultText = requestResult.responseText;
		resultXML = parser.parseFromString(resultText, "text/xml");
	}
	/*
	catch(e) {
		resultXML = requestResult.responseXML;
	}*/

	return resultXML;
}


//¼¼·Î °¡¿îµ¥ Á¤·Ä

function vAlign() {
	objs = document.getElementsByTagName('DIV');
	for (var i = 0 ; i < objs.length ; i++ )
 	{
  if (objs[i].className == "vAlign")
   objs[i].style.marginTop = Math.floor(parseInt(objs[i].parentNode.offsetHeight - objs[i].offsetHeight) / 2)+"px";
 }
}
window.onload = vAlign;