/* ----- 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 10,000 performances."
text[number++] = "Riverdance has been seen live by over 21 million people in over 300 venues worldwide, throughout 32 countries across 4 continents"
text[number++] = "The Riverdance companies have travelled over 563,000 miles (or to the moon and back!)."
text[number++] = "Riverdance has played to a global television audience of over 2 billion people"
text[number++] = "The Grammy Award-winning Riverdance CD has sold over 3 million copies"
text[number++] = "Over 10 million Riverdance videos/DVDs have been sold"
text[number++] = "1,500 Irish Dancers have performed in Riverdance"
text[number++] = "14,000 dance shoes have been used in Riverdance"
text[number++] = "12,000 costumes have been worn in the show"
text[number++] = "There have been 35 marriages between Riverdance company members "
text[number++] = "There have been 20,000 cumulative years of study in step-dancing by Riverdance Irish Dancers"
// 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
form_ok=false;

function requiredFields () 
{
	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);
			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].email
	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 HH_swapImage(id) { //v3.0
	if(document.getElementById(id) != null){
	  document.getElementById(id + "_on").style.display = "block";
	  document.getElementById(id).style.display = "none";
	  if(document.getElementById("Image400_on").style.display == "block" && id != "Image400"){
		  //document.getElementById("Image400_on").style.display = "none";
		  //document.getElementById("Image400").style.display = "block";
	  }
	}
}
function HH_swapImgRestore(id) { //v3.0
	document.getElementById(id + "_on").style.display = "none";
	//document.getElementById(id).style.display = "block";
}
function showdiv(id) { //v3.0
	  document.getElementById(id + "_on").style.display = "block";
	  //document.getElementById(id).style.display = "none";
}

function IsEmailValid1()
{
	var EmailOk  = true
	var Temp     = document.getElementById("email")
	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 formcheck() 
{
	
	if(document.getElementById("email").value == "" || !IsEmailValid1()){
		alert('Please enter a valid e-mail address!');
		document.getElementById("email").focus();
	}
	else{
		document.getElementById('form1').submit();
	}
}

