/*
 * @copyright 2010 Advanced Care Solutions
 * @author Christopher Rahauiser <crahauiser@acsedge.com>
 */
var contactSubmit=function(a){a.stop();var c="";var g=/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|info|jobs|museum|name|gov|edu|mil|asia|int)$/i;var e=/^\d{5}$/;var d=/^\d{5}-\d{4}$/;if($F("full_name").blank()){c="The Full Name is required";}else{if($F("zipcode").blank()){c="The Zip Code is required.";}else{if(!e.test($F("zipcode"))&&!d.test($F("zipcode"))){c="The Zip Code must be in the format ##### or #####-####.";}else{if($F("email").blank()){c="The E-mail Address field is required.";}else{if(!g.test($F("email"))){c="The E-mail Address field must contain a valid email address.";}else{if($F("case_type").blank()){c="The Type of Case is required.";}else{if($F("comments").blank()){c="The Comment Field is required.";}else{if($F("comments").length>10000){c="The Comment Field must be less than 10,000 characters.";}}}}}}}}if(c){$("js_error").update('<p class="error">'+c+"</p>");}else{var f={full_name:$F("full_name"),zipcode:$F("zipcode"),case_type:$F("case_type"),comments:$F("comments"),phone1:$F("phone1"),email:$F("email")};var b=$("hidden-motorcycle");if(b){f.motorcycle="1";}new Ajax.Request("contact_us/sidebar_contact_js",{method:"post",parameters:f,onFailure:function(){$("js_error").update('<p class="error">An error has occured. Please try again later.</p>');},onSuccess:function(i){var h=i.responseText;$("js_error").update(h);$("contact_btn").setStyle({visibility:"hidden"});$("full_name","zipcode","phone1","email","case_type","comments").invoke("clear");}});}};var Ticker=Class.create({initialize:function(a){if(typeof Effect=="undefined"){throw Error("The Effects library from script.aculo.us is required.");}this._ticker=$(a)||null;if(!this._ticker){throw Error("Please specify a ticker element.");}this._tickerWidth=this._ticker.getWidth();this._paras=this._ticker.select("p");this._paras.each(function(b){b.setStyle({position:"absolute",left:this._tickerWidth+"px",width:b.getWidth()+"px"});},this);this._ptr=0;this._run();},_run:function(){if(this._ptr==this._paras.length){this._ptr=0;}new Effect.Move(this._paras[this._ptr],{x:0,y:0,mode:"absolute",queue:{position:"end",scope:"ticker",limit:2},afterFinish:function(){new PeriodicalExecuter(function(a){a.stop();new Effect.Move(this._paras[this._ptr],{x:-1*this._tickerWidth,y:0,mode:"absolute",afterFinish:function(){this._paras[this._ptr].setStyle({left:this._tickerWidth+"px"});this._ptr++;this._run();}.bind(this)});}.bind(this),3);}.bind(this)});}});document.observe("dom:loaded",function(){$$("a.newwin").invoke("observe","click",function(c){window.open(this.href);c.stop();});var a=$("contact_btn");if(a){a.observe("click",contactSubmit);}var b=new Ticker("ticker");});