var openedC=-1;var editcom="0";var justClosed="";var upTimmer;function closeDialog(id){$("#"+id).dialog("close")}function notValid(){shout("This form has expired. Please reload and try again.Thanks.")}function shout(msg,head,st){if(st){st=true}else{st=false}if(!head){head=""}$.jGrowl(msg,{header:head,glue:"before",speed:"fast",life:5000,sticky:st})}function sendMail(){showSpinner();$.post("/jx.php?action=sendmail&rnd="+Math.ceil(Math.random()*10000),$("#mailform").serialize(),function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Contact")}else{if(data.ok){$("#xbt1").css("visibility","hidden");$("#xbt2").css("visibility","hidden");$("#fieldholder").html('<div id="mres"><h3>Thank you for contacting us</h3>We will get back to you as soon as possible.</div>')}}}else{notValid()}},"json")}function vConfirm(txt,fnc,params){if($("#confirmdialog").length){$("#confirmdialog .confdiag").html(txt)}else{$("body").append('<div id="confirmdialog" title="Please Confirm"><div class="confdiag">'+txt+"</div></div>")}$("#confirmdialog").dialog({autoOpen:true,modal:true,width:300,height:"auto",zIndex:1001,resizable:false,hide:"drop",show:"drop",buttons:{No:function(){$(this).dialog("close")},Yes:function(){fnc(params);$(this).dialog("close")}}})}function registerDialog(){showSpinner();if($("#termstext").length){$("#termstext").dialog("destroy");$("#termstext").remove()}$.get("/jxc.php?view=register&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);if($("#registertokendone").length){$("input[name=token]:not(#registertokendone)").val($("#registertokendone").val());hideSpinner();$("#registerdone").dialog({autoOpen:true,modal:true,width:600,height:310,resizable:false,hide:"puff",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove()}})}else{$("#dusername").DefaultValue("enter here...");$("#dpassword").DefaultValue("enter here...");$("#cpassword").DefaultValue("enter here...");$("#email").DefaultValue("enter here...");$("#cemail").DefaultValue("enter here...");$("#ticket_captcha").DefaultValue("enter here...");$("input[name=token]:not(#registertoken)").val($("#registertoken").val());if($("#termstext").length){$("#termstext").dialog({autoOpen:false,modal:true,width:600,height:500,resizable:false,zIndex:1001,hide:"puff",show:"drop"})}hideSpinner();$("#register").dialog({autoOpen:true,modal:true,width:600,height:415,resizable:false,hide:"puff",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove()}})}})}function register(){var go=true;if($("#agree").attr("checked")){$("#labelagree").removeClass("error")}else{go=false;$("#labelagree").addClass("error");shout("You must agree to the Terms and Conditions","Register")}if($("#dpassword").val()==$("#cpassword").val()){$("#labelcpassword").removeClass("error")}else{go=false;$("#labelcpassword").addClass("error");shout("Passwords don't match","Register")}if($("#email").val()==$("#cemail").val()){$("#labelcemail").removeClass("error")}else{go=false;$("#labelcemail").addClass("error");shout("Emails don't match","Register")}if(go){showSpinner();$.post("/jx.php?action=register&rnd="+Math.ceil(Math.random()*10000),$("#formregister").serialize(),function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.ok==false){if(data.username){$("#labeldusername").addClass("error");shout(data.username,"Register")}else{$("#labeldusername").removeClass("error")}if(data.password){$("#labeldpassword").addClass("error");shout(data.password,"Register")}else{$("#labeldpassword").removeClass("error")}if(data.email){$("#labelemail").addClass("error");shout(data.email,"Register")}else{$("#labelemail").removeClass("error")}if(data.captcha){$("#labelcaptcha").addClass("error");shout(data.captcha,"Register");refreshCaptchaLight()}else{$("#labelcaptcha").removeClass("error")}if(data.error){shout(data.error,"Register")}}else{$("#register").dialog("close");registerDialog()}}else{notValid()}},"json")}}function loginDialog(){showSpinner();$.get("/jxc.php?view=login&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("#username").DefaultValue("enter here...");$("#password").DefaultValue("enter here...");$("input[name=token]:not(#logintoken)").val($("#logintoken").val());hideSpinner();$("#login").dialog({autoOpen:true,modal:true,width:635,height:190,resizable:false,hide:"puff",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove();justClosed="login"}})})}function login(){showSpinner();$.post("/jx.php?action=login&rnd="+Math.ceil(Math.random()*10000),$("#formlogin").serialize(),function(data){if(data.ok){if(window.location.pathname.indexOf("logout")<0&&window.location.pathname.indexOf("verify-account")<0&&window.location.pathname.indexOf("retrieve_pass")<0){window.location.reload()}else{window.location.href=window.location.protocol+"//"+window.location.host+"/"}}else{hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Login")}else{$(".ui-dialog:not(.spinner)").effect("shake",{},75)}}else{notValid()}}},"json")}function lostPassPre(){showSpinner();closeDialog("login");upTimmer=window.setInterval("checkClosed('login')",100)}function checkClosed(id){if(justClosed==id){clearTimeout(upTimmer);lostPassDialog()}}function lostPassDialog(){$.get("/jxc.php?view=lostpass&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("#lemail").DefaultValue("enter here...");$("input[name=token]:not(#lostpasstoken)").val($("#lostpasstoken").val());hideSpinner();$("#lostpass").dialog({autoOpen:true,modal:true,width:600,height:220,resizable:false,hide:"puff",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove()}})})}function lostPass(){showSpinner();$.post("/jx.php?action=lostpass&rnd="+Math.ceil(Math.random()*10000),$("#lostpassForm").serialize(),function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){shout(data.msg,"Lost Username/Password")}else{notValid()}if(data.close){closeDialog("lostpass")}},"json")}function showSpinner(){if($("#spinner").length===0){$("body").append('<div id="spinner" class="hide"><img src="/images/ajax-loader.gif"><br>Loading...</div>')}$("#spinner").dialog({autoOpen:true,modal:true,width:100,height:60,resizable:false,dialogClass:"spinner",draggable:false})}function hideSpinner(){$("#spinner").dialog("close")}function requestPaymentDialog(){showSpinner();$.get("/jxc.php?view=requestpayment&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("#request_bank_name").DefaultValue("enter here...");$("#request_bank_iban").DefaultValue("enter here...");$("#request_bank_swift").DefaultValue("enter here...");$("input[name=token]:not(#paytoken)").val($("#paytoken").val());hideSpinner();$("#requestpay").dialog({autoOpen:true,modal:true,width:800,height:500,resizable:false,hide:"drop",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove()}})})}function requestPayment(){if(jQuery.trim($("#request_amount").val())==""){shout("Please fill the amount","Payment Request");return false}var a=parseFloat($("#request_amount").val());if(a>0){if(a>=100){if($("#request_method_1").attr("checked")){if(jQuery.trim($("#request_bank_client").val())==""){shout("Please fill your name","Payment Request");return false}if(jQuery.trim($("#request_bank_name").val())==""||$("#request_bank_name").val()=="enter here..."){shout("Please fill the bank name","Payment Request");return false}if(jQuery.trim($("#request_bank_iban").val())==""||$("#request_bank_iban").val()=="enter here..."){shout("Please fill the IBAN","Payment Request");return false}if(jQuery.trim($("#request_bank_swift").val())==""||$("#request_bank_swift").val()=="enter here..."){shout("Please fill the SWIFT code","Payment Request");return false}}else{if($("#request_method_2").attr("checked")){if(jQuery.trim($("#request_paypal_email").val())==""){shout("Please fill your paypal email","Payment Request");return false}}else{return false}}if($("#request_confirm").attr("checked")){showSpinner();$.post("/jx.php?action=requestpayment&rnd="+Math.ceil(Math.random()*10000),$("#formrequestpay").serialize(),function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Payment Request")}else{if(data.ok){$("#current_earnings").val("$"+data.amount);$("#requestpay").dialog("close");shout("Your request will be processed soon","Payment Request");return false}}}else{notValid()}},"json")}else{shout("Please confirm your request","Payment Request");return false}}else{shout("The minimum amount allowed is $100.00","Payment Request");return false}}else{shout("The amount is not valid","Payment Request");return false}}function termsDialog(){$("#termstext").dialog("open")}function cartDialog(){showSpinner();$.get("/jxc.php?view=cart&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("#causername").DefaultValue("enter here...");$("#capassword").DefaultValue("enter here...");$("input[name=token]:not(#carttoken)").val($("#carttoken").val());hideSpinner();$("#shopcart").dialog({autoOpen:true,modal:true,width:850,minWidth:850,maxWidth:850,height:"auto",minHeight:350,maxHeight:550,resizable:true,dialogClass:"shopCart",hide:"puff",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove()}})})}function add2cart(datain,obj){showSpinner();$.post("/jx.php?action=add2cart&rnd="+Math.ceil(Math.random()*10000),"p="+datain,function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Cart")}else{if(data.ok){$(obj).effect("transfer",{to:$("#viewcartlk")},500,function(){$("#viewcartlk").effect("shake",{distance:2,times:1},50);$("#cartitemstotal").val(data.total)})}}}else{notValid()}},"json")}function removeFromCart(datain,obj){showSpinner();$.post("/jx.php?action=removefromcart&rnd="+Math.ceil(Math.random()*10000),"p="+datain,function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Cart")}else{if(data.ok){$("#"+obj).remove();$("#cartitemstotal").val(data.total);$("#shopcart").dialog("option","title","Shopping Cart ("+data.tit+")");if($("#cartamount").length){$("#cartamount").html("$"+data.amount)}if(data.empty){if($("#cartamount").length){$("#checkoutform").remove();$("#ppccpayment").remove();$("#demptholder").append('<div  style="text-align:center;padding-top: 100px;padding-bottom: 100px;"><h3> Your Shopping Cart is Empty...</h3></div>');$("#shopcart").dialog("close")}else{$("#dcarthead").remove();$("#fsetfmlog").remove();$("#dcbut").remove();$("#dicartitems").html('<div style="margin-top:100px;"><h4>Your Cart is Empty...</h4></div>')}}}}}else{notValid()}},"json")}function loginCart(redir){showSpinner();$.post("/jx.php?action=login&rnd="+Math.ceil(Math.random()*10000),$("#cartformlog").serialize(),function(data){if(data.ok){window.location.href=redir}else{hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Login")}else{shout("Wrong username/password.","Login")}}else{notValid()}}},"json")}function submissionsDialog(sid){showSpinner();$.get("/jxc.php?view=submission&sid="+sid+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("input[name=token]:not(#viewsubtk)").val($("#viewsubtk").val());hideSpinner();$("#submission").dialog({autoOpen:true,modal:true,width:850,minWidth:850,maxWidth:850,height:"auto",resizable:true,hide:"drop",show:"drop",close:function(){$(this).dialog("destroy");$(this).remove()}})})}function rejectSubmission(datain){if($("#rejectdiag").length){$("#reasonreject").val("")}else{$("body").append('<div id="rejectdiag" title="Reject Submission"><form id="rejform"><input type="hidden" name="token" id="tkrj" value=""><p>Enter the reasons for rejection.</p><div><textarea id="reasonreject" name="reasonreject" class="areafield a375"></textarea></div></form></div>');$("#tkrj").val($("#viewsubtk").val())}$("#rejectdiag").dialog({autoOpen:true,modal:true,width:400,height:"auto",zIndex:1001,resizable:false,hide:"drop",show:"drop",buttons:{Cancel:function(){$(this).dialog("close")},Reject:function(){showSpinner();$.post("/jx.php?subreject="+datain+"&rnd="+Math.ceil(Math.random()*10000),$("#rejform").serialize(),function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){if(data.error){shout(data.error,"Submission Rejection")}if(data.ok){$("#subopts"+$("#subidx").val()).html("&nbsp;Rejected");$("#submission").dialog("close");shout($("#scrname").val()+" rejected","Submission Rejection")}}else{notValid()}},"json");$(this).dialog("close")}}})}function acceptSubmission(datain){vConfirm("Are you sure that you want to approve this Screensaver?",function(){showSpinner();$.post("/jx.php?subapprove="+datain+"&rnd="+Math.ceil(Math.random()*10000),$("#submissionForm").serialize(),function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.valid){$("#subcelltit"+$("#subidx").val()).html($("#scrname").val());if(data.error){shout(data.error,"Submission Approval")}if(data.ok){$("#subopts"+$("#subidx").val()).html("&nbsp;In Queue");$("#submission").dialog("close");shout($("#scrname").val()+" approved","Submission Approval")}}else{notValid()}},"json")})}function quote(msg,user){var txt;var fld;if(msg=="author"){fld="authorcommenttext"}else{fld="commenttxt"+msg}var sel=""+getSelectedText(fld);if(sel.length>0){txt=sel}else{txt=$("#"+fld).text()}if($("#new_comment").val()=="Leave your comment..."){$("#new_comment").val('[quote="'+user+'"]'+txt+"[/quote]")}else{$("#new_comment").val($("#new_comment").val()+'[quote="'+user+'"]'+txt+"[/quote]")}$("#new_comment").DefaultValue("Leave your comment...");$("#new_comment").focus();setCaretPosition(fld)}function setCaretPosition(id,pos){var elem=document.getElementById(id);if(!pos){var pos=0;elem.focus()}else{if(window.getSelection){if(elem.selectionStart){elem.focus();elem.setSelectionRange(pos,pos)}else{elem.focus()}}else{if(document.selection){var ran=elem.createTextRange();ran.move("character",pos);ran.select()}else{return}}}}function getSelectionRange(){var sel=window.getSelection();var ran;if(sel&&sel!=""){if(sel.getRangeAt){ran=sel.getRangeAt(0)}else{ran=document.createRange();ran.setStart(sel.anchorNode,sel.anchorOffset);ran.setEnd(sel.focusNode,sel.focusOffset)}return ran}return false}function getSelectedText(fld){var txt="";if(window.getSelection){var sel=window.getSelection();var ran=getSelectionRange();if(ran){if(ran.startContainer.parentNode.attributes.id&&ran.endContainer.parentNode.attributes.id){var sCont=ran.startContainer.parentNode.attributes.id.value;var eCont=ran.endContainer.parentNode.attributes.id.value;if(sCont==eCont&&fld==sCont){txt=sel}}}}else{if(document.selection){txt=document.selection.createRange().text}else{return}}return txt}function refreshCaptcha(){$(".captcha").attr("src","/captcha.php?rnd="+Math.random()*10000)}function refreshCaptchaLight(){$(".captcha").attr("src","/captcha.php?c=l&rnd="+Math.random()*10000)}var flash_480=false;var flash_768=false;var check_interval=false;function flashLoaded(w){eval("flash_"+w+"=true;")}function bigDemoFlash(posterf,filef,kf){var loaded=false;if($("#bigflashdiag").length){$("#bigflashdiag").dialog("open")}else{$("body").append('<div id="bigflashdiag" ><div id="bigflash" ><img src="'+posterf+'"></div></div>');$("#bigflash").flash({swf:"/videoplayer960.swf",width:768,height:432,hasVersion:10,wmode:"gpu",id:"flash_big_player",flashvars:{poster:posterf,file:filef,k:kf,width:768}});$("#bigflashdiag").dialog({title:$("#prodtitle").html(),autoOpen:true,modal:true,resizable:false,min_width:768,min_height:432,width:798,height:492,close:function(){document.getElementById("flash_big_player").pauseFlashVideo();document.getElementById("flash_small_player").playFlashVideo()}})}document.getElementById("flash_small_player").pauseFlashVideo();check_interval=setInterval("playF()",50);setTimeout("clearCheck()",5000)}function playF(){if(flash_768){document.getElementById("flash_big_player").playFlashVideo();clearInterval(check_interval);flash_768=false}}function clearCheck(){if(check_interval){clearInterval(check_interval)}check_interval=false;flash_768=false}function bigDemo(posterf,filef){if($("#bigflashdiag").length){$("#bigflashdiag").dialog("open")}else{$("body").append('<div id="bigflashdiag" ><video id="bigdemo" width="768" height="432" src="'+filef+'" poster="'+posterf+'" onended="this.play();"  autobuffer="autobuffer" ><img src="'+posterf+'"></video></div>');$("#bigflashdiag").dialog({title:$("#prodtitle").html(),autoOpen:true,modal:true,resizable:false,min_width:768,min_height:432,width:798,height:492,close:function(){document.getElementById("bigdemo").pause();document.getElementById("smalldemo").play()}})}document.getElementById("smalldemo").pause();document.getElementById("bigdemo").play()}function Psearch(){if($("#lookfor").val()=="enter keywords..."||jQuery.trim($("#lookfor").val())==""){shout("Please provide some keywords","Search");return true}window.location.href=$("#search").attr("action")+($("#lookfor").val().replace(/ /g,"+").replace(/\//g,"|"))}function cancelAuthorEdit(){$("#authorcommentbarEdit").hide();$("#authorcommentbar").show();$("#authorcommentedit").hide();$("#authorcommenttext").show();$("#authorcommentedit").html("");openedC=-1}function cancelCommentEdit(id){editcom="0";openedC=-1;$("#commentbarEdit"+id).hide();$("#commentbar"+id).show();$("#commentedit"+id).hide();$("#commenttxt"+id).show();$("#commentedit"+id).html("")}function closeAll(){if(openedC==0){cancelAuthorEdit()}else{if(openedC>0){cancelCommentEdit(openedC)}}}function editDescription(datain){closeAll();showSpinner();$.ajax({type:"GET",cache:false,url:"/jx.php?loaddescription="+datain+"&rnd="+Math.ceil(Math.random()*1000),dataType:"json",success:function(data,statusText){hideSpinner();if(statusText=="success"){if(data.token){$("input[name=token]").val(data.token)}if(data.ok){openedC=0;var xxx=$("#authorcommenttext").outerHeight();$("#authorcommentbar").hide();$("#authorcommentbarEdit").show();$("#authorcommenttext").hide();$("#authorcommentedit").html(data.txt);if(xxx<144){xxx=144}$("#edit_comment").height(xxx);$("#edit_comment").autoheight({h:xxx});$("#authorcommentedit").show()}}else{$.jGrowl("Error! Could not contact the server!",{header:"Edit Description"})}}})}function editComment(id,datain){closeAll();showSpinner();$.ajax({type:"GET",cache:false,url:"/jx.php?loadcomment="+datain+"&rnd="+Math.ceil(Math.random()*1000),dataType:"json",success:function(data,statusText){hideSpinner();if(statusText=="success"){if(data.token){$("input[name=token]").val(data.token)}if(data.ok){editcom=id;openedC=id;var xxx=$("#commenttxt"+id).outerHeight();$("#commentbar"+id).hide();$("#commentbarEdit"+id).show();$("#commenttxt"+id).hide();$("#commentedit"+id).html(data.txt);if(xxx<144){xxx=144}$("#edit_comment").height(xxx);$("#edit_comment").autoheight({h:xxx});$("#commentedit"+id).show()}}else{$.jGrowl("Error! Could not contact the server!",{header:"Edit Description"})}}})}function deleteComment(id,datain){vConfirm("Are you sure that you want to delete this comment?",function(){showSpinner();$.ajax({type:"GET",cache:false,url:"/jx.php?deletecomment="+datain+"&rnd="+Math.ceil(Math.random()*1000),dataType:"json",success:function(data,statusText){hideSpinner();if(statusText=="success"){if(data.token){$("input[name=token]").val(data.token)}if(data.ok){$("#holdercomment"+id).fadeOut();shout("Comment Deleted","Comments")}else{if(data.error){shout("Unable to delete comment","Comments")}}}else{shout("Error! Could not contact the server!","Comments")}}})})}function saveAuthorEdit(datain){showSpinner();$.ajax({type:"POST",cache:false,url:"/jx.php?savedescription="+datain+"&rnd="+Math.ceil(Math.random()*1000),dataType:"json",data:"newd="+$("#edit_comment").val(),success:function(data,statusText){hideSpinner();if(statusText=="success"){if(data.token){$("input[name=token]").val(data.token)}if(data.ok){$("#authorcommenttext").html(data.txt);cancelAuthorEdit();shout("Description edited!","Description")}else{if(data.error==1){shout("Unable to edit","Description")}else{if(data.error==2){shout("The description cannot be empty","Description")}}}}else{$.jGrowl("Error! Could not contact the server!",{header:"Edit Description"})}}})}function saveCommentEdit(id,datain){showSpinner();$.ajax({type:"POST",cache:false,url:"/jx.php?savecomment="+datain+"&rnd="+Math.ceil(Math.random()*1000),dataType:"json",data:"newd="+$("#edit_comment").val(),success:function(data,statusText){hideSpinner();if(statusText=="success"){if(data.token){$("input[name=token]").val(data.token)}if(data.ok){$("#commenttxt"+id).html(data.txt);cancelCommentEdit(id);shout("Comment edited!","Comment")}else{if(data.error==1){shout("Unable to edit","Comment")}else{if(data.error==2){shout("The comment cannot be empty","Comment")}}}}else{$.jGrowl("Error! Could not contact the server!",{header:"Edit Description"})}}})}function requestDelete(datain){if($("#rejectdiag").length){$("#reasonreject").val("")}else{$("body").append('<div id="rejectdiag" title="Request Delete"><form id="rejform" method="post" action=""><input type="hidden" name="datareqdel" id="tkrj" value=""><p>Enter the reasons for your request.</p><div><textarea id="reasonreject" name="reasonreject" class="areafield a375"></textarea></div></form></div>')}$("#tkrj").val(datain);$("#reasonreject").DefaultValue("enter here...");$("#rejectdiag").dialog({autoOpen:true,modal:true,width:400,height:"auto",zIndex:1001,resizable:false,hide:"drop",show:"drop",buttons:{Cancel:function(){$(this).dialog("close")},"Submit Request":function(){if($("#reasonreject").val()=="enter here..."||jQuery.trim($("#reasonreject").val())==""){shout("Please state your reasons","Request Delete");return false}showSpinner();$("#rejform").submit()}}})}function highLightAnchor(){if(self.document.location.hash){var x=self.document.location.hash.substring(1);if(x!="new_comment"){$("#"+x).css("background-color","#ffdddd")}}}function editor(url){tinyMCE.init({mode:"none",width:"888",height:"550",document_base_url:url,relative_urls:false,content_css:"includes/themes/default/css/editor.css",dialog_type:"modal",theme:"advanced",skin:"o2k7",skin_variant:"",add_unload_trigger:false,auto_reset_designmode:true,plugins:"safari,inlinepopups,bsimageplug",theme_advanced_buttons1:"forecolor, removeformat, |, bullist, numlist, |, outdent, indent, |, undo, redo, |, link, unlink, bsimageplug, cleanup, code, |, justifyleft, justifycenter, justifyright, justifyfull, |, bold, italic, underline, strikethrough, styleselect, formatselect, fontselect, fontsizeselect",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_resize_horizontal:false,theme_advanced_resizing_use_cookie:false,theme_advanced_resizing:true,theme_advanced_styles:"Align Image Left=alignleft; Align Image Center=aligncenter; Align Image Right=alignright; New Line=newline; Indent=indent-1 Grey=grey; Blue=blue; Small=small"})}function addN(url,id){showSpinner();$.get("/jxc.php?view=newnews&nid="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("#ncats").caixabox();editor(url);$("input[name=token]:not(#nntk)").val($("#nntk").val());hideSpinner();$("#newnews").dialog({autoOpen:true,modal:true,width:915,minWidth:915,maxWidth:915,minHeight:800,height:"auto",resizable:true,beforeClose:function(){tinyMCE.execCommand("mceFocus",false,"txnewnews");tinyMCE.execCommand("mceRemoveControl",false,"txnewnews");tinyMCE.triggerSave(true,true);$(tinyMCE.editors).each(function(){tinyMCE.remove(this)})},close:function(){$(this).dialog("destroy");$(this).remove()}});tinyMCE.idCounter=0;tinyMCE.execCommand("mceAddControl",false,"txnewnews");$("#ntitle").DefaultValue("enter here...");$("#nkeys").DefaultValue("enter here...");$("a.imgPreview").tooltip({offsety:20})})}function newsPost(){if($("#ntitle").val()=="enter here..."||jQuery.trim($("#ntitle").val())==""){shout("Please provide a Title","News");return false}if($("#nid").val()=="0"&&jQuery.trim($("#nimage").val())==""){shout("Please provide an Image","News");return false}tinyMCE.triggerSave(true,true);var ed=tinyMCE.get("txnewnews");$("#chtml").val(ed.getContent());showSpinner();$("#fnews").submit();return false}function deleteNews(id,tit,ex){vConfirm("Are you sure that you want to delete?<br> &quot;"+tit+"&quot;"+ex,function(){showSpinner();$("#ndel"+id).submit()})}function deleteCamp(id){vConfirm("Are you sure that you want to delete?<br> &quot;"+id+"&quot;<br><br>Note: All stats will be lost ",function(){showSpinner();$("#ndel"+id).submit()})}function addNc(id){showSpinner();$.get("/jxc.php?view=newnewsCat&nid="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("input[name=token]:not(#nntk)").val($("#nntk").val());hideSpinner();$("#newnews").dialog({autoOpen:true,modal:true,width:"auto",height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}});$("#ntitle").DefaultValue("enter here...");$("#nkeys").DefaultValue("enter here...");$("#seotitle").DefaultValue("enter here...");$("#ndesc").DefaultValue("enter here...")})}function addCMP(){showSpinner();$.get("/jxc.php?view=newCAMP&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("input[name=token]:not(#nntk)").val($("#nntk").val());hideSpinner();$("#newnews").dialog({autoOpen:true,modal:true,width:"auto",height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}});$("#ntitle").DefaultValue("enter here...")})}function addPc(id){showSpinner();$.get("/jxc.php?view=newprodCat&nid="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("input[name=token]:not(#nntk)").val($("#nntk").val());hideSpinner();$("#newnews").dialog({autoOpen:true,modal:true,width:"auto",height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}});$("#ntitle").DefaultValue("enter here...");$("#nkeys").DefaultValue("enter here...");$("#seotitle").DefaultValue("enter here...");$("#ndesc").DefaultValue("enter here...");$("#caturl").DefaultValue("enter here...")})}function newsCPost(){if($("#ntitle").val()=="enter here..."||jQuery.trim($("#ntitle").val())==""){shout("Please provide a Category Name","News Category");return false}if($("#seotitle").val()=="enter here..."||jQuery.trim($("#seotitle").val())==""){shout("Please provide a SEO Page Title","News Category");return false}if($("#ndesc").val()=="enter here..."||jQuery.trim($("#ndesc").val())==""){shout("Please provide a SEO Description","News Category");return false}if($("#nkeys").val()=="enter here..."||jQuery.trim($("#nkeys").val())==""){shout("Please provide some SEO Keywords","News Category");return false}showSpinner();$("#fnews").submit();return false}function campCPost(){if($("#ntitle").val()=="enter here..."||jQuery.trim($("#ntitle").val())==""){shout("Please provide a Campaign Name","Campaigns");return false}showSpinner();$("#fnews").submit();return false}function freeScr(id){showSpinner();$.get("/jxc.php?view=freeprod&sid="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("input[name=token]:not(#nntk)").val($("#nntk").val());hideSpinner();$("#freescrdlg").dialog({autoOpen:true,modal:true,width:"auto",height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}})})}function freePost(){showSpinner();$("#ffreescr").submit();return false}function catCPost(){if($("#ntitle").val()=="enter here..."||jQuery.trim($("#ntitle").val())==""){shout("Please provide a Category Name","Product Category");return false}if($("#caturl").val()=="enter here..."||jQuery.trim($("#caturl").val())==""){shout("Please provide an URL","Product Category");return false}var rg=new RegExp("[^a-z_]");if($("#caturl").val().length<2||rg.test($("#caturl").val())){shout("URL can only have a-z lowercase characters and _ <br>Minimum of 2 chars","Product Category");return false}if($("#seotitle").val()=="enter here..."||jQuery.trim($("#seotitle").val())==""){shout("Please provide a SEO Page Title","Product Category");return false}if($("#ndesc").val()=="enter here..."||jQuery.trim($("#ndesc").val())==""){shout("Please provide a SEO Description","Product Category");return false}if($("#nkeys").val()=="enter here..."||jQuery.trim($("#nkeys").val())==""){shout("Please provide some SEO Keywords","Product Category");return false}showSpinner();$("#fnews").submit();return false}function deleteUserProd(fid,datain,pname){vConfirm("Are you sure that you want to delete "+pname+" Screensaver?",function(){showSpinner();$.post("/jx.php?removeuserprod="+datain+"&rnd="+Math.ceil(Math.random()*10000),"removeuserprod="+datain,function(data){hideSpinner();if(data.token){$("input[name=token]").val(data.token)}if(data.error){shout(data.error,"Your Uploads")}if(data.ok){$("#"+fid).fadeOut();var tot=parseInt($("#htotal").text());tot--;$("#htotal").html(((tot>0)?(tot+" File"+((tot>1)?"s":"")):"none"));shout(pname+" removed","Your Uploads")}},"json")})}function inactivateScr(id){vConfirm("Make this Screen Saver Inactive?",function(){showSpinner();$.post("/jx.php?actscr=inactscr&rnd="+Math.ceil(Math.random()*10000),"actscrd="+id,function(data){hideSpinner();if(data.ok){$("#userrow"+data.id+"_1").html("Inactive");$("#bt_mk_in").hide();$("#bt_mk_ac").show();$("#prodactive").attr("checked",false)}shout(data.msg,"Edit Screen Saver")},"json")})}function activateScr(id){vConfirm("Make this Screen Active?",function(){showSpinner();$.post("/jx.php?actscr=actscr&rnd="+Math.ceil(Math.random()*10000),"actscrd="+id,function(data){hideSpinner();if(data.ok){$("#userrow"+data.id+"_1").html("Active");$("#bt_mk_ac").hide();$("#bt_mk_in").show();$("#prodactive").attr("checked",true)}shout(data.msg,"Edit Screen Saver")},"json")})}function deleteScr(id){vConfirm("Delete this Screen Saver",function(){showSpinner();$.post("/jx.php?dtscr=dtscr&rnd="+Math.ceil(Math.random()*10000),"dtscrd="+id,function(data){hideSpinner();if(data.ok){$("#userrow"+data.id+"_1").html("Deleted");for(var i=2;i<=9;i++){$("#userrow"+data.id+"_"+i).html("")}$("#prodedit").dialog("close")}shout(data.msg,"Edit Screen Saver")},"json")})}function editProd(id){showSpinner();$.get("/jxc.php?prodprof="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);hideSpinner();$("#prodedit").dialog({autoOpen:true,modal:true,width:850,minWidth:850,maxWidth:850,height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}})})}function saveScr(id){showSpinner();$.post("/jx.php?savescr="+id+"&rnd="+Math.ceil(Math.random()*10000),$("#submissionForm").serialize(),function(data){hideSpinner();if(data.ok){$("#userrow"+data.id+"_7").html(data.price);$("#userrow"+data.id+"_2").html(data.name);$("#prodedit").dialog("close")}shout(data.msg,"Edit Screen Saver")},"json")}function reprocess(id){$("#prodedit").dialog("close");showSpinner();$.get("/jxc.php?reproc="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);hideSpinner();$("#reprocdiv").dialog({autoOpen:true,modal:true,width:850,minWidth:850,maxWidth:850,height:"auto",resizable:false,position:["center",40],close:function(){$(this).dialog("destroy");$(this).remove()}})})}function reprocessdo(id){showSpinner();$.post("/jx.php?reprocess="+id+"&rnd="+Math.ceil(Math.random()*10000),$("#submissionForm").serialize(),function(data){hideSpinner();if(data.ok){$("#reprocdiv").dialog("close")}shout(data.msg,"Re-Process Screen Saver")},"json")}function sort(opt,fld,fid){$("#"+fld).val(opt);showSpinner();$("#"+fid).submit()}function ManageGroups(){showSpinner();$.get("/jxc.php?view=managegroups&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);$("input[name=token]:not(#nntk)").val($("#nntk").val());hideSpinner();$("#grpsmanage").dialog({autoOpen:true,modal:true,width:"auto",height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}})})}function admSendActLnk(id,txt){vConfirm(txt,function(){showSpinner();$.post("/jx.php?sendact=lnk&rnd="+Math.ceil(Math.random()*10000),"sendactlink="+id,function(data){hideSpinner();shout(data.msg,"Send Activation Email")},"json")})}function editUsr(id){showSpinner();$.get("/jxc.php?userprof="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);hideSpinner();$("#user_level").caixabox();$("#new_pass").DefaultValue("use to change");$("#acc_expires").datepicker({dateFormat:"yy-mm-dd"});$("#userdetails").dialog({autoOpen:true,modal:true,width:690,height:500,resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}})})}function deleteUser(id,name){vConfirm("Delete "+name,function(){showSpinner();$.post("/jx.php?deleteuser=deleteuser&rnd="+Math.ceil(Math.random()*10000),"duser="+id,function(data){hideSpinner();if(data.ok){$("#userdetails").dialog("close");for(var i=0;i<=8;i++){$("#userrow"+data.id+"_"+i).html("&nbsp;")}$("#userrow"+data.id+"_1").html("deleted")}shout(data.msg,"Delete User")},"json")})}function saveUser(id){if($("#new_pass").val()!="use to change"&&$("#new_pass").val().length>0){if($("#new_pass").val().length>=4){if($("#new_pass").val()!=$("#conf_new_pass").val()){shout("Passwords dont match","Edit User");return false}}else{shout("Password requires min 4 chars","Edit User");return false}}showSpinner();$.post("/jx.php?updateUser="+id+"&rnd="+Math.ceil(Math.random()*10000),$("#formuser").serialize(),function(data){hideSpinner();if(data.ok){$("#userdetails").dialog("close");if(data.username){$("#userrow"+data.id+"_3").html(data.username)}if(data.email){$("#userrow"+data.id+"_5").html('<a href="mailto:'+data.email+'">'+data.email+"</a>")}if(data.level){$("#userrow"+data.id+"_6").html(data.level)}if(data.name){$("#userrow"+data.id+"_4").html(data.name)}if(data.ftp){$("#userrow"+data.id+"_7").html(data.ftp)}if(data.active){$("#userrow"+data.id+"_1").html(data.active);$("#btactlnk"+data.id).remove()}}shout(data.msg,"Edit User")},"json")}function setPayment(mp){if($("#full_name").val()=="enter here..."||jQuery.trim($("#full_name").val())==""){shout("Please fill your Full Name / Business Name","Check Out");return false}showSpinner();$.ajax({type:"POST",cache:false,url:"jx.php?setPayment="+mp+"&rnd="+Math.ceil(Math.random()*1000),data:$("#checkoutform").serialize(),dataType:"html",success:function(data,statusText){$("input[name=token]:not(#chktk)").val($("#chktk").val());if(statusText=="success"&&data!=""){$("#"+mp).html(data);if(mp=="ccard"){$("#coform").submit()}else{$("#paypalform").submit()}}else{hideSpinner();shout("Sorry but we cannot process your payment right now. Please try again later","Check Out")}}})}function viewSale(id){showSpinner();$.get("/jxc.php?vsale="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);hideSpinner();$("#saledit").dialog({autoOpen:true,modal:true,width:850,minWidth:850,maxWidth:850,height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}})})}function procsale(id){vConfirm("Process this Sale?",function(){showSpinner();$.post("/jx.php?sale=proc&rnd="+Math.ceil(Math.random()*10000),"inv="+id,function(data){hideSpinner();if(data.ok){$("#"+data.id+"_8").html("Finished");$("#saledit").dialog("close")}shout(data.msg,"Sales")},"json")})}function delsale(id){vConfirm("Delete this Sale?",function(){showSpinner();$.post("/jx.php?sale=del&rnd="+Math.ceil(Math.random()*10000),"inv="+id,function(data){hideSpinner();if(data.ok){for(var i=1;i<=9;i++){$("#"+data.id+"_"+i).html("")}$("#"+data.id+"_8").html("deleted");$("#saledit").dialog("close")}shout(data.msg,"Sales")},"json")})}function viewReqPay(id){showSpinner();$.get("/jxc.php?reqpayadm="+id+"&rnd="+Math.ceil(Math.random()*10000),function(data){$("body").append(data);hideSpinner();$("#admrequestpay").dialog({autoOpen:true,modal:true,width:850,minWidth:850,maxWidth:850,height:"auto",resizable:false,close:function(){$(this).dialog("destroy");$(this).remove()}})})}function procpay(id){vConfirm("Complete this request? ",function(){showSpinner();$.post("/jx.php?reqpayadm=complete&rnd="+Math.ceil(Math.random()*10000),"xd="+id,function(data){hideSpinner();if(data.ok){$("#utr"+data.id+"_8").html("Complete");$("#admrequestpay").dialog("close")}shout(data.msg,"Payment Requests")},"json")})};
