/**
*	Abstraction of the javascript functions from a jsp into a .js files to
*	be included via a javascript include on the page instead of a jsp include directive
*	
*	modified by Lew L Breeze
*	modified on 09/26/03
*/

//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 rotate(imgpath) {
	//var ImagePath = imgpath;
	var ImgNum = 85;
	var roImg = new Array();
	
	for (var ti = 1; ti < ImgNum; ti++) {
		roImg[ti] = imgpath + "/imgs/TopRoll/" + ti + ".jpg";
	}
	
	imgCt = roImg.length;
	
	if (document.images) {
		thisImg=Math.floor(Math.random()*ImgNum);
		thisImg2=Math.floor(Math.random()*ImgNum);
		thisImg3=Math.floor(Math.random()*ImgNum);
		if (thisImg <= 0) thisImg = 10;
		if (thisImg2 <= 0) thisImg2 = 20;
		if (thisImg3 <= 0) thisImg3 = 30;    
		if (thisImg >= ImgNum) thisImg = 15;
		if (thisImg2 >= ImgNum) thisImg2 = 25;
		if (thisImg3 >= ImgNum) thisImg3 = 35;
		if (thisImg == thisImg2) thisImg2 = thisImg+1;
		if (thisImg == thisImg3) thisImg3 = thisImg+1;
		if (thisImg2 == thisImg3) thisImg3 = thisImg2+1;
				
		document.rotat.src = roImg[thisImg];
		document.rotat2.src = roImg[thisImg2];
		document.rotat3.src = roImg[thisImg3];
		setTimeout("rotate('" + imgpath + "');", 7 * 1000);
	}		
}
	
function leapto(form) {
  var uid = new Date().getTime(); 
  var myindex=form.dest.selectedIndex; 
  str = new String(form.dest.options[myindex].value); 
  var REG_EXP = /[" "]/gi;    
  var strA =str.replace(REG_EXP,"%20");
  strarray = strA.split(/\,/);
  //alert (strarray[1]);
  if (strarray[0] == "popup") { // loads in popup
    window.open(strarray[1], uid, "resizable=yes,toolbar=1,scrollbars=1,location=0,statusbars=1,menubar=1,width=700,height=600,top=0,left=99");
    myindex = 0;
  }
  else {
    parent.location.href = strarray[1];
  } 
}

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 winOpenVT(url) {
  popupWin = window.open(url, 'win', 'toolbar,scrollbars,width=700,height=650,left=100,top=0,resizable=yes')
}

function leaptoOld(form) {
  var uid = new Date().getTime(); // unique ID to name popup
  var myindex=form.dest.selectedIndex; // number of selection
  str = new String(form.dest.options[myindex].value); // value of selection
  strarray = str.split(/\,/); // splits value on a comma

  if (strarray[0] == "popup") { // loads in popup
    window.open(strarray[1], uid, "resizable=yes,toolbar=1,scrollbars=1,location=0,statusbars=1,menubar=1,width=700,height=600,top=0,left=99");
    myindex = 0;
  }
  else {
    parent.location.href = strarray[1];
  }
}

function leapto2(form) {
  var uid = new Date().getTime(); // unique ID to name popup
  var myindex=form.dest.selectedIndex; // number of selection
  var myindex2=form.dest2.selectedIndex;
  var myindex3=form.dest3.selectedIndex;
  
  str = new String(form.dest.options[myindex].value); // value of selection
  str2 = new String(form.dest2.options[myindex2].value);
  str3 = new String(form.dest3.options[myindex3].value);
   var REG_EXP = /[" "]/gi;    
  var str2 =str.replace(REG_EXP,"%20");
  strarray = str2.split(/\,/); // splits value on a comma

  if (strarray[0] == "popup") { // loads in popup
    window.open(strarray[1], uid, "resizable=yes,toolbar=1,scrollbars=1,location=0,statusbars=1,menubar=1,width=700,height=600,top=0,left=99");
    myindex = 0;
  }
  else {
    parent.location.href = strarray[1] + str2 + str3;
  }
}

function leapto3(form) {

  var uid = new Date().getTime(); // unique ID to name popup
  var myindex=form.dest.selectedIndex; // number of selection
  var myindex2=form.dest2.selectedIndex;
  var myindex3=form.dest3.selectedIndex;
  var myindex4=form.dest4.selectedIndex;
  var myindex5=form.dest5.selectedIndex;
  var myindex6=form.dest6.selectedIndex;
  var myindex7=form.dest7.selectedIndex;
  var myindex8=form.dest8.selectedIndex;
  
  str = new String(form.dest.options[myindex].value); // value of selection
  str2 = new String(form.dest2.options[myindex2].value);
  str3 = new String(form.dest3.options[myindex3].value);
  str4 = new String(form.dest4.options[myindex4].value);
  str5 = new String(form.dest5.options[myindex5].value);
  str6 = new String(form.dest6.options[myindex6].value);
  str7 = new String(form.dest7.options[myindex7].value);
  str8 = new String(form.dest8.options[myindex8].value);
  
  strarray = str.split(/\,/); // splits value on a comma
if (strarray[0] == "none"){
    parent.location.href = strarray[1] + str2 + str3 + str4 + str5 + str6 + str7 + str8;
  }
  
  if (strarray[0] == "popup") { // loads in popup
    window.open(strarray[1], uid, "resizable=yes,toolbar=1,scrollbars=1,location=0,statusbars=1,menubar=1,width=700,height=600,top=0,left=99");
    myindex = 0;
  }
  else {
    parent.location.href = strarray[1] + str2 + str3 + str4 + str5 + str6 + str7 + str8;
  }
}

