﻿// JScript File

// JavaScript to interpolate random images into a page. 
     var ic = 9; // Number of alternative images 
     var xoxo = new Array(ic); 
                     // Array to hold filenames 
     xoxo[0] = "images/identiPIC_1.jpg"; 
     xoxo[1] = "images/identiPIC_2.jpg"; 
     xoxo[2] = "images/identiPIC_3.jpg"; 
     xoxo[3] = "images/identiPIC_4.jpg"; 
     xoxo[4] = "images/identiPIC_5.jpg"; 
     xoxo[5] = "images/identiPIC_6.jpg";
     xoxo[6] = "images/identiPIC_7.jpg";
     xoxo[7] = "images/identiPIC_8.jpg";
     xoxo[8] = "images/identiPIC_9.jpg";

     function pickRandom(range) 
     { 
       if (Math.random) return Math.round(Math.random() * (range-1)); 
       else 
       { 
          var now = new Date(); 
          return (now.getTime() / 1000) % range; 
       } 
     } // Write out an IMG tag, using a randomly-chosen image name. 

    var choice = pickRandom(ic); // --> 
	
	
	function MM_validateForm() { //v4.0
	
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  }
	
	 var sel1 = document.getElementById("identiPIC_selected").options[document.getElementById("identiPIC_selected").selectedIndex].value; 
  if(sel1!=choice)
    errors += "- Please select correct image option\n";
   
  if (errors) alert('The following error(s) occurred:\n'+errors);  
  document.MM_returnValue = (errors == '');
  }
 