var ssi={jTime:new Date(),setButtonEffects:function(b,a,c){if(a!=0){a=a*1000;setTimeout(function(){$("#"+b).css("display","Block")},a)}else{$("#"+b).css("display","Block")}if(c!=0){c=(c*1000)+a;setTimeout(function(){$("#"+b).css("display","None")},c)}},getOffset:function(){return(new Date(sTime).getTime()-new Date().getTime())},getOffset2:function(){return(new Date(sTime).getTime()-new Date(ssi.jTime).getTime())},getServerTime:function(){return new Date().getTime()+ssi.getOffset()},countdown:function(h,d,p,q){var b=new Date(d).getTime();var j=new Date().getTime()+ssi.getOffset2();var c=(b-j);var r=Math.floor(c/(1000));if(b<j){if(p){p()}}if(h=="video_timer"){if(!five_min_loaded){if(r<300){five_min_message=qss.post_to_tags(five_min_message);five_min_message=qss.remove_empty_tags(five_min_message);$("#five_min").html(five_min_message);five_min_loaded=true}}}var n=1000;var f=60000;var k=3600000;var a=86400000;var o=Math.floor(c/a);if(o<0){o=0}var l=Math.floor(c/k-(24*o));if(l<0){l=0}var e=Math.floor(c/f-(60*l+(60*24*o)));if(e<0){e=0}var m=Math.floor((c/n)-((60*e)+(60*60*l)+(60*60*24*o)));if(m<0){m=0}text=q;text=text.replace(/%day%/,o);text=text.replace(/%hour%/,l);text=text.replace(/%minute%/,e);text=text.replace(/%second%/,m);$("#day").html(o);$("#hour").html(l);$("#minute").html(e);$("#second").html(m);text=qss.post_to_tags(text);text=qss.remove_empty_tags(text);$("#"+h).html(text)}};var g={modern:dir+"libs/flowplayer/flowplayer.controls.swf",tube:dir+"libs/flowplayer/flowplayer.controls-tube.swf",air:dir+"libs/flowplayer/flowplayer.controls-air.swf"};var setup={logoObj:{logo:{url:"",opacity:0.7,bottom:30,left:10,fullscreenOnly:false}},CONFIG:{width:515,height:350,debug:false,autoBuffering:true,key:"",plugins:{rtmp:{url:dir+"libs/flowplayer/flowplayer.rtmp.swf",netConnectionUrl:"rtmp://s3a4d7jyi1506d.cloudfront.net/cfx/st",durationFunc:"getStreamLength"}},clip:{autoPlay:false,url:"mp4:video-demo",provider:"rtmp"}},CONTROLS:[{url:g.modern,backgroundGradient:"none",backgroundColor:"rgba(0, 0, 0, 0)",tooltipColor:"rgba(0, 0, 0, 0)",progressColor:"#4599ff",volumeColor:"#4599ff",durationColor:"#b8d9ff",scrubberBarHeightRatio:0.2,volumeBarHeightRatio:0.2,autoHide:{fullscreenOnly:true,style:"fade",delay:500,duration:400}},{url:g.modern,height:30,backgroundGradient:[0,0.2,0.4],backgroundColor:"rgba(0, 0, 0, 0.3)"},{url:g.modern,backgroundGradient:[0.5,0.4,0.3,0.2,0,0,0,0],scrubberBarHeightRatio:0.1,volumeBarHeightRatio:0.1,backgroundColor:"rgba(0, 24, 43, 0.75)",borderRadius:17,bottom:"6pct",width:"90pct"},{url:g.modern,backgroundColor:"rgba(125, 125, 125, 0.6)",progressColor:"#000000",volumeColor:"#000000",durationColor:"#174e6b",bufferColor:"#bababa",volumeBarHeightRatio:0.2,scrubberBarHeightRatio:0.2},{url:g.air,height:26,buttonColor:"rgba(0, 0, 0, 0.7)",buttonOverColor:"#333333",timeColor:"#ffffff",durationColor:"#ff3d3d",backgroundColor:"rgba(0, 0, 0, 0)",backgroundGradient:[0,0.2,0.4],progressColor:"#000000",sliderColor:"#cccccc",timeBgColor:"rgba(0, 0, 0, 0)",scrubberHeightRatio:0.6,scrubberBarHeightRatio:0.3,volume:false,bufferColor:"#ffffff",tooltipColor:"rgba(0, 0, 0, 0)"},{url:g.air,timeColor:"#ffffff",borderRadius:30,backgroundColor:"rgba(0, 0, 0, 0.7)",scrubberHeightRatio:0.4,timeBgHeightRatio:0.83,volumeSliderHeightRatio:0.28,height:26.15,volumeBarHeightRatio:0.92,tooltipColor:"#7a7a7a",bufferColor:"#5e5e5e",buttonColor:"#737373",durationColor:"#696969",backgroundGradient:[0.5,0.4,0.3,0.2,0,0,0,0],buttonOverColor:"#949494",progressColor:"#ffffff",fullscreen:false,timeBgColor:"rgba(0, 0, 0, 0)",scrubberBarHeightRatio:0.5,left:50,width:"80pct",bottom:"7pct"},{controls:{backgroundColor:"rgba(37, 53, 60, 0.7)",url:g.air}},{url:g.air,durationColor:"#696969",bufferColor:"#768996",timeColor:"#ffffff",volume:false,fullscreen:false,height:22,scrubberHeightRatio:0.2,progressColor:"#ffffff",buttonColor:"#525252",backgroundColor:"rgba(0, 0, 0, 0.6)",timeBgColor:"rgba(0, 0, 0, 0)",backgroundGradient:[0.5,0.2,0]},{url:g.tube,timeColor:"#ffffff",durationColor:"#333333",sliderColor:"#cccccc",backgroundColor:"rgba(100, 100, 100, 0.2)",scrubberHeightRatio:0.86,scrubberBarHeightRatio:0.22,timeBgHeightRatio:0,progressColor:"#ffffff",height:22,volume:false,volumeBarHeightRatio:0.5,volumeSliderColor:"#000000",bufferColor:"#0a0a0a",backgroundGradient:"medium",timeBgColor:"transparent"},{backgroundColor:"rgba(185, 185, 185, 0.5)",url:g.tube},{url:g.tube,timeColor:"#ffffff",durationColor:"#ff2929",sliderColor:"#9e9e9e",backgroundColor:"rgba(0, 0, 0, 0.5)",timeBgHeightRatio:0.99,fullscreen:false,progressColor:"#ffffff",timeBgColor:"#000000",height:28.65,volumeBarHeightRatio:0.2,bufferColor:"#000000",volumeSliderColor:"#ffffff",buttonColor:"#ffffff",backgroundGradient:[0.5,0.2,0]},{url:g.tube,timeColor:"#8fd8e0",durationColor:"#122d30",backgroundColor:"rgba(0, 71, 79, 0.5)",scrubberHeightRatio:0.82,progressColor:"#000000",fullscreen:false,height:22,scrubberBarHeightRatio:0.15,volume:false,volumeBarHeightRatio:0.28,bufferColor:"#ffffff",volumeSliderColor:"#ffffff",buttonColor:"#ffffff",backgroundGradient:[0.5,0.2,0],timeBgColor:"rgba(0, 0, 0, 0)"}],init:function(){$(function(){$("#width").slider();$("#height").slider();$("#left").slider();$("#bottom").slider();$("#scrubberHeightRatio").slider();$("#scrubberBarHeightRatio").slider();$("#volumeSliderHeightRatio").slider();$("#volumeBarHeightRatio").slider();$("#timeBgHeightRatio").slider();$("#borderRadius").slider();$("#borderWidth").slider();$("#streamer_url").change(function(){var url=$("#streamer_url option:selected").val();var urldata=url.split("|::|");var streamer=urldata[0];var video=urldata[1];streamer="rtmp://"+streamer+"/cfx/st";var ext=video.substr(video.length-4);video=video.substr(0,video.length-4);var ext2=(ext==".mp4"?"mp4:":"");var config=setup.CONFIG;config.plugins.rtmp.netConnectionUrl=streamer;config.clip.url=ext2+video;setup.loadPlayer2(config)});var config=setup.CONFIG;config.plugins.controls=setup.CONTROLS[0];if(flowplayer_key!=""){$("#key").val(flowplayer_key);config.key=$("#key").val()}if(flowplayer_logo!=""){$("#logo").val(flowplayer_logo);$.extend(config,setup.logoObj);config.logo.url=$("#logo").val()}setup.loadPlayer2(config)});$(".picker").each(function(i){var el=$(this),tint=el.find("span"),key=el.attr("id");var b=el.css("backgroundColor");var a=1;$(this).ColorPicker({color:el.css("backgroundColor"),onChange:function(hsb,hex,rgb){$("#"+key).css("backgroundColor","#"+hex);$f().getControls().css(key,"#"+hex);eval("setup.getConfig().plugins.controls."+key+" = '#"+hex+"';")}})});$("#embedThis").click(function(){var width=($("#video_width").val()==""?515:$("#video_width").val());var height=($("#video_height").val()==""?350:$("#video_height").val());var code=($f().embed({width:width,height:height}).getEmbedCode(false));$("#dialog_embed_code").html(code);$("#dialog_embed_code").dialog({title:"Select and copy the code below!",width:600,height:400,modal:true});return false});$(".preset").each(function(i){$(this).click(function(){var config=setup.getConfig();config.plugins.controls=setup.CONTROLS[i];setup.loadPlayer2(config)})});$("#enableAutoPlay").click(function(){setup.getConfig().clip.autoPlay=$(this).is(":checked")});$("#enableAutoHide").click(function(){$f().getControls().setAutoHide({enabled:$(this).is(":checked"),fullscreenOnly:false,hideDelay:2000});setup.getConfig().plugins.controls.autoHide=$(this).is(":checked")});$(".widgets").change(function(){widgets={stop:false,play:false,scrubber:false,time:false,mute:false,volume:false,fullscreen:false};$(".widgets").each(function(){if(this.checked==true){eval("widgets."+$(this).val()+" = true");eval("setup.getConfig().plugins.controls."+$(this).val()+" = true;")}else{eval("setup.getConfig().plugins.controls."+$(this).val()+" = false;")}});$f().getControls().setWidgets(widgets)});$(".slider_width_value").html("100");$("#slider_width").slider({min:10,max:100,value:100,slide:function(event,ui){$(".slider_width_value").html(ui.value);var css={width:ui.value+"%"};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.width=ui.value+"%"}});$(".slider_height_value").html("26");$("#slider_height").slider({min:5,max:50,value:26,slide:function(event,ui){$(".slider_height_value").html(ui.value);var css={height:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.height=ui.value}});$(".slider_bottom_value").html("0");$("#slider_bottom").slider({min:0,max:100,value:0,slide:function(event,ui){$(".slider_bottom_value").html(ui.value);var css={bottom:ui.value+"%"};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.bottom=ui.value+"%"}});$(".slider_left_value").html("50");$("#slider_left").slider({min:0,max:80,value:50,slide:function(event,ui){$(".slider_left_value").html(ui.value);var css={left:ui.value+"%"};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.left=ui.value+"%"}});$(".slider_scrubberHeightRatio_value").html("0.6");$("#slider_scrubberHeightRatio").slider({min:0,max:1.2,value:0.6,slide:function(event,ui){$(".slider_scrubberHeightRatio_value").html(ui.value);var css={scrubberHeightRatio:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.scrubberHeightRatio=ui.value}});$(".slider_scrubberBarHeightRatio_value").html("0.2");$("#slider_scrubberBarHeightRatio").slider({min:0,max:1,value:0.2,slide:function(event,ui){$(".slider_scrubberBarHeightRatio_value").html(ui.value);var css={scrubberBarHeightRatio:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.scrubberBarHeightRatio=ui.value}});$(".slider_volumeSliderHeightRatio_value").html("0.6");$("#slider_volumeSliderHeightRatio").slider({min:0,max:1,value:0.6,slide:function(event,ui){$(".slider_volumeSliderHeightRatio_value").html(ui.value);var css={volumeSliderHeightRatio:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.volumeSliderHeightRatio=ui.value}});$(".slider_volumeBarHeightRatio_value").html("0.2");$("#slider_volumeBarHeightRatio").slider({min:0,max:1,value:0.2,slide:function(event,ui){$(".slider_volumeBarHeightRatio_value").html(ui.value);var css={volumeBarHeightRatio:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.volumeBarHeightRatio=ui.value}});$(".slider_timeBgHeightRatio_value").html("0.8");$("#slider_timeBgHeightRatio").slider({min:0,max:1.2,value:0.8,slide:function(event,ui){$(".slider_timeBgHeightRatio_value").html(ui.value);var css={timeBgHeightRatio:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.timeBgHeightRatio=ui.value}});$(".slider_borderRadius_value").html("0");$("#slider_borderRadius").slider({min:0,max:30,value:0,slide:function(event,ui){$(".slider_borderRadius_value").html(ui.value);var css={borderRadius:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.borderRadius=ui.value}});$(".slider_borderWidth_value").html("0");$("#slider_borderWidth").slider({min:0,max:10,value:0,slide:function(event,ui){$(".slider_borderWidth_value").html(ui.value);var css={borderWidth:ui.value};$f().getControls().css(css)},change:function(event,ui){setup.getConfig().plugins.controls.borderWidth=ui.value}});$("#key").change(function(){var config=setup.CONFIG;config.key=$("#key").val();setup.getConfig().key=$("#key").val();setup.loadPlayer2(config)});$("#logo").change(function(){var config=setup.CONFIG;$.extend(config,setup.logoObj);config.logo.url=$("#logo").val();setup.getConfig().logo.url=$("#logo").val();setup.loadPlayer2(config)})},getConfig:function(){return $f().getConfig()},getDefaultConfig:function(){return setup.CONFIG},getDefaultControls:function(a){return setup.CONTROLS[a]},showColorBox:function(a){$("#color_dialog").dialog({title:a});$("#colorPicker").farbtastic("#"+a)},loadPlayer2:function(a){flowplayer("player",{src:dir+"libs/flowplayer/flowplayer.swf",wmode:"opaque"},a)},save_flowplayer_data:function(){$.ajax({type:"POST",url:"index.php",data:"mode=save_flowplayer_data&key="+$("#key").val()+"&logo="+$("#logo").val(),success:function(a){if(a=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("Your data has been saved!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",width:300,height:75,modal:true})}}})}};var aws={form_create_distribution:function(){var a="index.php?mode=aws_form_create_distribution";$("#window").dialog("destroy");$("#window").load(a).dialog({title:"Create a new distribution!",width:600,height:100,modal:true,close:function(){}})},create_distribution:function(){var a=$("#form1").serialize();$.ajax({type:"POST",url:"index.php",data:"mode=aws_create_distribution&"+a,beforeSend:function(){$("#download").attr("disabled",true);$("#status").html('<img src="images/squares.gif" />&nbsp;Creating distribution, please standby...')},success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#download").attr("disabled",false);$("#status").html(b)}}})},form_create_bucket:function(){var a="index.php?mode=aws_form_create_bucket";$("#window").dialog("destroy");$("#window").load(a).dialog({title:"Create a new bucket!",width:450,height:135,modal:true,close:function(){}})},create_bucket:function(){var a=$("#form2").serialize();$.ajax({type:"POST",url:"index.php",data:"mode=aws_create_bucket&"+a,beforeSend:function(){$("#order").attr("disabled",true);$("#status").html('<img src="images/squares.gif" />&nbsp;Creating bucket, please standby...')},success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#order").attr("disabled",false);$("#status").html(b)}}})},form_upload_object:function(){var a="index.php?mode=aws_form_upload_object";$.ajax({type:"POST",url:a,success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html(b);$("#window").dialog({title:"Upload a new object!",width:575,height:300,modal:true,close:function(){window.location.reload()}})}}})},upload_object:function(a){var b=$("#bucket").val();if(b==-1){$("#window2").dialog({title:"Opps!",width:300,height:100,modal:true,close:function(){}})}$.ajax({type:"POST",url:"index.php",data:"mode=aws_upload_object&name="+a+"&bucket="+b,beforeSend:function(){$("#status").html('<img src="images/squares.gif" />&nbsp;syncing video with Amazon, please do not do anything until this process as completed...')},success:function(c){if(c=="login"){window.location="index.php?mode=login"}else{$("#status").html(c)}}})}};var qss={theme:"",init:function(){$(".qss_lightbox").click(function(){qss.showDialog(this.href,this.title);return false})},write_to_log:function(c,a,b){$.ajax({type:"POST",url:dir+"index.php",async:false,data:"mode=write_to_log&file="+c+"&line="+a+"&error="+b})},showDialog:function(a,b){$("#window2").dialog("destroy");$("#window2").dialog({width:800,height:600,title:b,modal:true,open:function(){$("#modalIframeId").attr("src",a)}});return false},openDialog:function(b,d,c,a){$("#"+b).dialog("destroy");$("#"+b).dialog({title:d,width:c,height:a,modal:true})},get_ctags:function(c,b){var a="index.php?mode=get_ctags&project_id="+c+"&template="+b;$("#window").dialog("destroy");$("#window").html("loading...");$("#window").load(a).dialog({title:"ctags",width:650,height:450,modal:true,beforeclose:function(){var d=$("#ctags").serialize();$.ajax({type:"POST",url:dir+"index.php",async:false,data:"mode=save_ctags&project_id="+c+"&template="+b+"&"+d,beforeSend:function(){$("#ctags_status").html('<img src="images/squares.gif" />&nbsp;Saving...')},success:function(e){if(e=="login"){window.location="index.php?mode=login"}}})}})},get_exithover:function(c,b){var a="index.php?mode=get_exithover&project_id="+c+"&template="+b;$("#window").dialog("destroy");$("#window").html("loading...");$("#window").load(a).dialog({title:"Exit Hover",width:650,height:500,modal:true,beforeclose:function(){var d=$("#"+b+"_exithover").serialize();$.ajax({type:"POST",url:dir+"index.php",async:false,data:"mode=save_exithover&project_id="+c+"&template="+b+"&"+d,beforeSend:function(){$("#exithover_status").html('<img src="images/squares.gif" />&nbsp;Saving...')},success:function(e){if(e=="login"){window.location="index.php?mode=login"}}})}})},show_error_window:function(b,c,a){$("body").html("<h4>Cannot connect to Infusion Soft.  Please refresh page to attempt to resolve this issue.  If refreshing the page does not work, try again in a couple of minutes.</h4>")},addCC:function(){$.ajax({type:"POST",url:dir+"index.php",async:false,data:"mode=addCCForm&project_id="+project_id,success:function(a){$("#ccForm").html(a)}})},addNewCC:function(){var a=$("#addNewCC").serialize();$.ajax({type:"POST",url:dir+"index.php",async:false,data:"mode=addNewCC&project_id="+project_id+"&"+a,success:function(b){$("#ccForm").html(b)}})},updateDiv:function(c,b,a){$.ajax({type:"POST",url:b,data:a,success:function(d){$("#"+c).html(d)}})},recordClick:function(c,b,a){$.ajax({type:"POST",url:dir+"index.php",async:false,data:"mode=recordClick&template_name="+template_name+"&href="+b+"&id="+c+"&name="+c+"&sec="+sec,success:function(){if(google){if(c=="Download Button"){pageTracker._trackEvent("WRS","Download Clicks",title)}else{if(c=="Order Button"){pageTracker._trackEvent("WRS","Order Clicks",title)}}}qss.sendEvent("Clicked name:"+c+",id:"+c+",href:"+b);if(b!=""){if(a){window.open(b,"","status=1,toolbar=1,location=1,menubar=1,directories=1,scrollbars=1,fullscreen=1,titlebar=1,width=800,height=600")}else{window.location=b}}}})},orderButton:function(){$("#orderButton").html('<img src="'+dir+'images/squares.gif" />');window.location=dir+"index.php?mode=orderButton&project_id="+project_id+"&template_name="+template_name},clearcookies:function(a){$("#window").dialog("destroy");$("#window").html("Are you sure you want to clear your project cookies?");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=clearcookies&project_id="+a,success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("Your project cookies have been cleared!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}}})},Cancel:function(){$(this).dialog("close")}}})},delete_project:function(a){$("#window").dialog("destroy");$("#window").html("Are you sure you want to delete this project?");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=delete_project&project_id="+a,success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html(b);$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close");window.location.reload()}}})}}})},Cancel:function(){$(this).dialog("close")}}})},create_project:function(){$("#window").dialog("destroy");$("#window").html("Creating project, please standyby...");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,open:function(){window.location="index.php?mode=create_project"}})},restore_emptyregions:function(a,b){$("#window").dialog("destroy");$("#window").dialog("destroy");$("#window").html("Are you sure you want to restore ALL emtpy regions for this template?");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=restore_emptyregions&project_id="+a+"&template_name="+b,success:function(c){if(c=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("ALL empty regions have been restored!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}}})},Cancel:function(){$(this).dialog("close")}}})},restore_regions:function(a,b){$("#window").dialog("destroy");$("#window").html("Are you sure you want to restore ALL of this template's regions to their default values?");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=restore_regions&project_id="+a+"&template_name="+b,success:function(c){if(c=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("Template regions have been restored to their default values!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}}})},Cancel:function(){$(this).dialog("close")}}})},restore_region:function(a){var c=$("#template_to_restore").val();var b=$("#region_to_restore").val();$("#window").dialog("destroy");$("#window").html("Are you sure you want to restore this region to its default value?");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=restore_region&project_id="+a+"&template_name="+c+"&region="+b,success:function(d){if(d=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("This region has been restored to its default value!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}}})},Cancel:function(){$(this).dialog("close")}}})},change_time_frame:function(c,a,b){window.location="index.php?mode=tracking&project_id="+c+"&time_frame="+a+"&epc_type="+b},update_portfolio_chart:function(b,a){window.location="index.php?mode=portfolio&time_frame="+b+"&action="+a},show_combochart:function(a,b){$("#window").dialog("destroy");$("#window").load(a).dialog({title:b,width:900,height:750,modal:true,close:function(){}})},show_pricechart:function(a,b){$("#window").dialog("destroy");$("#window").load(a).dialog({title:b,width:900,height:715,modal:true,close:function(){}})},show_editor:function(d,a,e,c,f){var b="index.php?mode=editor&project_id="+d+"&template_id="+a+"&region="+e+"&sector="+c;$("#window").dialog("destroy");$("#window").load(b).dialog({title:f+" >> "+e,width:700,height:425,modal:true,open:function(){$("#status").html("Edit alert: Opening "+f+","+e+","+c+"");$("#status").effect("highlight",{mode:"hide"},10000)},close:function(){window.location.reload()}})},process_oneclick:function(a){var c="";var b=true;if($("#tos").val()!=undefined){if(!$("#tos").is(":checked")){b=false;$("#window").dialog("destroy");$("#window").html("Before you proceed, you must agree to the terms and conditions...");$("#window").dialog({title:"Wait...",width:300,height:100,modal:true})}}if(b){if($("#addNewCC")){c=$("#addNewCC").serialize()}$("#offerbuttonLayer").html("<img src='"+dir+"images/big-snake.gif' /><br />Please wait while we process your order.  This could take up to 90 seconds...");qss.sleep(2);window.location=dir+"index.php?mode=process_oneclick&project_id="+project_id+"&"+window.location.search.substring(1)+"&template_name="+a+"&"+c}},no_thankyou:function(a){window.location=dir+"index.php?mode=nothankyou&type="+a+"&project_id="+project_id},sendEvent:function(a){if(google){pageTracker._trackEvent("QSS",a,title)}},checkform:function(j){var d=new Object();for(z=0;z<j.length;z++){var b=j[z].name;var c=j[z].type;if(c=="select-one"||c=="checkbox"||c=="radio"||c=="text"||c=="textarea"){d[b]=true}}for(i=0;i<j.length;i++){var h=j[i].value;c=j[i].type;b=j[i].name;if(c=="select-one"){if(j[i].options[j[i].selectedIndex].value!="-1"&&j[i].options[j[i].selectedIndex].value!=""){d[b]=false}}else{if(c=="checkbox"||c=="radio"){if(j[i].checked==true){d[b]=false}}else{if(c=="text"){if(b=="email1"||b=="email2"||b=="Contact0Email"||b=="email"||b=="from"){if(h.match(/^.+@.+\..{2,3}$/)){d[b]=false}}else{if(h!=""){d[b]=false}}}else{if(c=="textarea"){if(h!=""){d[b]=false}}}}}}var a=false;var e="The following field(s) are required:<ul>";for(x in d){if(d[x]){displayname=qss.fetchfilter(x);e+="<li>"+displayname+"</li>";a=true}}e+="</ul>";if(a){$("#window").dialog("destroy");$("#window").html(e);$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}},close:function(){}});return false}if($("#optin")){qss.sendEvent("Optin")}else{if($("#optin2")){qss.sendEvent("orderButtonClick")}}return true},fetchfilter:function(a){var b="";switch(a){case"title":b="Title";break;case"suffix":b="Suffix";break;case"Contact0FirstName":case"firstname1":case"name":case"firstname":b="First Name";break;case"middlename1":b="Middle Name";break;case"Contact0LastName":case"lastname1":case"lastname":b="Last Name";break;case"firstname2":b="Shipping First Name";break;case"middlename2":b="Shipping Middle Name";break;case"lastname2":b="Shipping Last Name";break;case"website":b="Website";break;case"street1address1":b="Billing Street Address Line 1";break;case"street1address2":b="Billing Street Address Line 2";break;case"city1":b="Billing City";break;case"state1":b="Billing State";break;case"postalcode1":b="Billing Postal Code";break;case"postalcode1exp":b="Billing Postal Code Extended";break;case"country1":b="Billing Country";break;case"phone1":b="Billing Phone";break;case"fax11":b="Billing Fax";break;case"fax1type":b="Billing Fax Type";break;case"phone1ext":b="Billing Phone Extension";break;case"email1":case"email":case"from":case"Contact0Email":b="Email address";break;case"street2address1":b="Shipping Street Address Line 1";break;case"street2address2":b="Shipping Street Address Line 2";break;case"city2":b="Shipping City";break;case"state2":b="Shipping State";break;case"postalcode2":b="Shipping Postal Code";break;case"postalcode2exp":b="Shipping Postal Code Extended";break;case"country2":b="Shipping Country";break;case"phone2":b="Shipping Phone";break;case"phone2ext":b="Shipping Phone Extension";break;case"fax12":b="Shipping Fax";break;case"fax2type":b="Shipping Fax Type";break;case"email2":b="Alternative email address";break;case"companyname1":b="Billing Company";break;case"companyname2":b="Shipping Company";break;case"birthday":b="Birthday";break;case"anniversary":b="Anniversary";break;case"jobtitle":b="Job Title";break;case"nickname":b="Nick Name";break;case"referralcode":b="Referral Code";break;default:b=a}return b},save_region:function(d,a,h,c,e){var f=encodeURIComponent($("textarea#editor").val());var b=$("input#name").val();$.ajax({type:"POST",url:"index.php",data:"mode=save_region&project_id="+d+"&template_id="+a+"&region="+h+"&text="+f+"&sector="+c+"&sector_name="+b,beforeSend:function(){$("#busy").html('<img src="images/squares.gif" />')},success:function(j){if(j=="login"){window.location="index.php?mode=login"}else{$("#busy").html("");$("#status").html("Edit alert: Your data has been saved!");$("#status").effect("highlight",{mode:"hide"},5000)}}})},savesettings:function(c,a){if(c){window.open(a,"mywindow")}else{var b=$("#settings").serialize();$.ajax({type:"POST",url:"index.php?mode=save_settings",data:b,dataType:"json",success:function(d){if(d.message=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");if(d.error==true){$("#window").html(d.message);$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true})}else{$("#window").html("Click okay to continue...");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Your settings have been saved",modal:true,buttons:{Ok:function(){$("#window").dialog("destroy");$("#window").html("<B>Reloading settings page, please standby...</b>");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Your settings have been saved",modal:true,open:function(){window.location.reload()}})}}})}}}})}},save_shipping_settings:function(){var a=$("#shipping_settings").serialize();$.ajax({type:"POST",url:"index.php?mode=save_shipping_settings",data:a,success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("Your shipping settings have been saved!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Your settings have been saved",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}}})},post_to_tags:function(a){for(x in post){a=a.replace("%"+x+"%",post[x])}return a},remove_empty_tags:function(a){return a.replace(/%[a-zA-Z0-9]{1,}%/,"")},post_to_query:function(){var a=0;var b="";for(x in post){if(a!=0){b+="&"}b+=x+"="+escape(post[x]);a++}return b},updateOrderPage:function(c){var b=1;var a="";if($("input[name=shipping_option]").is(":checked")){b=$("input:checked[name=shipping_option]").val()}else{var d=qss.getQuery();if(d.shipping_option!=undefined){b=d.shipping_option}}a=$("#Contact0Country2").val();$.ajax({type:"POST",url:dir+"index.php",dataType:"json",data:"mode=update_orderpage&project_id="+project_id+"&shipping_option="+b+"&Contact0Country2="+a,beforeSend:function(){$("#status").html('<img src="images/squares.gif" />');$("#orderButton").attr("disabled",true);$("#orderorder").attr("disabled",true)},success:function(e){if(e.error!=undefined){qss.show_error_window(e.error,300,150)}else{if(e!=""){$("#total_block").html(e.total_block);$("#status").html("");$("#orderButton").attr("disabled",false);$("#orderorder").attr("disabled",false)}}}});return true},updateOfferPage:function(b,a){},process_order:function(){$("#orderbuttonLayer").html("<img src='"+dir+"images/big-snake.gif' /><br />Please wait while we process your order.  This could take up to 90 seconds...");qss.sleep(3)},getQuery:function(){var c=new Array();var b=window.location.search.substring(1);var e=b.split("&");for(var a=0;a<e.length;a++){var d=e[a].split("=");c[d[0]]=d[1]}return c},copyShipping:function(what){if(what.checked){var flds=new Array();flds.push(new Array("Contact0StreetAddress1","Contact0Address2Street1"));flds.push(new Array("Contact0StreetAddress2","Contact0Address2Street2"));flds.push(new Array("Contact0City","Contact0City2"));flds.push(new Array("Contact0PostalCode","Contact0PostalCode2"));flds.push(new Array("Contact0State","Contact0State2"));flds.push(new Array("Contact0Phone1","Contact0Phone2"));if(qss.readCookie("InvoiceId")==null){flds.push(new Array("Contact0Country","Contact0Country2"))}flds.push(new Array("Contact0Email","Contact0EmailAddress2"));for(i=0;i<flds.length;i++){var ary=flds[i];if(eval("document.order."+ary[0])!=undefined&&eval("document.order."+ary[1])!=undefined){var from=eval("document.order."+ary[0]);var to=eval("document.order."+ary[1]);to.value=from.value}}qss.updateOrderPage(0)}},validate:function(b,c){switch(b){case"char":notallowed="1234567890!@#$%^&*;:'\",.?/\\|~`_-(){}[]<>+= ";break;case"charnum":notallowed="!@#$%^&*;:'\",.?/\\|~`_-(){}[]<>+= ";break;case"simpletext":notallowed="1234567890!@#$%^&*;:'\",.?/\\|~`_-(){}[]<>+=";break;case"num":notallowed="abcdefghijklmnopqrstuvwxyz!@#$%^&*;:'\",.?/\\|~`_-(){}[]<>+= ";break;default:notallowed=""}var a=c.value.split("");for(i=0;i<a.length;i++){for(x=0;x<notallowed.length;x++){if(a[i]==notallowed.substr(x,1)){a.splice(i,1);i--;break}}}c.value=a.join("")},flush_stats:function(a){$("#window").dialog("destroy");$("#window").html("Are you sure you want to flush your tracking database?\nThis will also delete any saved playback/activity data you have!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=flush_stats&project_id="+a,success:function(b){if(b=="login"){window.location="index.php?mode=login"}else{$("#window").dialog("destroy");$("#window").html("Your tracking database as been flushed!");$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}}})},Cancel:function(){$(this).dialog("close")}}})},flush_st_stats:function(a,b){$("#window2").dialog("destroy");$("#window2").html("Are you sure you want to flush your split-testing data for this template?");$("#window2").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$.ajax({type:"POST",url:"index.php",data:"mode=flush_st_stats&project_id="+a+"&template_name="+b,success:function(c){if(c=="login"){window.location="index.php?mode=login"}else{$("#window2").dialog("destroy");$("#window2").html(c);$("#window2").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close");qss.show_combochart("index.php?mode=combo_chart&project_id="+a+"&template_name="+b,b)}}})}}})},Cancel:function(){$(this).dialog("close")}}})},showStatus:function(a,b,c){if(typeof _statusbar=="undefined"){_statusbar=$("<div id='_statusbar' class='statusbar'></div>").appendTo(document.body).show()}if(c){_statusbar.prepend("<div style='margin-bottom: 2px;' >"+a+"</div>")[0].focus()}else{_statusbar.text(a)}_statusbar.show();if(b){_statusbar.addClass("statusbarhighlight");setTimeout(function(){_statusbar.removeClass("statusbarhighlight")},b)}},reader:function(){$.ajax({type:"POST",url:"index.php",data:"mode=reader",success:function(a){$("#feed").html(a)}})},insertTag:function(j,d){if(j!=-1){var k=j;var h=document.getElementById(d);var a=h.scrollTop;var c=0;var l=((h.selectionStart||h.selectionStart=="0")?"ff":(document.selection?"ie":false));if(l=="ie"){h.focus();var f=document.selection.createRange();f.moveStart("character",-h.value.length);c=f.text.length}else{if(l=="ff"){c=h.selectionStart}}var b=(h.value).substring(0,c);var e=(h.value).substring(c,h.value.length);h.value=b+k+e;c=c+k.length;if(l=="ie"){h.focus();f=document.selection.createRange();f.moveStart("character",-h.value.length);f.moveStart("character",c);f.moveEnd("character",0);f.select()}else{if(l=="ff"){h.selectionStart=c;h.selectionEnd=c;h.focus()}}h.scrollTop=a}},update_software:function(){$.ajax({type:"POST",url:"index.php",data:"mode=update_software",beforeSend:function(){$("#update_alert").html('<img src="images/squares.gif" />We are updating your software, please standby...')},success:function(a){$("#update_alert").html(a)}})},sleep:function(a){$.ajax({type:"POST",url:dir+"index.php",data:"mode=sleep&sleep="+a,async:false,success:function(){return}})},readCookie:function(b){var e=project_id+"_"+b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null},trackMouse:function(a){if(exithover_enabled=="1"){if(opened){return true}var b=a.pageY;if(b<10){opened=true;if(exithover_URL!=""){qss.showDialog(exithover_URL,exithover_title)}else{$("#window").html(exithover_text);qss.openDialog("window",exithover_title,800,600)}return true}}return true},selectTheme:function(b,a){if(qss.theme!=""){$("#"+qss.theme).css("border","");$("#"+qss.theme).css("borderColor","")}$("#"+b).css("borderColor","red");$("#"+a).css("border","solid");$("#"+a).css("borderColor","black");qss.theme=a;$("input[name=theme]").val(a)},alertThis:function(a){$("#window").dialog("destroy");$("#window").html(a);$("#window").dialog({title:"<img src='images/warning.png' />&nbsp;Attention",modal:true,buttons:{Ok:function(){$(this).dialog("close")}}})}};
