$(document).ready(function(){time=Math.floor(new Date().getTime()/1000);if($("#breadcrumbs #s1 p").height()>82||$("#breadcrumbs #s2 p").height()>82||$("#breadcrumbs #s3 p").height()>82){$("#breadcrumbs p").css("font-size","11px")}$("#progress-initial").hide();$("#p1").fadeIn(300);$("#s1").animate({paddingLeft:"+=5px"},200);$("input[type=hidden]").attr("autocomplete","off");$(this).textReplacement($("input.clear_value"));$("button:has(span[class*=rightarrow])").click(function(){$(this).breadcrumbsSwitch("+1",false,true);return false});$("a:has(span[class*=leftarrow])").click(function(){$(this).breadcrumbsSwitch("-1",false,true);return false});$("#p2 #theme #previous").click(function(){$(this).themeSwitch("-1",false);return false});$("#p2 #theme #next").click(function(){$(this).themeSwitch("+1",false);return false});$("#p2 #colors a").click(function(){$(this).colorChoose($(this).attr("id"));return false});$("select").selectBox()});$.fn.textReplacement=function(a){$.each(a,function(){var b=$(this).val();$(this).focus(function(){if($.trim($(this).val())==b){$(this).val("")}});$(this).blur(function(){if($.trim($(this).val())==""){$(this).val(b)}})})};$.fn.breadcrumbsSwitch=function(h,d,j){var g=3;var e=0;var f=0;var c=$("#breadcrumbs li.selected");var a=$(c).attr("id").substr(1);if(h=="-1"){if(a!=1){var e=parseInt(a)-1}else{if(d){var e=g}}}else{if(h=="+1"){if(a!=g){var e=parseInt(a)+1}else{if(d){var e=1}}}else{var e=parseInt(h)}}if(e>0&&e<=g){if(a==1){var i=$.trim($("#feed_url").val());var b=$.trim($("#feed_name").val());if(i=="http://"||i==""||b==""){$("#p1 .error").fadeIn(150);var f=1}}if(f==0){$(c).removeClass("selected").animate({paddingLeft:"-=5px"},300);$("#breadcrumbs li.#s"+e+"").addClass("selected").animate({paddingLeft:"+=5px"},300);if(j){$(this).stepsSwitch(a,e)}}}};$.fn.stepsSwitch=function(b,a){if(a==3){time_passed=Math.floor(new Date().getTime()/1000)-time;if(time_passed>4){time_remaining=0}else{time_remaining=4-time_passed}$("#p"+b).fadeOut(0,function(){$("#progress-final").fadeIn(0)});setTimeout(function(){$.ajax({url:"index-processing.html",type:"POST",data:$("form").serialize(),complete:function(){$("#progress-final").hide()},success:function(c){if(c.match(/[a-f0-9]{32}/)==null){$("#p3").fadeIn(0,function(){$(this).breadcrumbsSwitch("1",false,false);$("#p3 .error").fadeIn(150)})}else{$("#p3 #success").html($("#p3 #success").html().replace(/\#id\#/g,c));$("#p3 #direct_link").click(function(){$(this).selText()});$("#p3 #direct_link").click(function(){$(this).selText()});$("#p3 #html").click(function(){$(this).selText()});$("#p3 #bbcode").click(function(){$(this).selText()});$("#p3 #preview").fadeIn(0);$("#p3").fadeIn(0,function(){$("#p3 #success").fadeIn(150)})}}})},(time_remaining)*1000+250)}else{$("#p"+b).fadeOut(100,function(){$("#p"+a+"").fadeIn(100,function(){$("#p1 .error").hide()})})}};$.fn.themeSwitch=function(b){var a=$("#gtype").val();if(b=="-1"){if(a==themes[0]){var c=themes[themes.length-1]}else{var c=themes[$.inArray(a,themes)-1]}}else{if(a==themes[themes.length-1]){var c=themes[0]}else{var c=themes[$.inArray(a,themes)+1]}}$("#theme img").attr("src",$("#theme img").attr("src").replace(a,c));$("#gtype").val(c)};$.fn.colorChoose=function(a){var b=$("#gcolor").val();$("#theme img").attr("src",$("#theme img").attr("src").replace(b,a));$("#"+b).removeClass("selected");$("#"+a).addClass("selected");$("#gcolor").val(a)};$.fn.selText=function(){var c=this[0];if($.browser.msie){var a=c.offsetParent.createTextRange();a.moveToElementText(c);a.select()}else{if($.browser.mozilla||$.browser.opera){var b=c.ownerDocument.defaultView.getSelection();var a=c.ownerDocument.createRange();a.selectNodeContents(c);b.removeAllRanges();b.addRange(a)}else{if($.browser.safari){var b=c.ownerDocument.defaultView.getSelection();b.setBaseAndExtent(c,0,c,1)}}}return this};
