/* swfobject.js */;if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
/* clipboard.js */;function CopyText(a){copy(document.getElementById(a).value)}function copy(a){if(window.clipboardData){window.clipboardData.setData("Text",a)}else{var b='flashcopier';if(!document.getElementById(b)){var c=document.createElement('div');c.id=b;document.body.appendChild(c)}document.getElementById(b).innerHTML='';var d='<embed src="/jscript/_clipboard.swf" FlashVars="clipboard='+escape(a)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';document.getElementById(b).innerHTML=d}}function copyToClipboard(a){if(window.clipboardData){alert("ie");window.clipboardData.setData("Text",a)}else if(window.netscape){netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');var b=Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);if(!b)return;alert("mozilla");var c=Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);if(!c)return;c.addDataFlavor('text/unicode');var d=new Object();var e=new Object();var d=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);var f=a;d.data=f;c.setTransferData("text/unicode",d,f.length*2);var g=Components.interfaces.nsIClipboard;if(!b)return false;b.setData(c,null,g.kGlobalClipboard)}alert("Following info was copied to your clipboard:\n\n"+a);return false}
/* Common JS functions object */
var SMUS_GO = new Object();
//truncate string without cut any word
SMUS_GO.truncate = function(str, len, ext){
    var l = len||40;
    var e = ext||' ...';
    var t = str.substr(0, l);
    if(t.substr(t.length-2)==' ' || str.substr(l,1)==' ') return t+e;
    var spos = t.lastIndexOf(' ');
    return t.substr(0, spos)+e;
};
//msg box close action
SMUS_GO.closeMsgBox = function(o){
    $(o).parents('div.addokboxcontent , div.addfailboxcontent').fadeOut('fast',function(){$(this).parent().remove();});
    return false;
};

$(document).ready(function (){

// image preload
var fileServer = fileServer || '';
var preloadImg = ['images/v5/header_popup_bg.gif','images/v5/header_bg.gif',
                  'images/v5/header_icons.gif','images/v5/hp_icons.gif',
                  'images/v5/product_icons.gif','images/v5/content_icons.gif'];
for (var i=0;i<preloadImg.length;i++) {
    var image = new Image();
    image.src = fileServer+preloadImg[i];
}

// flash carousel
var fpIndex = 4;
var fpTimer = fpLog = null;
var fpHeartbeat = 8;
var jfpSelectLi = $('div.fpselect > ul > li');
var fpFlash = 'fpSWF';

var setTimer = function(t){
    window.clearTimeout(fpTimer);window.clearTimeout(fpLog);
    fpTimer = window.setTimeout(function(){
        fpIndex++;
        if ((fpIndex) > jfpSelectLi.length-1) fpIndex = 0;
        jfpSelectLi.eq(fpIndex).click();
    }, t*1000);
    
    //jfpProgress.css({'width':'0%','height':'7px','background-color':'green'}).attr('count','').html('&nbsp;');
    fpLog = window.setInterval(function(){
        //jfpProgress.animate({'width':parseInt((jfpProgress.attr('count').length+1)*100/(t-1))+'%'}).attr('count',jfpProgress.attr('count')+'*');
    },1000);
};

var so = new SWFObject("http://images.smarter.com/swf/fpCarousel.swf", fpFlash+"obj", "520", "292", "8", "#ffffff"); 
so.addParam("quality", "normal"); 
so.addParam("scale", "noscale"); 
so.addParam("menu", "False"); 
so.addParam("salign", "lt"); 
so.addParam("wmode", "transparent"); 
so.addParam("allowScriptAccess", "always");
$('#'+fpFlash).mouseover(function(){
  window.clearTimeout(fpTimer);
})
.mouseout(function(){
  setTimer(fpHeartbeat);
})
.html('');
var imageRe = /^\s*<ImagePath><!\[CDATA\[(.*)\]\]><\/ImagePath>$/gm;

jfpSelectLi.each(function(i){
    var dp = Math.ceil((new Date()).getTime()/86400);
    var url = "/async_fpxml.php?d="+dp+"&c="+i;
    window.setTimeout(function(){
        jQuery.get(url, '', function(data, textStatus){
            var match = data.match(imageRe);
            for (x in match) {
                if (x+0!=x) continue;   // skip non-number indexs, fix ie6 error report
                var temp = match[x].replace(/\s*/g,'');
                var image = new Image();
                image.src = temp.substring(20,temp.length-15);
            }
        }, 'text');
    }, Math.pow(Math.abs(fpIndex-i),2)*1000);
    $(this).click(function(){
        so.addParam("flashVars", 'xmlprovider='+encodeURIComponent(url));
        so.write(fpFlash);
        jfpSelectLi.find('a').removeClass('selected').eq(i).addClass('selected').blur();
        fpIndex = i;
        setTimer(fpHeartbeat);
        return false;
    });
});
jfpSelectLi.eq(fpIndex).click(); // init featured product list

// blog, video, coupon box action
$('div.tabbox > ul > li > a').click(function(){
    if ($(this).hasClass('selected')) return false;
    var index = $(this).parent().attr('index');
    $(this).parents('ul').find('li > a.selected').removeClass('selected');
    $(this).addClass('selected').blur();
    $(this).parents('div.tabbox')
    .nextAll('div.videobox , div.blogbox , div.hotcouponsbox').hide();
    var obj = $(this).parents('div.tabbox')
    .nextAll('div.videobox:eq('+index+') , div.blogbox:eq('+index+') , div.hotcouponsbox:eq('+index+')').show();
    blogImgResize(obj);
    return false;
});

var blogImgResize = function(o){
o.find('div.blogimg > a > img').each(function(){
	    var img = $(this);
	    var maxheight = 180;
	    var maxwidth = 180;
	    if(img.height() >= maxheight && img.width() >= maxwidth) {
	        if(img.width() / img.height() >= maxwidth / maxheight) img.width(maxheight);
	        else img.height(maxwidth);
	    }else{
	        if(img.height() >= maxheight) img.height(maxwidth);
	        if(img.width() >= maxwidth) img.width(maxheight);
	    }
	    return true;    
});};
blogImgResize($('div.blogbox:eq(0)'));

//side bar
$('div.sidebar > ul > li:not(.quicklinks)').mouseover(function(){
    var over = 'over';
    if ($(this).hasClass('special')) over += ' specialover';
    if ($(this).hasClass('holiday')) over += ' holidayover';
    $(this).addClass(over).find('div.catelist').show();
}).mouseout(function(){
    $(this).removeClass('over')
           .removeClass('specialover')
           .removeClass('holidayover')
           .find('div.catelist').hide();
});
$('div.sidebar > ul > li.quicklinkssub').mouseover(function(){
	$(this).addClass('over').find('div.catelist').show();
}).mouseout(function(){
	$(this).removeClass('over').find('div.catelist').hide();
});

//whats hot, all categories --- these codes will be changed later -alix
var whTimer = null;
$('#topinfo > a.hot').nextAll('div.hotbox').andSelf().mouseover(function(){
    window.clearTimeout(whTimer);
    $(this).addClass('over').nextAll('div.hotbox').show()
}).mouseout(function(){
    var hot = $('#topinfo > a.hot');
    whTimer = window.setTimeout(function(){
    	hot.removeClass('over').nextAll('div.hotbox').hide();
    },80);
});

var acTimer = null;
$('#header > div.CBS > ul > li:eq(0) , div.Categories').mouseover(function(){
    window.clearTimeout(acTimer);
    $(this).addClass('over');
    $('div.Categories').filter('div.'+$(this).children('a').html()).html(tcHtml).show();
}).mouseout(function(){
    var allcat = $('#header > div.CBS > ul > li:eq(0)');
    acTimer = window.setTimeout(function(){
		allcat.removeClass('over');
		$('div.Categories').filter('div.'+allcat.children('a').html()).hide();
    },80);
}).find('a:first').click(function(){
	return false;
});

var bcTimer = null;
$('#header > div.CBS > ul > li:eq(1) , div.Brands').mouseover(function(){
    window.clearTimeout(bcTimer);
    $(this).addClass('over');
    $('div.Brands').filter('div.'+$(this).children('a').html()).html(tbHtml).show();
}).mouseout(function(){
    var allcat = $('#header > div.CBS > ul > li:eq(1)');
    bcTimer = window.setTimeout(function(){
		allcat.removeClass('over');
		$('div.Brands').filter('div.'+allcat.children('a').html()).hide();
    },80);
});

var ccTimer = null;
$('#header > div.CBS > ul > li:eq(2) , div.Stores').mouseover(function(){
    window.clearTimeout(ccTimer);
    $(this).addClass('over');
    $('div.Stores').filter('div.'+$(this).children('a').html()).html(tsHtml).show();
}).mouseout(function(){
    var allcat = $('#header > div.CBS > ul > li:eq(2)');
    ccTimer = window.setTimeout(function(){
			    allcat.removeClass('over');
			    $('div.Stores').filter('div.'+allcat.children('a').html()).hide();
              },80);
});

//search box suggestion
$('div.search :text[name="qq"]').val('enter keyword')
.focus(function(){
	if($(this).val()=='enter keyword') $(this).val('').addClass('txtonfocus');
})
.blur(function(){
    window.setTimeout(function(){$('div.searchsuggestion').hide();},250);
})
.keyup(function(event){
    var isChar = /\w/.test(String.fromCharCode(event.keyCode));
    if (!isChar) {
        var idx = $('div.searchsuggestion li:not(.tit)').index($('div.searchsuggestion li.over'));
        var l = $('div.searchsuggestion li:not(.tit)').length;
        switch(event.keyCode){
            case 27://ESC
                return $('div.searchsuggestion').hide();
            break;
            case 38://up
                $('div.searchsuggestion').show().find('li').removeClass('over');
                if(idx<1) idx = l;
                var val = $('div.searchsuggestion li:eq('+idx+')').addClass('over').attr('data');
                if(val) $('div.search :text[name="qq"]').val(val);
                return;
            break;
            case 40://down
                $('div.searchsuggestion').show().find('li').removeClass('over');
                if(idx==(l-1)) idx=-1;
                var val = $('div.searchsuggestion li:eq('+(idx+2)+')').addClass('over').attr('data');
                if(val) $('div.search :text[name="qq"]').val(val);
                return;
            break;
        }
    }
	var k = $.trim($(this).val());
	var sug = $('div.searchsuggestion');
	if(k.length<1) return false;
	$.get('/async_suggest.php','id='+k,function(d,s){
		if(s!='success') return sug.html('').hide();
		var allWords = new Array();
			$(d).find('pname').each(function(){
			allWords.push($(this).text());
		});
		if(!allWords || allWords.length==0) return sug.html('').hide();
		//console.log(allWords);
		var sugHtml = "<ul><li class=\"tit\">search suggestions</li>";
		for(var i=0;i<allWords.length;i++){
		  var val = allWords[i];
		  if(val.indexOf(k)==0) val = '<b>'+k+'</b>'+val.substring(k.length);
		  sugHtml += "<li data=\""+allWords[i]+"\">"+val+"</li>";
		}
		sugHtml += "</ul>";
		return sug.html(sugHtml).show()
		.find('li:not(.tit)').css('cursor','pointer')
		.mouseover(function(){
		    $(this).addClass('over').siblings('.over').removeClass('over');
		})
		.mouseout(function(){
            $(this).removeClass('over');
        })
        .click(function(){
            //console.log($(this).html());
            $('div.search :text[name="qq"]').val($(this).attr('data'))
            .next('input.but').click();
        });
	},'xml');
}).next('input.but').click(function(){
	var k = $.trim($(this).blur().prev('input.txt').val());
	if(k==''||k=='enter keyword') return false;
});

$("div.colr > div.imgbox > a > img").mouseover(function(){
    $(this).parent().siblings('a:first').find('img[overlay]').show();
}).mouseout(function(){
    var rel = $(this).parent().siblings('a:first').find('img[overlay]');
	var t = window.setTimeout(function(){rel.hide();},200);
	rel.mouseover(function(){clearTimeout(t);}).mouseout(function(){$(this).hide();});
});

$("img.iconplus").each(function(i){
    var tr = $(this).parents('div.colr');
    $(this).overlay({
        onBeforeLoad: function(){
            var bima = tr.find('div.imgbox a:eq(1)').attr('href');
		    var bimg = tr.find('div.imgbox img:eq(1)').attr('src');
		    bimg = bimg.replace('product_image_b', '300x300x15');
		    var title = tr.find('a h3').html();
            var price = tr.find('ul li.price').html();
            var stores = tr.find('ul li.store').html();
            var button = tr.find('ul li.disn').html();
            var wrap = $("div.wrap");
            wrap.html('');
            var shtml = '';
                shtml += '<div class="plenlargewrapper"><div class="enlargecontent">';
				shtml += '<strong>zoom</strong>';
				shtml += '<div class="imgbox"><a href="' + bima + '" border="0" target="_blank"><img src="' + bimg + '"></a></div>';
				shtml += '<div class="caption"><a href="' + bima + '" target="_blank">' + title + '</a></div>';
				shtml += '<div class="store">'+ price +' '+ stores +'</div>';
				shtml += '<div class="submit"><a href="' + bima + '" target="_blank"><img src="'+ fileServer + button + '" /></a></div>';
				shtml += '</div></div>';
			wrap.html(shtml);
        },
        oneInstance: false,
        closeOneClick: true,
        close: 'div.close',
        onClose: function(){}
    });
});

var prodDetailUrl = '/async_prod.php';

$('a.coupon, a.rebate').each(function(i){
    var dt = $(this).attr('className');
    var da = $(this).attr('name');
    $(this).overlay({
        onBeforeLoad: function(){
            var wrap = $("div.wrap"); 
            jQuery.post(prodDetailUrl, {'dt':dt, 'data':da, 'showcoupon':1}, function(data, textStatus){
                if(!data[0]){
                    return false;
                }
                var vals = data[0].values||null;
                load_flag = vals.length;
				wrap.html('');
				var shtml = '';
				switch(dt){
				    case 'coupon':
				        shtml += '<div class="couponwrapper"><div class="conponcontent">';
					    if (vals.length > 1) {
							shtml += '<h3><span>' + vals.length + '</span> coupons available</h3>';
						} else {
							shtml += '<h3><span>1</span> coupon available</h3>';
						}
						shtml += '<div class="morecoupon">';
						for(id in vals){								
							shtml += '<div class="couponlist">';
							shtml += '<div class="merchantlogo"><img src="http://images.smarter.com/merchantlogo_120x60x15/' + vals[id].merchant_id + '.gif" /></div>';
							shtml += '<ul>';
							shtml += '<li class="code"><strong>Code:</strong><a href="' + vals[id].redir + '" target="_blank">' + vals[id].code + '</a><a href="' + vals[id].redir + '" class="codelink" target="_blank">' + vals[id].code + '</a></li>';
							shtml += '<li class="detail"><strong>Detail:</strong><p>' + vals[id].desc + '</p></li>';
							shtml += '<li class="expires"><strong>Expires:</strong><em>' + vals[id].enddate + '</em></li>';
							if (vals[id].restriction) {
								shtml += '<li class="restrictions"><strong>Restriction:</strong>' + SMUS_GO.truncate(vals[id].restriction, 150) + '</li>';
							} else {
								shtml += '<li class="restrictions"><strong>Restriction:</strong>Unknown</li>';
							}	
							shtml += '</ul>';
							shtml += '</div>';
						}
						shtml += '</div></div></div>';
				        break;
				    case 'rebate':
				        shtml += '<div class="plrebateswrapper"><div class="rebatescontent">';
						for(id in vals){
						    shtml += '<strong>' + vals[id].brand_name + ' rebate info</strong>';
							shtml += '<div class="download"><a href="' + vals[id].url + '" target="_blank">Download rebate from ' + vals[id].brand_name + '</a></div>';
							shtml += '<ul>';
							if (parseInt(vals[id].amountoff) == vals[id].amountoff) {
							    shtml += '<li class="amount"><strong>Rebate Amount:</strong>$' + vals[id].amountoff + '</li>';
							} else {
								shtml += '<li class="amount"><strong>Rebate Amount:</strong>' + vals[id].amountoff + '</li>';
							}
							shtml += '<li class="expires"><strong>Expires:</strong><em>' + vals[id].enddate+ '</em></li>';
							if (vals[id].restriction) {
								shtml += '<li class="restrictions"><strong>Restriction:</strong>' + SMUS_GO.truncate(vals[id].restriction, 240) + '</li>';
							} else {
								shtml += '<li class="restrictions"><strong>Restriction:</strong>Unknown</li>';
							}
							shtml += '</ul>';
						}
						shtml += '</div></div>';
				        break;
				    default:
				        shtml = 'Hello World!';
				}
				wrap.html(shtml);
            }, 'json');
        },
        onLoad: function(){
            if (load_flag > 1) {
			    $('div.overlay').addClass('backgroundhigh');
			} else {
				$('div.overlay').addClass('backgroundshort');
			}
        },
        oneInstance: false,
        closeOnClick: true,
        close: 'div.close',
        onClose: function(){}
    });
});

$('div.search > form').submit(function(){$('div.searchsuggestion').hide();});
//primo cheng add 20090511,for copy to clipboard with flash;
$('div.couponlist > ul >li.code').each(function(i){
    var code = $(this).find('a').html();
    var url = $(this).find('a').attr('href');
    if(code){
        $(this).append(createFlash(code,i,url));
    }
});
//primo cheng add 20090511 end;

}); // end of documnet.onload
