function open_login() {
	  if (document.getElementById('login_area').style.display == 'none') {
		  $("#suscribtion_area").hide("fast");
		  $("#login_area").show("medium");
	  } else {
		  $("#login_area").hide("medium");
	  }
}

function open_suscribtion() {
	  if (document.getElementById('suscribtion_area').style.display == 'none') {
		  $("#login_area").hide("fast");
		  $("#suscribtion_area").show("medium");
	  } else {
		  $("#suscribtion_area").hide("medium");
	  }
}

function photo_slideshow_pos() {
	if (document.getElementById('dp_photoslideshow').style.display == 'none') {
		  $("#dp_photoslideshow").hide("fast");
	  } else {
		  $("#dp_photoslideshow").hide("fast");
	  }
}

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

function perform_google_search() {
	object_to_search=document.getElementById("google_search");
		if (object_to_search.value.length>0) {
			window.location='http://www.google.com/search?as_sitesearch=dontpaniconline.com&q='+object_to_search.value+'&sa=Go';
	}
}

function perform_magazine_search() {
	object_to_search=document.getElementById("mag_search");
		if (object_to_search.value.length>0) {
			window.location='/magazine/search/'+object_to_search.value;
	}
}

function set_rate_choice(choice) {
	if (choice=='positive') {
		document.getElementById("type_of_vote").value=choice;
	} else {
		if (choice=='negative') {
			document.getElementById("type_of_vote").value=choice;
		} else {
			document.getElementById("type_of_vote").value='undefined';
		}
	}
}

function jump_to_url (id_to_fetch) {
	url_to_jump=document.getElementById(id_to_fetch).value;
	window.location=url_to_jump;
}

function filtrate_events(cat, city) {
		
	var from=document.getElementById('start_date').value;
	var to=document.getElementById('end_date').value;

	if (from.length > 9 && to.length > 9) {
		if (cat!='') {
			if (city!='') {
				window.location='http://www.dontpaniconline.com/events/'+cat+'/'+city+'/?from='+from+"&to="+to;
			} else {
				window.location='http://www.dontpaniconline.com/events/'+cat+'/?from='+from+"&to="+to;
			}
	
		} else {
			if (city!='') {
				window.location='http://www.dontpaniconline.com/events/'+city+'/?from='+from+"&to="+to;
			} else {
				window.location='http://www.dontpaniconline.com/events/?from='+from+"&to="+to;
			}
		}
	}
}

function final_poster_price() {
	var new_final_price = document.getElementById('postage_options').value;
	document.buy_poster_form.amount.value = new_final_price;
	$("#price_to_pay").hide("fast");
	$("#price_to_pay").html("Price to pay: <b>&pound;"+new_final_price+"</b>");
	$("#price_to_pay").show("medium");
}

function fetch_address() {
	document.buy_poster_form.MC_delivery_address.value = document.buy_poster_form.delivery_address.value;
	document.buy_poster_form.MC_post_code.value = document.buy_poster_form.post_code.value;
}



	function settype(type) {
		document.buy_poster_form.poster_type_chosen.value = type;
	}