﻿function opennewwindow(strpath, w, h) {
    window.open(strpath, 'popup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,modal=yes,width=' + w + ',height=500');
}
function soundPreview(previewUrl) {
    if (previewUrl != '') {
        playSound(previewUrl);
    }
}
function unloadSoundPreview(previewUrl) {
    playSound();
}
function playSound(url) {
    //###############################
    //Edit by thanom 01/02/2010
    //var strUrl = 'http://203.151.232.114/Alice/DataFiles/PV/';
    var strUrl = 'http://203.151.232.114/Alice/DataFiles/Song/Preview/';
    if (navigator.appName == "Microsoft Internet Explorer") {
        writeObject('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="' + strUrl + url + '" AutoStart="true" ShowStatusBar="0" ShowControls="0" ShowDisplay="0" volume="1" HEIGHT="1" WIDTH="1" loop="false">', 'premusic')
    }
    else {
        writeObject('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="' + strUrl + url + '" AutoStart="true" ShowStatusBar="0" ShowControls="0" ShowDisplay="0" volume="1" HEIGHT="1" WIDTH="1" loop="false">', 'premusic')
    }
    //###############################
}


function playlist()
{
 if (navigator.appName == "Microsoft Internet Explorer") {
 var obj = document.getElementById('windowmediaplayer');
        obj.play();
      
    }
    else {
        var elm = document.getElementById("windowmediaplayer");
        elm.style.display = 'block';
    
        /*var obj = document.getElementById('winmedia');
        obj.innerhtml = '<embed type="application/x-mplayer2" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="http://www.toplinediamond.com/Preview.asx" AutoStart=1 TransparentAtStart=1 SendPlayStateChangeEvents=1 ShowControls=0 ShowDisplay=0 ShowStatusBar=0 ShowGotoBar=0 ShowPositionControls=0 AutoSize=0 EnableContextMenu=0 EnableFullScreenControls=0 Volume=0 HEIGHT="0" WIDTH="0" loop=1>';
     */
     
    }
}
function stoplist()
{

if (navigator.appName == "Microsoft Internet Explorer") {
 var obj = document.getElementById('windowmediaplayer');
        obj.stop();
      
    }
    else {

        var elm = document.getElementById("windowmediaplayer");
        elm.style.display = 'none';


      /*  if (document.all) {
            dcontent.innerHTML != '';
        }
        else if (document.getElementById) {
            rng = document.createRange();
            el = document.getElementById("winmedia");
            rng.setStartBefore(el);
            htmlFrag = rng.createContextualFragment('');
            while (el.hasChildNodes()) { el.removeChild(el.lastChild); }
            el.appendChild(htmlFrag);
        }
*/
  
    
      /*  if (document.getElementById && !document.all) {
            rng = document.createRange();
            el = document.getElementById('winmedia');
            rng.setStartBefore(el);
            htmlFrag = rng.createContextualFragment('');
while (el.hasChildNodes())
el.removeChild(el.lastChild);
el.appendChild(htmlFrag);
}
            */
            
            
           /* var obj = document.getElementById('winmedia');

            alert(obj.innerhtml);*/
        
    }
}




function writeObject(text, id) {
    if (document.getElementById) {
        x = document.getElementById(id);
        x.innerHTML = text;
    }
    else if (document.all) {
        x = document.all[id];
        x.innerHTML = text;
    }
    else if (document.layers) {
        x = document.layers[id];
        x.document.open();
        x.document.write(text);
        x.document.close();
    }
}
