﻿// JScript File

// flash stuff:
    function flashFunc(func, args)
    {        
        try
        {
            flashID = element("flashID");
            flashID.SetVariable('myFunction',func);
            flashID.SetVariable('args',args);  
        }
        catch(err)
        {
        }
    }
    
    function flashLabel(lbl)
    {
        if (lbl == "R" && cb160.checked)
        {
            set160OffsetLoadAnimation();
        }
        else if (lbl == "R" && cbLC.checked)
        {
            setLCOffsetLoadAnimation();
        }
        else if (lbl == "A" && cb160.checked )
        {
            set160AngleAnimation();
        }
        else if (lbl == "A" && cbLC.checked )
        {
            setLCAngleAnimation();
        }
        
        else if (cb160.checked)
        {
            set160Animation();
        }
        else if (cbLC.checked)
        {
            setLCAnimation();
        }
        
    
        flashFunc('setHighlight', lbl );
    }
    
    function flashID_DoFSCommand(command, args) 
    {
	    if (command == "set_focus")
	    {
	        var name = "txt" + args;
	        var focusOn =  element(name);
	        focusOn.focus();     
	        var t=setTimeout('document.getElementById("' + name + '").select()',0);       
	    }
	}		
	
	
	    function set160AngleAnimation()
    {
        var so = new SWFObject("images/160_Angle.swf", "flashID", "140", "145", "7", "#336699");
        
        so.name = "flashID";
        so.altTxt = '<img src="images/160_Angle.jpg" alt="For best results, please install Flash Player" />';
        so.addVariable("name", "flashID");
        // so.addVariable("swLiveConnect", "true");
        so.write("flashcontent"); 
        flashID = element("flashID");
        if (flashID)
        {
            flashID.name = "flashID";
        }
        else
        {
            element("flashcontent").innerHTML = so.altTxt;
        }
    }
    
    function set160OffsetLoadAnimation()
    {
        var so = new SWFObject("images/160_OffsetLoad.swf", "flashID", "147", "153", "7", "#336699");
        
        so.name = "flashID";
        so.altTxt = '<img src="images/160_OffsetLoad.jpg" alt="For best results, please install Flash Player" />';
        so.addVariable("name", "flashID");
        // so.addVariable("swLiveConnect", "true");
        so.write("flashcontent"); 
        flashID = element("flashID");
        if (flashID)  
        {
            flashID.name = "flashID";
        }
        else
        {
            element("flashcontent").innerHTML = so.altTxt;
        }
    }

    function set160Animation()
    {
    
        if (rbGravity.checked)
        {
            var so = new SWFObject("images/160_Escapement.swf", "flashID", "147", "153", "7", "#336699");
            so.altTxt = '<img src="images/160_Escapement.jpg" alt="For best results, please install Flash Player" />';
        }
        else
        {
            var so = new SWFObject("images/160_ConveyorBelt.swf", "flashID", "147", "153", "7", "#336699");
            so.altTxt = '<img src="images/160_ConveyorBelt.jpg" alt="For best results, please install Flash Player" />';
        }
    
        so.name = "flashID";
        so.addVariable("name", "flashID");        
        so.write("flashcontent");        
        flashID = element("flashID"); 
        if (flashID)        
        {
            flashID.name = "flashID";  
        }
        else
        {
            element("flashcontent").innerHTML = so.altTxt;
        }
    }
    
    function setLCAnimation()
    {
        if (rbGravity.checked)
        {
            var so = new SWFObject("images/LC_escapement.swf", "flashID", "147", "153", "7", "#336699");
            so.altTxt = '<img src="images/LC_escapement.jpg" alt="For best results, please install Flash Player" />';
        }
        else
        {
            var so = new SWFObject("images/LC_ConveyorBelt.swf", "flashID", "147", "153", "7", "#336699");
            so.altTxt = '<img src="images/LC_ConveyorBelt.jpg" alt="For best results, please install Flash Player" />';
        }
        
        so.name = "flashID";        
        so.addVariable("name", "flashID");
        // so.addVariable("swLiveConnect", "true");
        so.write("flashcontent"); 
        flashID = element("flashID");
        if (flashID)  
        {
            flashID.name = "flashID";
        }
        else
        {
            element("flashcontent").innerHTML = so.altTxt;
        }
    }
    
    
    function setLCAngleAnimation()
    {
        var so = new SWFObject("images/LC_Angle.swf", "flashID", "147", "153", "7", "#336699");
        
        so.name = "flashID";
        so.altTxt = '<img src="images/LC_Angle.jpg" alt="For best results, please install Flash Player" />';
        so.addVariable("name", "flashID");
        // so.addVariable("swLiveConnect", "true");
        so.write("flashcontent"); 
        flashID = element("flashID");
        if (flashID)  
        {
            flashID.name = "flashID";
        }
        else
        {
            element("flashcontent").innerHTML = so.altTxt;
        }
    }
    
    function setLCOffsetLoadAnimation()
    {
        var so = new SWFObject("images/LC_OffsetLoad.swf", "flashID", "147", "153", "7", "#336699");
        
        so.name = "flashID";
        so.altTxt = '<img src="images/LC_OffsetLoad.jpg" alt="For best results, please install Flash Player" />';
        so.addVariable("name", "flashID");
        // so.addVariable("swLiveConnect", "true");
        so.write("flashcontent"); 
        flashID = element("flashID");
        if (flashID)  
        {
            flashID.name = "flashID";
        }
        else
        {
            element("flashcontent").innerHTML = so.altTxt;
        }
    }


// This function is responsible for controling the flash content of the page,
// highlighting, rotating or whatever else we have to do with it.
function activate(label)
{           
    // used for flash stuff- supposed to highlight the N and W. - Phase 2
    var movie = document.getElementById('flashclip');
    return;
} 	