﻿// JScript File
        var WMPVer = "unknown";       // Set to WMP version string detected
        var fHasWMP = false;          // True if either WMP v6.4 or v7+ found
        var fHasWMP64 = false;        // True if WMP v6.4 found
        var fHasWMP7 = false;         // True if WMP v7+ (8, 9) found
         var currURL; // Get the Current URL
        
        /* Check the Browser Type */
        function GetBrowser()
        {
           var agt=navigator.userAgent.toLowerCase();
           if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
               return "IE";
           else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                 && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
               return "Netscape";
           else
               return "unknown";
        }
        /* Check the Player Version */
        function GetPlayerMajorVer()
        {
                var strVer = new String(WMPVer);
                s = strVer.split(".");
            return s[0];
        }

        function GetPlayerMinorVer()
        {
                var strVer = new String(WMPVer);
                s = strVer.split(".");
                if (s[1])
                        return s[1];
                else
                        return("unknown");
        }
        
        function AddDownloadLink(MajorVer)
        {
         if (!(MajorVer) || MajorVer=="unknown" || MajorVer<9)
          {
            document.write('<body bgcolor="#000000"><tr><td><p align="center"><font face="arial" size="2"color="white">You do not have the latest Windows Media Player. Please click on the icon below to download the latest version.<BR><A HREF="http://windowsmedia.com/download" target="_new"><IMG SRC="http://www.microsoft.com/windows/windowsmedia/images/Download_88x31_static.gif" WIDTH="88" HEIGHT="31" BORDER="0" ALT="Get Windows Media Player" VSPACE="7"></A></td></tr></body>');
          }
        }
        
        ////
    var player;
    connectionSpeed = 0;
    function drawCSImageTag( fileLocation, fileSize, imgTagProperties ) 
    {
        start = (new Date()).getTime();
        loc = fileLocation + '?t=' + escape(start);
        document.write('<div style="display:none"><img src="' + loc + '" ' + imgTagProperties + ' onload="connectionSpeed=computeConnectionSpeed(' + start + ',' + fileSize + ');"></div>');
        return;
    }
    
    function connectionType(speed) 
    {
            SLOW_MODEM = 50;
            BB_MODEM = 128;
            LEASED = 256;
            if (speed) {
                    if (speed <= SLOW_MODEM) {
                            return "28000";
                    } else if (speed <= BB_MODEM) {
                            return "100000";
                    } else if (speed <= LEASED) {
                            return "200000";
                    } else {
                            return "200000";
                    }
            } else {
                    return "28000";
            }
    }
    
    function computeConnectionSpeed( start, fileSize ) 
    {
            end = (new Date()).getTime();
            connectSpeed = (Math.floor((((fileSize * 8) / ((end - start) / 1000)) / 1024) * 10) / 10);
            return connectSpeed;
    }
    
    /* Check Player */
    function checkplayer()
    {
            var br = GetBrowser();        // Returns either "IE" or "Netscape"
            var pm = GetPlayerMajorVer(); // Returns Windows Media Player major version #
            var pn = GetPlayerMinorVer(); // Returns Windows Media Player minor version #

            if((br=="IE" && pm >=7) || (br !="IE"))
            {
                    speed=connectionType(connectionSpeed);
                    runmovie('',speed,'',',../images/membervideos/1_13.wmv');
                    
                    return;
            }
            else
            {
                    AddDownloadLink(pm);
            }
    }    
    function runmovie(server,speed,extn,fileplaylist)
    {	    
        //if (extn == "wma") { qry_str = "WMBitrate="+speed+"&f=music/"+fname+"&s=1";}
	    qry_str = 'WMBitrate=' + speed + '&list=' + fileplaylist  + '&s=1'
        //qry_str = "WMBitrate="+speed+"&f="+fname+"&s=1"; 
	    //document.getElementById("divspeed").innerHTML="<br>Playing...";
    	//document.getElementById("divspeed").align="left";
	    //writeplayer(server + qry_str);
	    //writeplayer("http://theultimatedatingsite.com/Images/MemberVideo/35_234.asx");    	
    }
    
/*function openMailWindow(url)
{
	var url_path = 'http://sifymax.com/bbhome/max_popup.php?f=';
	qry_str = URLEncode('Blr_livebuzzKishen_17Nov06-128k.wmv');
        window.open(url+'?path='+url_path+qry_str, 'mailwindow','width=475,height=270,scrollbars=no,toolbar=no');
        return;
}*/
    currURL = self.parent.document.location.href;
    function writeplayer(bb,strFromPage,bolMyURL)
    {  
        //The below code is used to removing the querystring encryption data.
         if(currURL.indexOf('?') == -1)
               currURL = currURL.substring(0,currURL.lastIndexOf('/')+1);
         else
         {
              currURL = currURL.split("?")[0];
              currURL = currURL.substring(0,currURL.lastIndexOf('/')+1);
         }
         bb = currURL + bb;
       //Ends here
        switch(strFromPage)
        {
            case "MyProfile":
                    player = "<OBJECT id=media style='LEFT: 2px; TOP: 0px;' codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=7,0,0,1954 type=application/x-oleobject standby='Loading Microsoft Windows Media Playerco&#13;&#10;mponents...' classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" VIEWASTEXT width='300' height='250'><PARAM NAME='BufferingTime' VALUE='1'/><PARAM NAME='DisplayMode' VALUE='0'/><PARAM NAME='EnableContextMenu' value='true'/><PARAM NAME='PreBuffer' VALUE='True'/><PARAM NAME='ShowStatusBar' VALUE='true'/><PARAM NAME='Width' VALUE='300'/><PARAM NAME='height' VALUE='250'/><PARAM NAME='Volume' VALUE='400'/><PARAM NAME='Filename' VALUE=\"" + bb + "\"><PARAM NAME='URL' VALUE=''/><param name='wmode' value='transparent'/>\n";
                    player += "<EMBED Type=video/x-ms-asf-plugin pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\" alpha=\"0\"  name=\"mediaPlayer\" wmode=\"transparent\" id=\"mediaPlayer\"  AutoStart=false ShowControls='1' ShowStatusBar='1' width='300' height='250' src=" + bb +" />\n</OBJECT>";
                    if(bb == null){} 
                    else
                    {
                       if(bb.substring(bb.lastIndexOf(".")) == ".flv")
                       {
                            if(bolMyURL == 'true')
                                player = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" id=\"flashplayer1\" width=\"300\" height=\"250\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"myprofileflashplayer.swf?VideoPath=" + bb + "&captionValue=captionID231 \" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000\" /><param name='wmode' value='transparent'/><embed src=\"myprofileflashplayer.swf?VideoPath=" + bb + "&captionValue= captionID231 \" quality=\"high\" bgcolor=\"#000\" width=\"300\" height=\"250\" swLiveConnect=\"true\" id=\"flashplayer1\" name=\"flashplayer1\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\" ></embed></object>";
                            else
                                player = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" id=\"flashplayer1\" width=\"300\" height=\"250\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"../myprofileflashplayer.swf?VideoPath=" + bb + "&captionValue=captionID231 \" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000\" /><param name='wmode' value='transparent'/><embed src=\"../myprofileflashplayer.swf?VideoPath=" + bb + "&captionValue= captionID231 \" quality=\"high\" bgcolor=\"#000\" width=\"300\" height=\"250\" swLiveConnect=\"true\" id=\"flashplayer1\" name=\"flashplayer1\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\" ></embed></object>";
                       }        
                    } 
                    break;     
            case "HolidayExchange":
                    player = "<OBJECT id=media style='LEFT: 2px; TOP: 0px' codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=7,0,0,1954 type=application/x-oleobject standby='Loading Microsoft Windows Media Playerco&#13;&#10;mponents...' classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" VIEWASTEXT width='300' height='250'><PARAM NAME='BufferingTime' VALUE='5'><PARAM NAME='DisplayMode' VALUE='0'><PARAM NAME='EnableContextMenu' value='true'><PARAM NAME='PreBuffer' VALUE='True'><PARAM NAME='ShowStatusBar' VALUE='true'><PARAM NAME='Width' VALUE='300'><PARAM NAME='height' VALUE='250'><PARAM NAME='Volume' VALUE='400'><PARAM NAME='Filename' VALUE="+bb+"><PARAM NAME='URL' VALUE=''><param name='wmode' value='transparent'/>\n";
                    player += "<EMBED Type=video/x-ms-asf-plugin pluginspage=\"http://www.microsoft.com/netshow/download/player.htm\"  name=\"mediaPlayer\" wmode=\"transparent\" id=\"mediaPlayer\" AutoStart=true ShowControls=1 ShowStatusBar=1 width='300' height='250' src="+bb+"></embed>\n</OBJECT>";
                    if(bb.substring(bb.lastIndexOf(".")) == ".flv")
                      player = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" id=\"flashplayer1\" width=\"300\" height=\"250\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"../myprofileflashplayer.swf?VideoPath=" + bb + "&captionValue=captionID231 \" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000\" /><param name='wmode' value='transparent'/><embed src=\"../myprofileflashplayer.swf?VideoPath=" + bb + "&captionValue= captionID231 \" quality=\"high\" bgcolor=\"#000\" width=\"300\" height=\"250\" swLiveConnect=\"true\" id=\"flashplayer1\" name=\"flashplayer1\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\" /></object>";
                    break;     
            case "VideoComments":
                    if(bb.substring(bb.lastIndexOf(".")) == ".flv")
                        player = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" id=\"flashplayer1\" width=\"480\" height=\"390\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"../Video/FlashPlayer.swf?VideoPath=" + bb + "&captionValue=captionID231 \" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000\" /><param name='wmode' value='transparent'/><embed src=\"../Video/FlashPlayer.swf?VideoPath=" + bb + "&captionValue= captionID231 \" quality=\"high\" bgcolor=\"#000\" width=\"480\" height=\"390\" swLiveConnect=\"true\" id=\"flashplayer1\" name=\"flashplayer1\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\"/></object>";
                    else
                    {
                        player = "<OBJECT id=media style='LEFT: 2px; TOP: 0px' codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=7,0,0,1954 type=application/x-oleobject standby='Loading Microsoft Windows Media Playerco&#13;&#10;mponents...' classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" VIEWASTEXT width=480 height=390><PARAM NAME='BufferingTime' VALUE='5'><PARAM NAME='DisplayMode' VALUE='0'><PARAM NAME='EnableContextMenu' value='true'><PARAM NAME='PreBuffer' VALUE='True'><PARAM NAME='ShowStatusBar' VALUE='true'><PARAM NAME='Width' VALUE=480><PARAM NAME='height' VALUE=390><PARAM NAME='Volume' VALUE='400'><PARAM NAME='Filename' VALUE=" + bb + "><PARAM NAME='URL' VALUE=''><param name='wmode' value='transparent'/>\n";
                        player += "<EMBED Type=video/x-ms-asf-plugin pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\"  name=\"mediaPlayer\" id=\"mediaPlayer\" wmode=\"transparent\" AutoStart=true ShowControls=1 ShowStatusBar=1 width=480 height=390 src=" + bb +" />\n</OBJECT>";    
                    }    
                    break;
         }
       document.getElementById('Player').innerHTML = player;
       if( bb == null)   {}
       else
       {
           if(bb.substring(bb.lastIndexOf(".")) == ".wmv")
           {
               document.media.URL= bb;       
               document.media.src= bb;
           }
       }
      return;
    }
    
    /* for Audio */
    function writeaudioplayer(bb)
    {   
        if(currURL.indexOf('?') == -1)
               currURL = currURL.substring(0,currURL.lastIndexOf('/')+1);
         else
         {
              currURL = currURL.split("?")[0];
              currURL = currURL.substring(0,currURL.lastIndexOf('/')+1);
         }
         bb = currURL + bb;
       player = "<OBJECT id=audiomedia style='LEFT: 2px; TOP: 0px' codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=7,0,0,1954 type=application/x-oleobject standby='Loading Microsoft Windows Media Playerco&#13;&#10;mponents...' classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" VIEWASTEXT width=300 height=46><PARAM NAME='BufferingTime' VALUE='5'><PARAM NAME='DisplayMode' VALUE='0'><PARAM NAME='EnableContextMenu' value='true'><PARAM NAME='PreBuffer' VALUE='True'><PARAM NAME='ShowStatusBar' VALUE='true'><PARAM NAME='Width' VALUE=300><PARAM NAME='height' VALUE=46><PARAM NAME='Volume' VALUE='400'><PARAM NAME='Filename' VALUE=" + bb + "><PARAM NAME='URL' VALUE=''>\n";
       player += "<EMBED Type=video/x-ms-asf-plugin pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\"  name=\"audiomedia\" id=\"audiomedia\" AutoStart=true ShowControls=1 wmode=\"transparent\" ShowStatusBar=1 width=300 height=46 src=" + bb +"/>\n</OBJECT>";       
       document.getElementById('divAudioPlayer').innerHTML=player;                     
       document.audiomedia.URL=bb;              
       document.audiomedia.src=bb;        
       return;
    }
    
    /*
    function URLEncode(path)
    {
            // The Javascript escape and unescape functions do not correspond
            // with what browsers actually do...
            var SAFECHARS = "0123456789" +                                  // Numeric
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +  // Alphabetic
            "abcdefghijklmnopqrstuvwxyz" +
            "-_.!~*'()";                                    // RFC2396 Mark characters
            var HEX = "0123456789ABCDEF";

            var plaintext = path;
            var encoded = "";
            for (var i = 0; i < plaintext.length; i++ ) {
                    var ch = plaintext.charAt(i);
                if (ch == " ") {
                        encoded += "+";                             // x-www-urlencoded, rather than %20
                    } else if (SAFECHARS.indexOf(ch) != -1) {
                        encoded += ch;
                    } else {
                        var charCode = ch.charCodeAt(0);
                            if (charCode > 255) {
                            + ch
                            + "' cannot be encoded using standard URL encoding.\n" +
                                              "(URL encoding only supports 8-bit characters.)\n" +
                                                      "A space (+) will be substituted." );
                                    encoded += "+";
                            } else {
                                    encoded += "%";
                                    encoded += HEX.charAt((charCode >> 4) & 0xF);
                                    encoded += HEX.charAt(charCode & 0xF);
                            }
                    }
            } // for

            return encoded;
    };
    */
    
    function callRate(cat,fn)
    {
        window.open("pop_rate.php?catid="+cat+"&fname="+fn,"Rate","width=258,height=250");
    }


