// JavaScript Document

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindowFull(url) 
{
	var width = screen.width;
	var height = screen.height;
	var features = "width=" + width + ",height=" + height + ",scrollbars,resizable";

	
	newWindow = window.open(url,'win',features);
	newWindow.focus();

}


function MM_openBrWindow(theURL,winName,features) { //v2.0

		var temp = new Array();
		var multi = new Array();
		temp = features.split(',');
		
		for (i=0;i<temp.length;i++) {				
			multi[i] = temp[i].split('=');
			
				if (multi[i][0] == "width") {
					var width = multi[i][1];
				}
					if (multi[i][0] == "height") {
						var height = multi[i][1];
					}

		}
		
	leftpos = (screen.width - width) / 2;
	toppos = (screen.height - height) / 2;
	
	if (screen) {
		newfeatures = features + ",left="+leftpos+",top="+toppos+"";
	}

	 NewWindow = window.open(theURL,winName,newfeatures);
	 NewWindow.focus();
}


function validEmail(email) {
			invalidChars = " /:,;"
	
			for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)			// there must be one "@" symbol
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {					// and at least one "." after the "@"
				return false
			}
			if (periodPos+3 > email.length)	{		// must be at least 2 characters after the "."
				return false
			}
			return true
		}
function isNum(value) {

for (i=0; i<value.length; i++) {
	if (value.charAt(i) < "0") { return false; }
	if (value.charAt(i) > "9") { return false; }
}	

return true;

}

function validateEmail(theForm) {
	
	var emailValue = theForm.email.value;
	if (!emailValue) {
		alert ('You must enter an email address');
		theForm.email.focus();
		return false;
	}
	if (!validEmail(emailValue)) {
		alert('' + emailValue + ' is not a valid email address');
		theForm.email.focus();
		return false;
	}
}

function validateForm(theForm)
{
	var name = theForm.from.value;
	var guess = theForm.phone.value;

	if (name == "") {
		alert('Please enter your name');
		theForm.name.focus();
		return false;
	}	
	
	if (guess == "") {
		alert('Please enter your guess');
		theForm.guess.focus();
		return false;
	}	
	
	return true;
}


//JW Player Functions

function sendEvent(swf,typ,prm) { 
  thisMovie(swf).sendEvent(typ,prm); 
};
function getUpdate(typ,pr1,pr2,swf) {
  if(typ == 'time') { if (pr1 == 184) window.location.href="http://www.wherewilltheyrocknext.com/wwtrn_announce_thankyou.html"; }
}
function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
};