/* ----- Generic Scripts, Rollovers etc----- */
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_findObj(n, d) { //v3.0
  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); 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_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->



// Random Text Generator


function text() {
};

text = new text();
number = 0;

// textArray
text[number++] = "Riverdance has played over 8,000 performances."
text[number++] = "Riverdance has been seen live by over 18 million people in over 250 venues worldwide, throughout 30 countries across 4 continents."
text[number++] = "The Riverdance companies have travelled over 500,000 miles (or to the moon and back!)."
text[number++] = "Riverdance has played to a global television audience of over 1.5 billion people."
text[number++] = "The Grammy Award-winning Riverdance CD has sold over 2.5 million copies."
text[number++] = "Over 9 million Riverdance videos/DVDs have been sold."
text[number++] = "The Grammy Award-winning Riverdance CD has sold over 2.5 million copies."
text[number++] = "1,200 Irish Dancers have performed in Riverdance."
text[number++] = "12,000 dance shoes have been used in Riverdance."
text[number++] = "9,000 costumes have been worn in the show."
text[number++] = "150,000 gallons of water have been consumed."
text[number++] = "40,000 gallons of Gatorade have been consumed."
text[number++] = "1,200,000 Riverdance show programmes have been sold."
text[number++] = "1,450 flight cases have been used."
text[number++] = "10,000 stage lighting bulbs have been used."
text[number++] = "32,000 boxes of tissues have been used."
text[number++] = "15,500 guitar, bass and fiddle strings have been replaced."
text[number++] = "200,000 Riverdance T-shirts have been sold."
text[number++] = "There have been 28 marriages between Riverdance company members."
text[number++] = "There have been 17,500 cumulative years of study in step-dancing by Riverdance Irish Dancers."
text[number++] = "38,400 rolls of self-grip tape have been used by Riverdance physiotherapists."
text[number++] = "There have been 12,000 hours of rehearsals on tour."
text[number++] = "38,400 rolls of self-grip tape have been used by Riverdance physiotherapists."
text[number++] = "4,500,000 pounds of dry ice have been used on stage."
text[number++] = "48,000 pounds of chocolate have been consumed (for energy!) by the cast."
// keep adding items here...

increment = Math.floor(Math.random() * number);


// Blog Content

function drawBlog() {
document.write("<a href=\"http://www.riverdance.com/htm/accessallareas/on_tour/index.htm\" class=\"content_link\"><strong>Blog</strong></a><br>Our Riverdance Bloggers share their experiences as they tour the world.");
}

// Tour Content

function drawComp() {
document.write("<a href=\"http://www.riverdance.com/htm/accessallareas/competition/index.htm\" class=\"content_link\"><strong>Competition</strong></a><br> Win great Riverdance prizes in our regular competitions.");
}

function drawTour() {
document.write("<a href=\"http://www.riverdance.com/htm/theshop/music_videos/index.htm\" class=\"content_link\"><strong>Merchandise</strong></a><br>Riverdance Live from RCNY DVD, Best of Riverdance DVD, Riverdance Slipperjigs.");
}

// Music Player

function popupnr(mylink, windowname, refocus)
{
var mywin, href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
mywin = window.open('', windowname, 'width=180,height=120,scrollbars=no');
// if we just opened the window
if (
mywin.closed || 
(! mywin.document.URL) || 
(mywin.document.URL.indexOf("about") == 0)
)
mywin.location=href;
else if (refocus)
mywin.focus();
return false;
}


// The Shop

function checkData () {
                alert("This item has been added to your shopping cart.");
}
                                


// Required Fields
b_name = navigator.appName;
b_vers = parseInt(navigator.appVersion);
focus_ok = (b_name == "Netscape" && b_vers >= 3) || (b_name == "Microsoft Internet Explorer" && b_vers >= 4);
ie3 = b_name == "Microsoft Internet Explporer" && b_vers == 2;
browser = focus_ok || ie3;


form_ok = false;

function requiredFields () 
{
	if (browser) 
	{	
		if ((!document.forms[1].q1[0].checked)&&(!document.forms[1].q1[1].checked)&&(!document.forms[1].q1[2].checked))
		{
			alert("Choose an answer for question 1");
		}
		else
		if ((!document.forms[1].q2[0].checked)&&(!document.forms[1].q2[1].checked)&&(!document.forms[1].q2[2].checked))
		{
			alert("Choose an answer for question 2");
		}
		else
		{
			reqFields = document.forms[1].required_fields.value;
			if (reqFields != "none") 
			{ 
				reqFields = reqFields.split(",");
				for(i=0;i<reqFields.length;i++) 
				{
					fieldObj = eval("document.forms[1]." + reqFields[i]);
					fieldVal = fieldObj.value;
					fieldName = fieldObj.name;
					if (fieldVal == "") 
					{
						form_ok = false;
						alert("Please enter your " + fieldName);
						if (focus_ok) fieldObj.focus();
						break;
					}
					else form_ok = true;
				}
				if ( form_ok && !IsEmailValid() ) 
				{
					form_ok = false;
				}
			}
		}
	}
	return form_ok;
}
				
function IsEmailValid()
{
	var EmailOk  = true
	var Temp     = document.forms[1].e_mail
	var AtSym    = Temp.value.indexOf('@')
	var Period   = Temp.value.lastIndexOf('.')
	var Space    = Temp.value.indexOf(' ')
	var Length   = Temp.value.length - 1   // Array is from 0 to length-1
	
	if ((AtSym < 1) ||                     // '@' cannot be in first position
	    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
	    (Period == Length ) ||             // Must be atleast one valid char after '.'
	    (Space  != -1))                    // No empty spaces permitted
	   {  
	      EmailOk = false
	      alert('Please enter a valid e-mail address!')
	      Temp.focus()
	   }
	return EmailOk
}



function isString (obj,objNum) {
	if (browser) {
		if (CheckingNum == 0) CheckingNum = objNum;
		if (objNum == CheckingNum) {
			if (obj.value == "") {
				alert("This field is required.");
				if (focus_ok) obj.focus();
			}
			else CheckingNum = 0;
		}
	}
}