function makeactive(a,b){if(!$("tab_content"+a).visible()){num_tabs=b===undefined?4:b;for(var c=b=1;c<=num_tabs;c++){document.getElementById("tab"+c).className="";if($("tab_content"+c).visible()&&c!=a)b=c}new Effect.SlideUp("tab_content"+b,{duration:0.5});new Effect.BlindDown("tab_content"+a);document.getElementById("tab"+a).className="active"}}
function changelang(){var a=window.location.href,b="";b=$("lang").value=="en"?"":"lang="+$("lang").value;if(a.include("lang")){var c=new RegExp("lang=[a-z]+","g");b=a.replace(c,b);b=b.indexOf("?")==b.length-1?b.substr(0,b.length-1):b}else b=a+(a.include("?")?"&":"?")+b;window.location=b}
function $RF(a,b){if($(a).type&&$(a).type.toLowerCase()=="radio"){b=$(a).name;a=$(a).form}else if($(a).tagName.toLowerCase()!="form")return false;return(a=$(a).getInputs("radio",b).find(function(c){return c.checked}))?$F(a):null}
function validateSalesForm(){var a=true,b="Some required fields were not completed properly.\n";if($("contact").present())$("contact").removeClassName("bad_input");else{$("contact").addClassName("bad_input");b+="\n - Contact name is missing";a=false}if($("company").present())$("company").removeClassName("bad_input");else{$("company").addClassName("bad_input");b+="\n - Company name is missing";a=false}if($("role").present())$("role").removeClassName("bad_input");else{$("role").addClassName("bad_input");
b+="\n - role/position is missing";a=false}if($("phone").present()||$("email").present()){$("phone").removeClassName("bad_input");$("email").removeClassName("bad_input")}else{b+="\n - a phone number or email address must be provided";$("phone").addClassName("bad_input");$("email").addClassName("bad_input");a=false}if($("email").present()){var c=$F("email").include("@");if(c){$("email").removeClassName("bad_input");c=$F("email").split("@");if(c[1]==null||c[1].include(".")==false){$("email").addClassName("bad_input");
b+="\n - email address is invalid";a=false}}else{$("email").addClassName("bad_input");b+="\n - email address is invalid";a=false}}if($("website").present())if($F("website")=="http://"){$("website").addClassName("bad_input");b+="\n - website is missing";a=false}else $("role").removeClassName("bad_input");else{$("website").addClassName("bad_input");b+="\n - website is missing";a=false}if($("location").present()||$("map_link").present())$("location").removeClassName("bad_input");else{b+="\n - a location or Google map URL must be provided";
$("location").addClassName("bad_input");a=false}if($RF("product")==null){a=false;b+="\n - product has not been selected"}if($RF("system_type")==null){a=false;b+="\n - configuration has not been selected"}if($("project_size").present())if(isNaN(Number($F("project_size")))){b+="\n - project size is non-numeric";$("project_size").addClassName("bad_input");a=false}else $("project_size").removeClassName("bad_input");else{b+="\n - project size is missing";$("project_size").addClassName("bad_input");a=false}if($RF("Mounting_preference")==
null){a=false;b+="\n - mounting preference has not been selected"}if($RF("timeframe")==null){a=false;b+="\n - purchase timeframe has not been selected"}if($("project_description").value==""||$("project_description").value=="undefined"){$("project_description").addClassName("bad_input");b+="\n - project description has not been provided";a=false}else $("project_description").removeClassName("bad_input");if($RF("Financing")==null){a=false;b+="\n\nAlso, indicate whether this project is financed"}a==
true?submit("salesform"):alert(b+"\n\nPlease review and correct these values.")}
function validatePartnersForm(){var a=true,b="Some required fields were not completed properly.\n";if($("company").present())$("company").removeClassName("bad_input");else{$("company").addClassName("bad_input");b+="\n - Company name is missing";a=false}if($("address").present())$("address").removeClassName("bad_input");else{$("address").addClassName("bad_input");b+="\n - address is missing";a=false}if($("city").present())$("city").removeClassName("bad_input");else{$("city").addClassName("bad_input");
b+="\n - city is missing";a=false}if($("state").present())$("state").removeClassName("bad_input");else{$("state").addClassName("bad_input");b+="\n - state/province is missing";a=false}if($("country").present())$("country").removeClassName("bad_input");else{$("country").addClassName("bad_input");b+="\n - country is missing";a=false}if($("website").present())if($F("website")=="http://"){$("website").addClassName("bad_input");b+="\n - website is missing";a=false}else $("website").removeClassName("bad_input");
else{$("website").addClassName("bad_input");b+="\n - website is missing";a=false}if($("contact").present())$("contact").removeClassName("bad_input");else{$("contact").addClassName("bad_input");b+="\n - contact name is missing";a=false}if($("role").present())$("role").removeClassName("bad_input");else{$("role").addClassName("bad_input");b+="\n - role/position is missing";a=false}if($("phone").present()||$("email").present()){$("phone").removeClassName("bad_input");$("email").removeClassName("bad_input")}else{b+=
"\n - a phone number or email address must be provided";$("phone").addClassName("bad_input");$("email").addClassName("bad_input");a=false}if($("email").present()){var c=$F("email").include("@");if(c){$("email").removeClassName("bad_input");c=$F("email").split("@");if(c[1]==null||c[1].include(".")==false){$("email").addClassName("bad_input");b+="\n - email address is invalid";a=false}}else{$("email").addClassName("bad_input");b+="\n - email address is invalid";a=false}}if($RF("business_type")==null){a=
false;b+="\n - business type has not been selected"}if($RF("business_territory")==null){a=false;b+="\n - business territory has not been selected"}if($RF("business_experience")==null){a=false;b+="\n - business experience has not been selected"}if($("business_description").value==""){$("business_description").addClassName("bad_input");b+="\n - description of experience/projects has not been provided";a=false}else $("business_description").removeClassName("bad_input");a==true?submit("partnersform"):
alert(b+"\n\nPlease review and correct these values.")}function go2rnt(){var a="go2rnt.php",b=null;a=new Ajax.Request(a,{method:"get",parameters:b})}function submit(a){var b=$(a).serialize(true),c=Object.toQueryString(b);b="ssi/widgets/log_form_entry.php";c="table="+a+"&"+c;a=a+"_div";a=new Ajax.Updater(a,b,{method:"post",parameters:c})};