  var vizooo = window.vizooo = function(){
    };
  vizooo.fn = vizooo.prototype = {
        version: "1.0.0",
        copyright: "expernet",
		debug:true,
		debugDiv:null,
		lastScrollY : 0,
        init: function(xml){
		   this.setDebug();
           this.scrollBanner();
		   this.widthNum =0;
		   if(this.recentTemplet == null){
			
				this.recentTemplet = jQuery("#recent li");
			
			}
			jQuery("#recent li").each(function(i){
					
					
					
						jQuery(this).remove();
					
					
					
				});
				
			jQuery("A").each(function(){
				
				if(jQuery(this).attr("target")=="_blank"){
					
					jQuery(this).find("img").click(function(){
						jQueryV.sendLog(jQuery(this).attr("src"));
						
					})
				}
			})
				//this.setRecent();
        },
		sendLog:function(t, stype){
			
					
			var quickExpr = /image+/;
			var match = quickExpr.exec( t );
			if(match)
				return false;
			t = encodeURIComponent( t );
			if(stype == "vizooosearch"){
				logClick(t, "urlvizooosearch"); 
				
			}else{
				
				jQuery("#vizoooLog").attr("src","http://log.vizooo.com/piwik/piwik.php?idsite=1&link="+t+"&rand=0.0634603346378882&redirect=0")
			}
				
			
						
		},
		sendSearchLog:function(t){
				var quickExpr = /image+/;
			var match = quickExpr.exec( t );
			if(match)
				return false;
			t = encodeURIComponent( "http://www.vizooo.com/textSearchResult.php?qt="+t );
			jQuery("#vizoooLog").attr("src","http://log.vizooo.com/piwik/piwik.php?idsite=1&url="+t+"&urlref="+t+"&rand=0.0634603346378882&pdf=0&qt=0&realp=0&wma=0&dir=0&fla=0&java=1&gears=0&ag=0&action_name=")
						
		},
		setDebug:function(){
		
			this.debugDiv = jQuery("<DIV></DIV>");
			jQuery("BODY").prepend(this.debugDiv);
		
		},
		log:function(val){
		
			this.debugDiv.html(val);
		
		},
		addLog:function(val){
		
			this.debugDiv.html(this.debugDiv.html()+"<br>"+val);
		
		},
		gnbAllOpen:function(e) {
		  e.style.display = "block";
		},
		gnbAllClose:function(e) {
		   e.style.display = "none";
		},
		addZzim:function(code){
			
			jQuery.cookie("code",jQuery.cookie("code")+"::"+code);
			
			var zzimCookie = jQuery.cookie("code");
			
			var tmpZzim =zzimCookie.split("::");
			var ZzimCode = "";
			for(i=0;i<=tmpZzim.length;i++){
				
				ZzimCode += tmpZzim[i];
				
			}
			jQuery("#zzim").html(tmpZzim.length);
			
		},
		getRecent:function(){
			
			return jQuery.cookie("code");
			
		},
		addRecent:function(code){
			
			
			
			var zzimCookie = jQuery.cookie("code");
			var tmpZzim = "";
			if (zzimCookie != null) {
				var tmpZzim = zzimCookie.split("::");
			}
			var ZzimCode = "";
			var sameCode = 0;
			for(i=0;i<=tmpZzim.length;i++){
				
				if(code == tmpZzim[i] ){
					
					sameCode++;
					
				}
				
			}
			var tmpC = jQuery.cookie("code");
			if(tmpC == "null")
				tmpC = "";
			if(sameCode < 1)
				jQuery.cookie("code",jQuery.cookie("code")+"::"+code);
			zzimCookie = jQuery.cookie("code")
			tmpZzim =zzimCookie.split("::");
			jQuery("#recentCnt").html("("+tmpZzim.length+")");
			
		},
		setRecent:function(){
			
			
			var zzimCookie = jQuery.cookie("code");
			if(zzimCookie != null){
			var tmpZzim =zzimCookie.split("::");
			var ZzimCode = "";
			for(i=0;i<=tmpZzim.length;i++){
				if( tmpZzim[i] != "null" && typeof tmpZzim[i] != "undefined")
				ZzimCode += tmpZzim[i];
				if(i<4){
					this.setRecentView(tmpZzim[i]);
					
				}
					
					
			}
			jQuery("#recentCnt").html("("+tmpZzim.length+")");
			}else{
				
				jQuery("#recentCnt").html("(0)");
				
			}
		},
        setRecentView: function(code){
           
			
			
				
				var recentTpl = this.recentTemplet;
				
				
				var i=0			
           			
					jQuery.get("/json/goods2.php?idx="+code, {'recentTpl':recentTpl}, function(t){
               	 		
						if(t.goodsView.length>1){
						var obj = jQuery(recentTpl).clone();
							
						var imgName = t.goodsView[1].imgName
						var tmp = imgName.split(".");
						imgName = tmp[0]+"_1."+tmp[1];
						var oImg = t.goodsView[1]
						jQuery(obj).find("img").wrap("<a href='"+t.goodsView[1].pgUrl+"' target='_blank'></a>");
						jQuery(obj).find("img").attr("src", t.goodsView[1].imgPath+imgName).css("width","40").css("height",40);
						
						jQuery("#recent").append(obj);
						
						}
        			}, "json");
					
				
		   
		    
			
            
        },
		setRecentList: function(obj){
           
			var zzimCookie = jQuery.cookie("code");
			var ZzimCode = "";
			if(zzimCookie != null){
			var tmpZzim =zzimCookie.split("::");
			
			for(i=0;i<=tmpZzim.length;i++){
				if( tmpZzim[i] != "null" && typeof tmpZzim[i] != "undefined")
					ZzimCode += tmpZzim[i]+",";
				
			}
			
			}		
			
				ZzimCode =ZzimCode.substring(0,ZzimCode.length-1)
				var recentTpl = this.recentTemplet;
				
				
				var i=0			
           			
					jQuery.get("/json/goods2.php?idx="+ZzimCode, {'obj':obj}, function(t){
               	 		
						for(i=1;i<=t.goodsView.length;i++){
						var imgName = t.goodsView[i].imgName
						var tmp = imgName.split(".");
						imgName = tmp[0]+"_1."+tmp[1];
						var tmpObj = '<tr>';
							tmpObj += '			<td class="txtCenter"><input type="checkbox"/></td>';
							tmpObj += '			<td>';
							tmpObj += '				<img class="productPic" src="'+t.goodsView[i].imgPath+imgName+'" alt="" title=""/>';
							tmpObj += '			</td>';
							tmpObj += '			<td class="vATop">';
							tmpObj += '				<dl>';
							tmpObj += '					<dt><img src="images/myVizooo/product_name.gif" alt="»óÇ°¸í" title="»óÇ°¸í"/></dt>';
							tmpObj += '					<dd class="productName">'+t.goodsView[i].pName+'</dd>';
							tmpObj += '					<dt><img src="images/myVizooo/price.gif" alt="ÆÇ¸Å°¡" title="ÆÇ¸Å°¡"/></dt>';
							tmpObj += '					<dd class="productPrice">'+t.goodsView[i].price+'¿ø</dd>';
							tmpObj += '					<dt><img src="images/myVizooo/brand.gif" alt="ºê·£µå" title="ºê·£µå"/></dt>';
							tmpObj += '					<dd class="brandShop">'+t.goodsView[i].brand+'</dd>';
							tmpObj += '					<dt><img src="images/myVizooo/shop.gif" alt="¼¥Á¤º¸" title="¼¥Á¤º¸"/></dt>';
							tmpObj += '					<dd class="brandShop">'+t.goodsView[i].shopName+'</dd>';
							tmpObj += '					<dt><img src="images/myVizooo/material.gif" alt="ÀçÁú" title="ÀçÁú"/></dt>';
							tmpObj += '					<dd class="productMaterial">';
							
							for (j = 0; j < 5; j++) {
								
								if(typeof t.goodsView[i]["MATCODE"+j] != "undefined"){
									tmpObj += '						<img src="/images/mat_icon/'+t.goodsView[i]["MATCODE"+j]+'.gif" alt="" title=""/>';
									tmpObj += '						<span>'+t.goodsView[i]["MATNAME"+j]+'</span>';
								}
								
							}
							
							tmpObj += '					</dd>';
							tmpObj += '				</dl>';
							tmpObj += '			</td>';
							tmpObj += '			<td>';
							tmpObj += '				<div>';
							tmpObj += '					<a href="'+t.goodsView[i].pgUrl+'" target="_blank"><img class="mb6" src="images/myVizooo/dtail_view_btn.gif" alt="" title=""/></a>';
							tmpObj += '					<a href="/search.php?idx='+t.goodsView[i].IDX+'"><img class="mb6" src="images/myVizooo/vizoo_search_btn.gif" alt="" title=""/></a>';
							tmpObj += '					<img src="images/myVizooo/delete_btn.gif" alt="" title=""/>';
							tmpObj += '				</div>';
							tmpObj += '			</td>';
			
							tmpObj += '		</tr>	';
						
					
						
						jQuery(obj).append(tmpObj);
						
						}
        			}, "json");
					
				
		   
		    
			
            
        },
		getZzim:function(){
			
			return jQuery.cookie("code");
			
		},
		scrollBanner:function(){
			try {
				var diffY = document.documentElement.scrollTop;
				var lastScrollY = this.lastScrollY;
				jQuery(window).scroll(function(){
					var diffTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
					
					if (diffY != lastScrollY) {
						
						percent = .10 * (diffY - lastScrollY);
						if (percent > 0) 
							percent = Math.ceil(percent);
						else 
							percent = Math.floor(percent);
						
						diffTop = parseInt(jQuery(".scroll").offset().top) + percent;
						
						jQueryV.lastScrollY = lastScrollY + percent;
						
					}
					
					jQuery(".scroll").stop();
					
					jQuery(".scroll").animate({
						"top": diffTop
					}, "500px");
					
				},[lastScrollY]);
				
			}catch(e){
				
				alert(e.message)
				
			}
		},
		makePagging:function(pg,lc,tc, obj,prevImg,nextImg, pageNo){
			jQuery(".paging3").empty();
			var page = this.page || 0;
			var	pageTemp = (pg-1)%10;
			totalpage = Math.ceil(tc / lc);

		    var	startPageNo = (pg-1) - pageTemp +1;
		    pageTemp = (pg-1)%lc;
		    pageTemp = 10 - pageTemp;
		   // var	endPageNo = (pg-1) +pageTemp;
		    var	endPageNo = startPageNo+9;
			 if(endPageNo >= totalpage)
      		endPageNo = totalpage;
    

			
			var prevImg = prevImg || "<<";
			var nextImg = nextImg || ">>";
			obj.append(prevImg);
			for(i=startPageNo;i<=endPageNo;i++){
				
				var pageNo = jQuery(pageNo).clone();
				if (pg == i) {
					pageNo.html("<b>"+i+"</b>");
				}else{
					pageNo.html(i);
					
				}
				pageNo.attr("no",i);
				pageNo.css("cursor","pointer");
				pageNo.click(function(){jQueryV.goPage([0,jQuery(this).attr("no")],jQueryV.ajaxAppList)});
				obj.append(pageNo);
			}
			obj.append(nextImg);
		},
		makePagging3:function(pg,lc,tc, obj,prevImg,nextImg, pageNo){
			jQuery(".paging2").find("A").remove();
			var page = this.page || 0;
			var	pageTemp = (pg-1)%10;
			totalpage = Math.ceil(tc / lc);

		    var	startPageNo = (pg-1) - pageTemp +1;
		    pageTemp = (pg-1)%lc;
		    pageTemp = 10 - pageTemp;
		   // var	endPageNo = (pg-1) +pageTemp;
		    var	endPageNo = startPageNo+9;
			 if(endPageNo >= totalpage)
      		endPageNo = totalpage;
    

			
			var prevImg = prevImg || "<<";
			var nextImg = nextImg || ">>";
			
			
			for(i=startPageNo;i<=endPageNo;i++){
				
				var pageNo = jQuery(pageNo).clone();
				if (pg == i) {
					jQuery(pageNo.find("span")[0]).attr("className", "bgLeft3");
					jQuery(pageNo.find("span")[1]).attr("className", "pages3");
				}else{
					jQuery(pageNo.find("span")[0]).attr("className", "bgLeft");
					jQuery(pageNo.find("span")[1]).attr("className", "pages");
					
				}
				jQuery(pageNo.find("span")[1]).text(i);
				pageNo.attr("no",i);
				
				pageNo.click(function(){jQueryV.goPage([0,jQuery(this).attr("no")],jQueryV.ajaxAppList);return false;});
				jQuery(obj).find("#next").before(pageNo);
			}
			
		},
		nextPage:function(){
			
			if(this.totalCnt*1+6 > 6*(this.pg+1))
				this.goPage([0,this.pg+1],this.ajaxAppList);
			
		},
		nextPage2:function(){
			this.pg = (this.pg + 10) - (this.pg + 10)%10;
			if(this.totalCnt > 6*(this.pg+1)){
				
				this.goPage([0,this.pg+1],this.ajaxAppList);
				
			}else{
				
				this.pg = Math.ceil(this.totalCnt/6);
				this.goPage([0,this.pg],this.ajaxAppList);
				
			}
				
			
		},
		prevPage:function(){
			
			if(0 < 6*(this.pg-1))
				this.goPage([0,this.pg-1],this.ajaxAppList);
			
		},
		prevPage2:function(){
			this.pg = (this.pg - 10) - (this.pg + 10)%10;
			if(0 < 6*(this.pg-1)){
				
				this.goPage([0,this.pg-1],this.ajaxAppList);
				
			}else{
				
				this.goPage([0,1],this.ajaxAppList);
				
			}
				
			
		},
		firstPage:function(){
			
			
			
		},
		lastPage:function(){
			
			
		},
		goPage:function(pg,callback){
			
			this.pg = pg[1];
			callback.apply(this,pg);
			this.makePagging3(this.pg, this.lc,this.totalCnt, this.pageObj,this.prevImg,this.nextImg,this.pageNo);
		},
		preview:function(o){
			var doc = document.documentElement, body = document.body;
      var preview_h = 200;
			alert(jQuery("body").attr("offsetHeight"))
			jQuery("#previewBlock").css("height",jQuery(".wrap").attr("offsetHeight"));
			jQuery("#previewBlock").show();
			this.alphaScale = setInterval("jQueryV.viewIndex()", 1);
			jQuery("#preview > div > dl > dt > img").attr("src",o.oImgPath+o.imgName);
			jQuery("#preview .title2").text(o.pName);
			jQuery("#preview .price2 span").text(o.price + '¿ø');
      if (o.DELIV == 0) 
        jQuery("#preview .delivery2 span").text('¹«·á');
      else
        jQuery("#preview .delivery2 span").text(o.DELIV + '¿ø');
			jQuery("#preview .brand2 span").text(o.brand);
			jQuery("#preview .shoppingmall2 span").text(o.shopName);
      if (o.detail_view == '') {
        jQuery(".prevInfo2").hide();
      } else {
        jQuery("#preview .detail_view").attr("src", o.detail_view);
        var preview_h = 10;
      }
			var idx = o.IDX;
			var pgUrl = o.pgUrl;
			jQuery("#preview .btns2 .zzim").click(function(){zzim(idx);},[idx]);
			jQuery("#preview .btns2 .buy").click(function(){window.open(pgUrl)},[pgUrl]); 
						
			jQuery("#preview .material2 span").remove();
			jQuery("#preview .material2 img").each(function(i){
				if(i!=0)
					jQuery(this).remove()
			});
			for (j = 0; j < 5; j++) {
					Obj = "";
				if(typeof o["MATCODE"+j] != "undefined" && o["MATCODE"+j] != ""){
					Obj = '<img src="/images/mat_icon/'+o["MATCODE"+j]+'.gif" alt="" title=""/><span>&nbsp;&nbsp;'+o["MATNAME"+j]+'&nbsp;&nbsp;</span>';
          jQuery("#preview .material2").append(Obj);
				}
			}
			
			jQuery("#preview").css("top", preview_h+(doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0))
			return false;
		},

		ajaxPreview:function(code){
			jQueryV.sendLog("http://vizooo.com/search.php?idx="+code);
			jQuery.get("/json/preview.php?idx="+code, {}, function(t){
        var oImg = t.goodsView[1]
        jQueryV.preview(oImg);
      }, "json");
		},
					
		clrPreview:function(){
			jQuery("#previewBlock").css("height",jQuery("body").attr("offsetHeight"));
			this.alphaScale = setInterval("jQueryV.clearIndex()", 1);

			
		},
		viewIndex:function(){
			
	
	 	this.widthNum += 50;
	 	if(this.widthNum <= 50){
			
			jQuery("#previewBlock").css("filter","alpha(opacity:"+this.widthNum+")");
			jQuery("#previewBlock").css("opacity",this.widthNum/100);
			
			

			}else{
				clearInterval(jQueryV.alphaScale); 
				jQuery("#preview").show();
			}
		},
		 clearIndex:function(){
		 	this.widthNum -= 50;
		 	if(this.widthNum >= 0){
				
				jQuery("#previewBlock").css("filter","alpha(opacity:"+this.widthNum+")");
			 	
			}else{
			jQuery("#previewBlock").css("filter","alpha(opacity:0)");
			clearInterval(jQueryV.alphaScale); 
			jQuery("#preview").hide();
			jQuery("#previewBlock").hide();
			}
		},

		viewPop:function(){
			jQuery("#firstBlock").css("height", jQuery("body").attr("offsetHeight"));
			jQuery("#firstBlock").css("filter","alpha(opacity:50)");
			jQuery("#firstBlock").css("opacity", "0.5");
			jQuery("#firstBlock").show();
			jQuery("#first").show();
		},
		clearPop:function(){
			jQuery("#firstBlock").css("filter","alpha(opacity:0)");
			jQuery("#firstBlock").hide();
			jQuery("#first").hide();
		},
		 setStyle: function(style,idx){
			
          
			if(this.styleTpl== null){
				this.styleTpl = jQuery("#"+style+" ul li")
			}
			jQuery("#"+style+" ul li").remove();			
			var tpl = this.styleTpl;
				
				
				var i=0;
				jQuery("#"+style+" h3").text(eventList[idx]['title']);				
           		
					
						t = eventList[idx]['data'][0];
						
						
						for(i=1;i<t.goodsView.length;i++){
						var obj = jQuery(tpl).clone();
							if(i == 1)
								jQuery(obj).addClass("center");
						var imgName = t.goodsView[i].imgName
						var tmp = imgName.split(".");
						imgName = tmp[0]+"_1."+tmp[1];
						var oImg = t.goodsView[i]
						jQuery(obj).find("dl").find("dt").find("img").wrap("<a href='search.php?idx="+t.goodsView[i].IDX+"'></a>");
						jQuery(obj).find("dl").find("dt").find("img").attr("src", t.goodsView[i].imgPath+imgName);
						jQuery(jQuery(obj).find(".first").find("img")[0]).click(function(){jQueryV.preview(oImg);},[oImg]).css("cursor","pointer");
						jQuery(jQuery(obj).find(".first").find("img")[1]).click(function(){zzim(oImg.IDX);},[oImg]).css("cursor","pointer");
						jQuery(obj).find(".second").text(t.goodsView[i].pName.trim());
						jQuery(obj).find(".third").text(t.goodsView[i].price.fc()+"¿ø");
						jQuery(obj).find(".forth").text(t.goodsView[i].shopName.trim().cut(14));
						jQuery(obj).find(".fifth").find("img").wrap("<a href='"+t.goodsView[i].pgUrl+"' target='_blank'></a>");
						if(oImg.COUPO != "")
							jQuery(obj).find(".first").append('<img src="images/category/coupon.gif" alt="ÄíÆù" title="ÄíÆù"/>');
						
						if(oImg.DELIV == 0)
							jQuery(obj).find(".first").append('<img src="images/category/interest.gif" alt="¹«ÀÌÀÚ" title="¹«ÀÌÀÚ"/>');
						
						if(oImg.PCARD != "0")
							jQuery(obj).find(".first").append('<img src="images/category/free.gif" alt="¹«·á¹è¼Û" title="¹«·á¹è¼Û"/>');
						 jQuery(obj).show();
						jQuery("#"+style+" ul").append(obj);
						
						}
        			
					
			
		   
           
            
        }
	}	

	window.jQueryV = vizooo.fn;
    
     
    
	jQuery(document).ready(function(){
		jQueryV.init();
	})
	
	String.prototype.trim = function() {
	       return this.replace(/^\s+|\s+jQuery/g,"");
	}
	  
	String.prototype.ltrim = function() {
	       return this.replace(/^\s+/,"");   
	}
	   
	String.prototype.rtrim = function() {
	       return this.replace(/\s+jQuery/,"");   
	}
	String.prototype.cut = function(len) {        
		 var str = String(this);         
		 var s = 0;         
		 for (var i=0; i<str.length; i++) {                 
		 	s += (str.charCodeAt(i) > 128) ? 2 : 1;                 
			if (s > len) return str.substring(0,i) + "...";         
			}        
			 return str;  
	}   
	String.prototype.cut2 = function(len) {        
		 var str = String(this);         
		 var s = 0;         
		 for (var i=0; i<str.length; i++) {                 
		 	s += (str.charCodeAt(i) > 128) ? 2 : 1;                 
			if (s > len) return str.substring(0,i);         
			}        
			 return str;  
	}   
	String.prototype.bytes = function() {         
		var str = this;         
		var s = 0;         
		for (var i=0; i<str.length; i++) 
			s += (str.charCodeAt(i) > 128) ? 2 : 1;         
			return s;  
		}  
	String.prototype.fc = function () { 
    return number_format(this); 
}   
function number_format(numstr) {
  var numstr = String(numstr);
  var re0 = /(\d+)(\d{3})(jQuery|\..*)/;
  if (re0.test(numstr))
    return numstr.replace(
      re0,
      function(str,p1,p2,p3) { return number_format(p1) + "," + p2 + p3; }
    );
  else
    return numstr;
}


function menuOver(obj,idx){
				
	
	jQuery("#gnbMenu").find("img").each(function(){jQuery(this).attr("src",jQuery(this).attr("src").replace("_on",""))});
	var tmpSrc = jQuery(obj).attr("src").split(".")
	jQuery(obj).attr("src", tmpSrc[0]+"_on.gif");
	
	
	jQuery("#subMenu0"+idx).show();
				
}
var dpl=0;
var menuIdx=0;
function menuOut( e,obj,idx){ 
				
				
				menuIdx = idx;
				var ev = e || window.event;
				var evnt = jQuery.event.fix(ev);

				var tempX = evnt.clientX ;
				var tempY = evnt.pageY ;
				
				var x = jQuery(obj).offset().left;
				var y = jQuery(obj).offset().top;
				
				if((y + obj.offsetHeight) <= (tempY+5 ))
				{	
					setTimeout(function(){
						if (dpl == 0) {
							
							jQuery(jQuery("#gnbMenu img")[menuIdx]).attr("src",jQuery(jQuery("#gnbMenu img")[menuIdx]).attr("src").replace("_on",""));			
							jQuery("#subMenu0" + idx).hide();
						}
					},1,[obj]);					
				}else{
					jQuery(obj).attr("src",jQuery(obj).attr("src").replace("_on",""));			
					jQuery("#subMenu0" + idx).hide();
					
				}	
					
					
				
			
				
				
}
function menuSubOver(obj,idx){
		
	dpl=idx;
				
}
var dpl=0;
function menuSubOut(obj,idx){ 
	
	jQuery(jQuery("#gnbMenu img")[menuIdx]).attr("src",jQuery(jQuery("#gnbMenu img")[menuIdx]).attr("src").replace("_on",""));			
	dpl=idx;
	jQuery(obj).hide();			
}

/* favorite */
function addfavorites() {
  var url = "http://www.vizooo.com/?fv=t";
  var title = "ÆÐ¼Ç°Ë»ö VIZOOO ¼îÇÎÀÌ ÇØ¹æ µÇ´Â ³¯";
  if (document.all)
    window.external.AddFavorite(url, title);
  else
    window.sidebar.addPanel(title, url,"");
}

// by ymwon

function hidelayer(layer) {
  jQuery('#' + layer).hide();
}

function showlayer(layer) {
  jQuery('#' + layer).show();
}

function zzim(idx) {
	window.open('/zzim.php?idx=' + idx, '', 'width=277,height=209');
}

function go_zzim() {
  opener.location.href = '/zzimlist.php';
  close_zzim();
}

function close_zzim() {
	window.close();
}

function vs(idx){
  location.href = "/search.php?idx=" + idx;
}

function getCookie(name) {
  var found = false;
  var start, end;
  var i = 0;

  while (i <= document.cookie.length) {
    start = i; 
    end = start + name.length; 
    if (document.cookie.substring(start, end) == name) {
      found = true;
      break;
    }
    i++;
  }

  if (found == true) {
    start = end + 1;
    end = document.cookie.indexOf(";", start);
    if (end < start)
      end = document.cookie.length;
    return document.cookie.substring(start, end);
  }
  return "";
}

function setCookie(name, value, expiredays) {
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  var res = document.cookie=name+"="+escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  return res;
}


function hide_first() {
  setCookie("first", "no", 10000);
  jQueryV.clearPop();
}

function get_recent() {
  jQuery.ajax({
    type: "POST",
    url: "/recentinfo.php",
    success: function(msg) {
      eval(msg);
      recent_print();
    }
  });
}

var current_quick = 0;
function recent_print() {
  if (quick.zzim_cnt == 0) jQuery('#zzim_cnt').html('0');
  else jQuery('#zzim_cnt').html(quick.zzim_cnt);
  if (quick.recent_cnt == 0) jQuery('#recent_cnt').html('0');
  else jQuery('#recent_cnt').html(quick.recent_cnt);
  var txt = '';
  var i = current_quick * 2;
  var length = ((current_quick * 2) + ((quick.recent_cnt > 4) ? 10 : quick.recent_cnt * 2));
  txt += "<ul id='recent' class='recentImgList'>";
  while (i < length) {
    txt += "<li><img src='" + quick.list[i+1] + "' onclick='vs(" + quick.list[i] + ")' width='40' height='40' alt='' title='' style='cursor: pointer'/></li>";
    i += 2;
  }
  txt += "</ul>";
  jQuery('#recent_info').html(txt);
}

function recent_up() {
  if (current_quick > 0 && quick.recent_cnt > 5) {
    current_quick -= 1;
    recent_print();
  }
}

function recent_down() {
  if (quick.recent_cnt > 5 && current_quick < (quick.recent_cnt - 5)) {
    current_quick += 1;
    recent_print();
  }
}

function flash(swf,w,h){
 html = '';
 html = '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'" height="'+h+'">';
 html += '<param name="movie" value="'+swf+'">';
 html += '<param name="quality" value="high">';
 html += '<param name="bgcolor" value="#ffffff">';
 html += '<param name="menu" value="false">';
 html += '<param name="wmode" value="transparent">';
 html += '<embed src="'+swf+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
 html += '<\/object>';
 document.write(html);
}


function bluring(){
	if(event.srcElement.tagName=="A" || event.srcElement.tagName=="button"){
		document.body.focus();
	}
}


function autoblur() {
        if(event.srcElement.tagName == "A") document.body.focus();
}


jQuery(document).ready(function(){
	document.onfocusin=bluring;
	document.onfocusin = autoblur;
	
	jQuery("A[target=_blank]").each(function(){
		
		var src = this.href.match(/^http:(.*?)[.co.kr|.com][\/]+/gi);
		this.onclick = function(){
			
			pageTracker._trackPageview('/Links/'+src);
			
		}
	
	})
	
	
})

