var SuggestionBox={selectedCategory:'',hasCurtain:false,create:function(){if($('#SuggestionBox').length<1){$('<div id="SuggestionBox" />').appendTo('body').dragonDrop({type:'window',title:'Suggestion Box',content:this.getContents(),enableMinMax:false,enableClose:true,width:400}).find('input.submit').click(this.submit)}else{$('#SuggestionBox').centerOnScreen()}if(SuggestionBox.selectedCategory!=''){$('#sgboxcategory option').each(function(){if($(this).val()==SuggestionBox.selectedCategory){$(this).attr('selected','selected')}})}$('#sgboxcategory').change(SuggestionBox.categoryChanged);return false},remove:function(){$('.SuggestionBox_content').parents('.dragon').slayDragon(null,SuggestionBox.hasCurtain);return false},getContents:function(){var html='<div class="SuggestionBox_content"><div class="submitDiv"><div class="text">Tell us how to make myYearbook even better!<br />Fill out the form below and submit your suggestion!</div><div class="formContainer"><div class="label">Category:</div><select class="category" name="sgboxcategory" id="sgboxcategory"><option value=""> - - Please select a category - - </option><option value="advertising">Advertising</option><option value="captcha">Captcha</option><option value="im">IM</option><option value="lunchmoney">Lunch Money</option><option value="newidea">New Ideas</option><option value="spam">Spam</option><option value="toolbar">Toolbar</option><option value="vippoints_vipclub">VIP Club</option><option value="virusmalware">Virus/Malware</option><option value="other">Other</option></select><div class="label">Subject:</div><input class="subject" type="text" /><div class="label">Suggestion:</div><textarea class="suggestion"></textarea><input class="submit" type="image" src="'+IMAGE_URL+'/btn_suggestion.gif" /><br /><br /></div></div><div class="successDiv">Thank you, your message has been sent!<br /><a class="close" href="#">Close Window</a><br /><br /></div></div>';return $(html)},showMalwareForm:function(curtain){if(typeof(curtain)=='undefined'){curtain=false}curtain=(true===curtain);SuggestionBox.hasCurtain=curtain;if($('#MalwareForm').length<1){var html='<div class="SuggestionBox_content MalwareForm"><div class="submitDiv"><div class="text">To investigate your virus/malware report, we need a few details from you.<br /><strong>Copy the text in the left box and paste it into the box on the right</strong></div><div class="formContainer"><div class="left"><strong>Copy <span class="shortcut">(CTRL + A, then CTRL + C)</span> the code below:</strong><iframe border="0" src="http://ad.yieldmanager.com/cookie" /></div><div class="right"><strong>Paste <span class="shortcut">(CTRL + V)</span> the code into this box:</strong><textarea class="adData"></textarea></div><div class="label">Describe where you were and what you think the issue is below:</div><textarea class="suggestion" name="suggestion"></textarea></label><input class="submit" type="image" src="'+IMAGE_URL+'/btn_submit_lg.gif" /></div></div><div class="successDiv">Thank you, your message has been sent!<br /><a class="close" href="#">Close Window</a></div></div>';$('<div id="MalwareForm" />').appendTo('body').dragonDrop({type:'window',title:'Report Virus/Malware',content:html,curtain:curtain,enableMinMax:false,enableClose:true,width:600}).find('input.submit').click(this.submit)}if(curtain){$('#MalwareForm iframe').show()}if($.browser.msie&&$.browser.version=='6.0'){$('#MalwareForm iframe').load(function(){setTimeout(function(){$('#MalwareForm iframe').show().css('visibility','visible')},200)})}return false},submit:function(){if(window.location.toString().indexOf(SITE_URL)>=0){var url='/apps/suggestions/ajax'}else{var url='/suggestions/ajax'}var isMalwareReport=($(this).parents('#MalwareForm').size()>0);var category=isMalwareReport?'virusmalware':$('#sgboxcategory option:selected').val();var l=window.location.href;var dataObj={category:category,calledFrom:l,subject:(isMalwareReport?$.trim($('.SuggestionBox_content input.submit').siblings('.suggestion').val()).substring(0,15)+'...':$.trim($('.SuggestionBox_content input.submit').siblings('.subject').val())),suggestion:$.trim($('.SuggestionBox_content input.submit').siblings('.suggestion').val()),wid:screen.width,hei:screen.height};if(isMalwareReport){dataObj.adData=$.trim($('#MalwareForm textarea.adData').val())}if(dataObj.category==''){alert('Please enter a category')}else if(dataObj.subject==''){alert('Please enter a subject.')}else if(dataObj.suggestion==''){alert('Please enter a suggestion.')}else if(isMalwareReport&&dataObj.adData==''){alert('Please copy the code from the left box into the right. Enter N/A if nothing is in the left box.')}else{$.ajax({type:'POST',url:url,data:dataObj,dataType:'json',success:function(data){if(data.success==true){$('.dragon .SuggestionBox_content .submitDiv').hide();$('.dragon .SuggestionBox_content .successDiv').show().children('.close').click(SuggestionBox.remove)}}})}return false},categoryChanged:function(){if($(this).val()=='virusmalware'){$(this).val('');SuggestionBox.showMalwareForm();$('.SuggestionBox_content:not(.MalwareForm)').parents('.dragon').slayDragon()}}};$(document).ready(function(){$('.SuggestionBox').click(function(){SuggestionBox.create();return false})});