// JavaScript Document
// begin top Navigation Script
//activateMenu = function(nav) {
/*function shipsame(form){
alert ('included');

if(form.cntnt01sameasbilling.checked){

     form.cntnt01bill_first.value = form.cntnt01ship_first.value;
     form.cntnt01bill_last.value = form.cntnt01ship_last.value;
     form.cntnt01bill_addr.value = form.cntnt01ship_addr.value;
     form.cntnt01bill_addr2.value = form.cntnt01ship_addr2.value;     
     form.cntnt01bill_city.value = form.cntnt01ship_city.value;
     form.cntnt01bill_zip.value = form.cntnt01ship_zip.value;
     form.cntnt01bill_phone.value = form.cntnt01ship_phone.value;     
     form.cntnt01bill_cell.value = form.cntnt01ship_cell.value;
     
     if(form.cntnt01bill_state.type == "Select"){
          var bStateIdx = form.cntnt01ship_state.selectedIndex;
          form.cntnt01bill_state.options[bStateIdx].selected = true;
     }
     else{
          form.cntnt01bill_state.value = form.cntnt01ship_state.value;
     }
}
else{
     form.cntnt01bill_first.value = "";
     form.cntnt01bill_last.value = "";
     form.cntnt01bill_addr.value = "";
     form.cntnt01bill_addr2.value = "";     
     form.cntnt01bill_city.value = "";
     if(form.cntnt01bill_phone.type == "Select"){
          form.cntnt01bill_state.options[0].selected = true;
     }
     else{
          form.cntnt01bill_state.value = "";
     }
     form.cntnt01bill_city.value = "";
     form.cntnt01bill_zip.value = "";
     form.cntnt01bill_phone.value = "";
     form.cntnt01bill_cell.value = "";
}
}*/
/* currentStyle restricts the Javascript to IE only 
	if (document.all &&
 document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);*/
        
        /* Get all the list items within the menu 

        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {*/
        
           /* If the LI has another menu level 
            if(lis[i].lastChild.tagName=="UL"){*/
            
                /* assign the function to the LI 
             	lis[i].onmouseover=function() {	*/
                
                   /* display the inner menu 
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
window.onload= function(){*/
    /* pass the function the id of the top level UL */

    /* remove one, when only using one menu 
    activateMenu('nav'); 
    activateMenu('vertnav'); 
}*/
function window_return()
{
alert ('here');
alert ('href='+this.href);
	//window.close();
	return this.href;
}
function terminate()
{
  var o = new Object();
  o.forename = document.getElementById("txtForename").value;
  o.surname = document.getElementById("txtSurname").value;
  window.returnValue = o; 
}
function popup(location_href,bank) {
//alert ('location_href='+location_href);
  F = window.open("index.php?page=leaving-site&loc="+location_href,"popup","width=400,height=300");
  //var oReturnValue = showModalDialog("index.php?page=notice");
 // alert("F="+F.href.link);
  //alert(F.forename + "\n" + F.surname);
  return false;
}
function f_open_window_max( aURL, aWinName )
{
   var wOpen;
   var sOptions;


   sOptions = 'directories=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}
/*sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
sel = document.getElementsByTagName("select");
for (var i=0; i<sel.length; i++) {
sel[i].style.visibility = 'hidden';
}
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
sel = document.getElementsByTagName("select");
for (var i=0; i<sel.length; i++) {
sel[i].style.visibility = 'visible';
}
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

*/
/* Highlight input text elements */


function SelectAll(id)
{
document.getElementById(id).focus();
document.getElementById(id).select();
}


/* end */
// JavaScript Document
// begin top Navigation Script
//activateMenu = function(nav) {

/* currentStyle restricts the Javascript to IE only 
	if (document.all &&
 document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);*/
        
        /* Get all the list items within the menu 

        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {*/
        
           /* If the LI has another menu level 
            if(lis[i].lastChild.tagName=="UL"){*/
            
                /* assign the function to the LI 
             	lis[i].onmouseover=function() {	*/
                
                   /* display the inner menu 
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
window.onload= function(){*/
    /* pass the function the id of the top level UL */

    /* remove one, when only using one menu 
    activateMenu('nav'); 
    activateMenu('vertnav'); 
}*/
function window_return()
{
alert ('here');
alert ('href='+this.href);
	//window.close();
	return this.href;
}
function terminate()
{
  var o = new Object();
  o.forename = document.getElementById("txtForename").value;
  o.surname = document.getElementById("txtSurname").value;
  window.returnValue = o; 
}
function popup(location_href,bank) {
//alert ('location_href='+location_href);
  F = window.open("index.php?page=leaving-site&loc="+location_href,"popup","width=400,height=300");
  //var oReturnValue = showModalDialog("index.php?page=notice");
 // alert("F="+F.href.link);
  //alert(F.forename + "\n" + F.surname);
  return false;
}
function f_open_window_max( aURL, aWinName )
{
   var wOpen;
   var sOptions;


   sOptions = 'directories=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}
/*sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
sel = document.getElementsByTagName("select");
for (var i=0; i<sel.length; i++) {
sel[i].style.visibility = 'hidden';
}
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
sel = document.getElementsByTagName("select");
for (var i=0; i<sel.length; i++) {
sel[i].style.visibility = 'visible';
}
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

*/
/* Highlight input text elements */


function SelectAll(id)
{
document.getElementById(id).focus();
document.getElementById(id).select();
}

var currentState;
var playingFlag=false;
var currentPosition;
var currentVolume;
var currentItem;

function sendEvent(typ,prm) { thisMovie("videoplayer").sendEvent(typ,prm); };
function getUpdate2(typ,pr1,pr2,pid) {
     //sendEvent("stop");
	if(pid != "null") {
		if((typ == "state")&&(pr1 != undefined)) { 
			currentState = pr1;
                        //alert ('playingFlag='+playingFlag);
                        //filename = getUrlVars();
                     // alert ('currentState='+currentState);
                      
							if(currentState=="0") {
                                if (!playingFlag){
                                    playingFlag = true;
                                   //sendEvent('stop');
                                }
                                else{
                                   // itemnum = getPlayItem();
                                    //alert ('item='+itemnum);
                                   // sendEvent('playitem', 1);
                                }

			}
		}
	}
};

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};
        function getPlayItem()
        {
            filearray = getPlaylist();
            element = getUrlVars();
            for(var i=0; i<filearray.length; i++){
                if(filearray[i] == element){
                    return i;
                }
            }
            return -1;


        }
        function getPlaylist()
        {
            filearray = new Array(
                    'APLS_fall_harvest.flv',
                    'APLS_race.flv',
                    'APLS_spin_to_win.flv',
                    'BWF_grand_open_486.flv',
                    'BWF_halftime.flv',
                    'BWF_pick_your_room.flv',
                    'EZR_march_hoopla.flv',
                    'HRP_3_rooms.flv',
                    'HRP_get_it_486.flv',
                    'HRP_tis_season.flv',
                    'KELY_sweet_486.flv',
                    'R1_excitement.flv',
                    'R1_lucky_21_B.flv',
                    'R1_modern_marvels.flv',
                    'R1_summer52.flv',
                    'R1_tribute_to_you.flv',
                    'RCTY_25_year_B.flv',
                    'RCTY_take_me_home.flv',
                    'RCTY_tax_486.flv',
                    'STAT_8mo_SAC.flv',
                    'STAT_just_say_no.flv',
                    'UHR_gotta_go.flv',
                    'UHR_in_the_action.flv'
                    );
            return filearray;
        }
        function getUrlVars()
        {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for(var i = 0; i < hashes.length; i++)
            {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return hash[1];
        }
        function getPlaylistFile()
        {
            fh = fopen("playlist.xml", 0);
            if(fh!=-1) // Success
            {
                length = flength(fh);         
                str = fread(fh, length);   
                fclose(fh);                    
                alert(str);
                return str;
            }
            else
                return "error";
        }
	function getUpdate(typ,pr1,pr2,pid) {
	if (pid != "options"){
//	alert ("pid="+pid);
			if(typ == "time") { currentPosition = pr1; }
			else if(typ == "volume") { currentVolume = pr1; }
			else if(typ == "item") { 
				//alert ("pr1="+pr1);
				currentItem = pr1; 
				setTimeout("getItemData(currentItem)",100);		
				}
			var id = document.getElementById(typ);
			id.innerHTML = typ+ ": "+Math.round(pr1);
			pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
			if(pid != "null") {
				document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
			}
		}
	};
	
        function getItemData(idx) {
       // alert ('getItemData');
			var obj = thisMovie("videoplayer").itemData(idx);
			var nodes = "";
			for(var i in obj) { 
				if (i == "title")
					nodes = "Now Playing&nbsp;:&nbsp;"+obj[i];
					//nodes += "<li>"+i+": "+obj[i]+"</li>"; 
			
			}
			document.getElementById("nowplaying").innerHTML = nodes;
		};
      function createPlayer(player, playlist, divid, pname, width, height) {

       //createPlayer(player, playlist, divid, pname, width, height) {
       
       if (pname == "options")
       {
        	dwidth = width * 2;
        	linkfromdisplay = true;
        	overstretch = 'none';
        	repeat = "list";

        }
        else
        {
        	dwidth = width;
        	linkfromdisplay = false;
        	overstretch = false;
        	repeat = false
        	
        }
	whichPlayer = player;
          var so = new SWFObject(whichPlayer,pname,width,height,'7');
            so.addParam('allowfullscreen','false');
            so.addParam('allowscriptaccess','true');
            so.addVariable("file",playlist);
            so.addVariable('height',height);            
            so.addVariable('volume','100');
	        so.addVariable("rotatetime","1");              
            so.addVariable("enablejs","true");    
            so.addVariable('width',width);
            so.addVariable('autoscroll','false');
            so.addVariable('displaywidth',dwidth);
            so.addVariable('displayheight',height);
            so.addVariable('linkfromdisplay',linkfromdisplay);
            so.addVariable('repeat',repeat);
            
            so.addVariable('overstretch',overstretch);
            so.addVariable('thumbsinplaylist','false');
            so.addVariable("showicons","false");
            so.addVariable("javascriptid",pname);
            so.addVariable("autostart","true");
            so.addParam("menu","false");	
            so.write(divid);
        }
        

/* end */