﻿// JScript File

    /*
    ABCUpload6 Progress Upload Script
    */
    function StartUpload()
    {
        var thePos = this.location.href.lastIndexOf("/");
        
		theFeats = "top=200,left=200,height=205,width=440,directories=0,location=0,menubar=0,toolbar=0,resizable=1,scrollbars=0,status=0";
		theUniqueID = Math.floor(Math.random() * 1000000) * ((new Date()).getTime() % 1000);
		window.open("progress_bar.aspx?ProgressID=" + theUniqueID, theUniqueID, theFeats);
		document.forms[0].action = this.location.href.substring(thePos+1, this.location.href.length);
		document.forms[0].action += "&uploadid=" + theUniqueID;
		document.forms[0].method = "post";
		document.forms[0].enctype = "multipart/form-data";
		document.forms[0].submit();
		
		return true;
    }
    
    function wait() 
    {
        //this function is called by the BODY onLoad event

        //calls the launch() function 
        //and sends it the URL parameter after 5 seconds

         //edit the URL parameter to point to the web page to be opened 

         setTimeout("launch('http://www.emmitthouse.com')", 3 * 1000);
     }

    function launch(URL) 
    {
        //this function is called by the wait() function

        self.name = "opener";

         //opens another browser window to the specified URL parameter
         //new window opens to the specified size
        remote = open(URL, "remote", 
        "resizable,scrollbars,width=640,height=780,left=0,top=0");
    }
    
    /*
	  This function helps protect the email address from spam-bots that scan 
	  web pages for email addresses. Instead of using the email address directly, the 
	  encoded value is stored in the html and decoded when required.
	*/
	function sendEmail(encodedEmail)
	{
		// The encodedEmail is a string that contains the email address.
		// Each character in the email address has been converted into 
		// a two digit number (hex / base16). This function converts the
		// series of numbers back into the email address and displays the 
		// email client with the mailto: protocol.
		
		// holds the decoded email address
		var email = "";
		
		// go through and decode the email address
		for (i=0; i < encodedEmail.length;)
		{
			// holds each letter (2 digits)
			var letter = "";
			letter = encodedEmail.charAt(i) + encodedEmail.charAt(i+1)
			
			// build the real email address
			email += String.fromCharCode(parseInt(letter,16));
			i += 2;
		}
		
		// do the mailto: link
		location.href = "mailto:" + email;
	}
    
    /*
        Modal and Modeless dialog box
        Checks for supported dialog type to render()
    */
    var stringUrl;
    var stringWin;
    var winOpts;
    var diaOpts;
    
    function openWin(stringUrl,stringWin)
    {
	    if (window.showModalDialog)
	    {
  		    openWin = popDialog(stringUrl,stringWin);
	    }
	    else
	    {
  		    openWin = popUp(stringUrl,stringWin);
	    }
    }
    
	winOpts=('toolbar=no,location=no,directories=no,status=yes,');
	winOpts+=('menubar=no,scrollbars=no,resizable=no,');
	winOpts+=('left=125,top=175,width=340,height=350');
	
    function popUp(pPage,popWin)
    {
	    popUp = window.open(pPage,popWin,winOpts);
	}

	diaOpts=("dialogWidth:328px;dialogHeight:390px;edge:Raised;");
	diaOpts+=("center:Yes;help:No;resizable:No;status:Yes");

    function popDialog(dPage,dWin)
    {
	    window.showModalDialog(dPage,dWin,diaOpts);
	}
	
	//
    // USED TO ASSIGN CSS STYLES AT RUNTIME
    //
    // Fixes Issue of input.submit, input.button
    // when using Themes and Skins with ASP.NET
    //
    // USAGE: <body onload='DynamicStyle();'>
    //
    function DynamicStyle()
    {
        var el = document.getElementsByTagName('input');
        var i = 0;
        for ( i=0; i < el.length; i++ )
        {
            if ( el[i].getAttribute('type') )
            {
                if ( el[i].getAttribute('type') == "submit" )
                    el[i].className = 'submit';
                    
                if ( el[i].getAttribute('type') == "button" )
                    el[i].className = 'button';
            }
        }
    }