function changeBorder(divID,menuDisplay) {

	if (menuDisplay == 1) {
		document.getElementById(divID).style.display = 'block';
	} else if (menuDisplay == 0) {
		document.getElementById(divID).style.display = 'none';
	}
	
}

var scroll = true;
var scrollingText = "Put your email address here to hear about the latest, offers and events                                     ";

function scrollit1() {

	if (scroll) {
        document.scrolling.email.value = scrollingText;
        scrollingText = scrollingText.substring(1) +
                        scrollingText.substring(0,1);
		setTimeout('scrollit1()',200);
    } else {
		
		document.scrolling.email.value = '';
		
	}
}

function ticketmaster() { 
	alert('You are now entering a third party website.\rThe Ambassador Theatre Group website will now open in a new window.\rYou may return to the Donmar Warehouse website at any time by closing this new window.');
	
	//alert('Our online booking facility is currently under reconstruction.\nTo book tickets, please CALL the Box Office.');
}

function resize (winwidth,winheight) {
	window.resizeTo(winwidth,winheight);
	window.moveTo((screen.availWidth/2)-(winwidth/2),(screen.availHeight/2)-(winheight/2));

}

function newwindow(theURL,newname,width,height,features) {
	var vpos = (screen.height/2)-(height/2);
	var hpos = (screen.width/2)-(width/2);
	features = "width="+width+",height="+height+",top="+vpos+",left="+hpos+","+features;
	var win = window.open(theURL, newname, features);
	win.focus();
}


$(document).ready(function(){
	
	var $malingList = $("#mailinglist_left");
	var $form = $("form",$malingList);
	
	$form.attr("onsubmit", "return checkIfStudent(this)");
	
						   
});

function checkIfStudent(thisform) {
	
	var $student = $("#student");
	var $courseStarts = $("#courseStarts");
	var $courseEnds = $("#courseEnds");
		
	if($student.attr("checked") == true) {
		if($courseStarts.attr("value") == undefined) {
			alert("Sorry, but you need to enter a Course Start date.");
			return false;
		} else {
			return true;	
		}
	}
	
}
