%@ LANGUAGE=JavaScript %>
<% // // get parameters // var requestType = Request.ServerVariables( "REQUEST_METHOD" ); var serverName = Request.ServerVariables( "SERVER_NAME" ); var scriptName = Request.ServerVariables( "SCRIPT_NAME" ); var pageTitle = Request( "pagetitle" ); var imageWidth = Request( "imagewidth" ); var imageHeight = Request( "imageheight" ); var imageCount = Request( "imagecount" ); var imageDups = Request( "imagedups" ); var filePrefix = Request( "fileprefix" ); var fileSuffix = Request( "filesuffix" ); // // set defaults // var Empty = Request.ServerVariables( "EMPTY" ); var limit = 5; var nTemp; var strTitle = ( ( pageTitle && ( pageTitle != Empty ) ) ? pageTitle : "Multi-Deck Shuffler" ); nTemp = parseInt( imageCount ); var nCount = ( isNaN( nTemp ) ? 13 : nTemp ); nTemp = parseInt( imageDups ); var nDups = ( isNaN( nTemp ) ? 4 : nTemp ); nTemp = parseInt( imageWidth ); var nWidth = ( isNaN( nTemp ) ? 150 : nTemp ); nTemp = parseInt( imageHeight ); var nHeight = ( isNaN( nTemp ) ? 240 : nTemp ); var strPrefix = ( ( filePrefix && ( filePrefix != Empty ) ) ? filePrefix : "card" ); var strSuffix = ( ( fileSuffix && ( fileSuffix != Empty ) ) ? fileSuffix : "/demo/.jpg" ); // // Shuffled Deck object definition // var shuffledDeckCard; var shuffledDeckDeck; function shuffledDeckInitialize( number ) { var i; var j; var k; if (number == 0 ) limit = 52; else limit = Math.abs( number ); shuffledDeckDeck = Array( limit ); for ( i = 0; i < limit; i++ ) shuffledDeckDeck[ i ] = i; for ( i = 0; i < limit; i++ ) { j = Math.floor( Math.random() * limit ); if ( i != j ) { if ( number <= 0 ) { shuffledDeckDeck[ i ] = shuffledDeckDeck[ i ] ^ (-1); } k = shuffledDeckDeck[ i ]; shuffledDeckDeck[ i ] = shuffledDeckDeck[ j ]; shuffledDeckDeck[ j ] = k; } } shuffledDeckCard = 0; } function shuffledDeckNext() { if (shuffledDeckCard < limit) return shuffledDeckDeck[ shuffledDeckCard++ ]; else return limit; } function shuffledDeckHasNext() { return ( shuffledDeckCard < limit ); } // // shuffle and deal cards // shuffledDeckInitialize( nDups * nCount ); var cards = Array( limit ) var index; for ( index = 0; index < limit; index++ ) cards[ index ] = Math.floor( shuffledDeckNext() / nDups ); // // generate HTML for one card // function displayCard( j ) { return ""; } %><%= displayCard( cards[ 4 ] ) %> | " > | <%= displayCard( cards[ 0 ] ) %> |
<%= displayCard( cards[ 2 ] ) %> | <%= displayCard( cards[ 1 ] ) %> | <%= displayCard( cards[ 3 ] ) %> |