var queryString;var TAB_CLASS='.contentTab';$(document).ready(function(){$('#nextbutton').click(function(){var active=$(TAB_CLASS+'.active');if(active.next(TAB_CLASS).length){active.removeClass('active');active.next(TAB_CLASS).addClass('active')}if(active.next(TAB_CLASS).next(TAB_CLASS).length==0)$(this).hide();$('#prevbutton').show();$('#instructions1').hide();$('#instructions2').show();skipContent($(this))});$('#prevbutton').click(function(){var active=$(TAB_CLASS+'.active');if(active.prev(TAB_CLASS).length){active.removeClass('active');active.prev(TAB_CLASS).addClass('active')}if(active.prev(TAB_CLASS).prev(TAB_CLASS).length==0){$(this).hide();$('#instructions1').show();$('#instructions2').hide()}$('#nextbutton').show();skipContent($(this))});function skipContent(button){if(($('[id*=sOptions]').hasClass('active'))&&($('#s').val()==0)){button.click()}if(($('[id*=dOptions]').hasClass('active'))&&($('#d').val()==0)){button.click()}}$('.picker').each(function(){var fieldId=$(this).attr('rel');$(this).colorPicker({defaultColor:13,columns:13,click:function(c){$('#'+fieldId).val(c)}})});$("#previewbutton").click(function(){tmpUrl=queryString.replace(/\?/gi,"@@@");tmpUrl=tmpUrl.replace(/\&/gi,"|||");window.open('/widgets/rss/preview/?scriptUrl='+tmpUrl,"previewWindow","status=0,toolbar=0,scrollbars=1,resizable=1,width=400,height=500");return false})});function makeCode(){var theCode='';var feeds=new Array();$('input:checkbox[name=feeds]:checked').each(function(){feeds.push($(this).val())});if(feeds.length>4){alert('Please select only a maximum of 4 feeds, you currently have '+feeds.length+' selected');return}if($('#d').val()==0)$('#dateDetails').hide();else $('#dateDetails').show();theCode='http://'+document.location.host+'/widgets/rss/widget/?'+'&fc='+$('#fc').val()+'&feeds='+feeds.toString()+'&s='+$('#s').val()+'&d='+$('#d').val()+'&borderColour='+$('#borderColour').val()+'&backgroundColour='+$('#backgroundColour').val();if($('#tCSS').val()==''){theCode=theCode+'&tFont='+$('#tFont').val()+'&tSize='+$('#tSize').val()+'&tStyle='+$('#tStyle').val()+'&tColour='+$('#tColour').val()+'&tBorderColour='+$('#tBorderColour').val()+'&selectTBackgroundColour='+$('#selectTBackgroundColour').val()}else{theCode=theCode+'&tCSS='+$('#tCSS').val()}if($('#hCSS').val()==''){theCode=theCode+'&hFont='+$('#hFont').val()+'&hSize='+$('#hSize').val()+'&hStyle='+$('#hStyle').val()+'&hColour='+$('#hColour').val()}else{theCode=theCode+'&hCSS='+$('#hCSS').val()}if($('#s').val()==1){if($('#sCSS').val()==''){theCode=theCode+'&sFont='+$('#sFont').val()+'&sSize='+$('#sSize').val()+'&sStyle='+$('#sStyle').val()+'&sColour='+$('#sColour').val()}else{theCode=theCode+'&sCSS='+$('#sCSS').val()}}if($('#d').val()==1){theCode=theCode+'&dPosition='+$('#dPosition').val()+'&dFormat='+$('#dFormat').val();if($('#dCSS').val()==''){theCode=theCode+'&dFont='+$('#dFont').val()+'&dSize='+$('#dSize').val()+'&dStyle='+$('#dStyle').val()+'&dColour='+$('#dColour').val()}else{theCode=theCode+'&dCSS='+$('#dCSS').val()}}queryString=theCode.replace(/#/gi,"");$('#widgetCodeArea').val(widgetHeaderHTML+'<scri'+'pt type="text/javascript" src="'+queryString+'"></scri'+'pt>'+widgetFooterHTML)}