	function submitsearch()
	{
	  document.sr.submit();
	}

	var strPrev = "";

	function initVotes() {
		
		$('.accordionbars .accordionContent').hide();
		$('.accordionbars h4:first').toggleClass("active");
		$('.accordionbars .accordionContent:first').slideToggle(300);
		$(".accordionbars h4.head").click(function()
	
		{
			$(this).next("div.accordionContent").slideToggle(300).siblings("div.accordionContent").slideUp("slow");
			$(this).addClass("visited");

			if (strPrev == this.id){
				$(".content").toggleClass(this.id);
				$(this).toggleClass("active");
			}
			else
			{
				$(this).addClass("active").siblings(".accordionbars h4.head").removeClass("active");
				$(".content").addClass(this.id).removeClass(strPrev);
				strPrev = this.id;
			}
			return false;
		});
	 }

	var createButtonCont = function(cls){

		var buttonCont = document.createElement("p");
	
		buttonCont.className=cls;
		buttonCont.appendChild(createButtons("Previous","arrowLink prevButton"));
		buttonCont.appendChild(createButtons("Next","arrowLink nextButton"));

		return buttonCont;
	}

	var createButtons = function(label,cls){
		
		var button = document.createElement("a");
	
		button.className=cls;
		button.innerHTML=label;
		button.href="#";

		return button;
	}	

	$(document).ready(function() {
	
		initVotes();

		$("p.nextprev").before(createButtonCont("nextprevButtons"));
		$("p.nextprevButtons:first").empty().append(createButtons("Next","arrowLink nextButton"));
		$("p.nextprevButtons:last").empty().append(createButtons("Previous","arrowLink prevButton"));


		$("a.nextButton").click(function() {
			$(this).parents("div.accordionContent").next(".accordionbars h4.head").trigger("click");
	
			return false;
		});

			$("a.prevButton").click(function() {

				var $previousOne = $(this).parents("div.accordionContent").prev(".accordionbars h4.active");
		
				$previousOne = $previousOne.prev(".accordionbars h4.head");
				$previousOne = $previousOne.prev(".accordionbars h4.head");
				$previousOne.trigger("click");
		
				return false;
		
			});

	});
	
	function validate(myForm) {
		if(myForm.name.value=='') {
			alert("Please include your name");
			myForm.name.focus();
			return false;
		}
		
		if(myForm.company.value=='') {
			alert("Please include your company name");
			myForm.company.focus();
			return false;
		}
		
		if(myForm.email.value!='') {
			var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
			if (!myForm.email.value.match(re)) {
				alert("Please include a valid email address");
				myForm.email.focus();
				return false;
			}
		} else {
			alert("Please include a valid email address");
			myForm.email.focus();
			return false;
		}
		
		if(myForm.comments.value=='') {
			alert("Please include your comments");
			myForm.comments.focus();
			return false;
		}
		
		if(myForm.security_code.value=='') {
			alert("Please insert the security code");
			myForm.security_code.focus();
			return false;
		}
		
		myForm.Submit.disabled=true;
		myForm.Submit.value="please wait";
	
		 return true;
	}
	
	function validateShort(myForm) {
		if(myForm.form_name.value=='') {
			alert("Please include your name");
			myForm.form_name.focus();
			return false;
		}
		
		if(myForm.form_email.value!='') {
			var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
			if (!myForm.form_email.value.match(re)) {
				alert("Please include a valid email address");
				myForm.form_email.focus();
				return false;
			}
		} else {
			alert("Please include a valid email address");
			myForm.form_email.focus();
			return false;
		}
		
		if(myForm.form_comments.value=='') {
			alert("Please include your comments");
			myForm.form_comments.focus();
			return false;
		}
		
		if(myForm.security_code.value=='') {
			alert("Please insert the security code");
			myForm.security_code.focus();
			return false;
		}
	
		myForm.Submit.disabled=true;
		myForm.Submit.value="please wait";
	
		 return true;
	}


