function Music(_obj){

	var format		= _obj.format;
	var auto_start		= _obj.auto_start;
	var msg			= _obj.msg;
	var force_flash 	= _obj.force_flash;
	var force_url		= _obj.force_url;
	var agt=navigator.userAgent.toLowerCase();
	var ie  = (agt.indexOf("msie") != -1);
	var ns  = (navigator.appName.indexOf("Netscape") != -1);
	var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
	var mac = (agt.indexOf("mac")!=-1);
	
	var pop = new Object;
/*
      if (ie && win) {	pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader"); }


      if (ns || !win) {
      	nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
      	pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader");
      }

      function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCR' + 'IPT>\n'); if (result) return name+','; else return ''; }
      function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }

      pluginlist += navigator.javaEnabled() ? "Java," : "";
      if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
*/

	pop.popurl="/music/flashmusic.php";
	pop.popurlTest="/music/flashmusicTest.php";
	pop.w=310;
	pop.h=90;

/*
      if(format != "MID"){
	pop.popurl="/music/get_plugins.php";
	pop.w=600;
	pop.h=500;
      }


      if(pluginlist.indexOf("QuickTime")!= -1 && format == "MID"){
	pop.popurl="/music/quicktime.php";
	pop.w=200;
	pop.h=90;
      }


      if((pluginlist.indexOf("Windows Media Player")!= -1) && this.force_flash != "TRUE"){
	pop.popurl= "/music/mediaplayer.php";
	pop.w=300;
	pop.h=110;
      }


      if (pluginlist.indexOf("Flash")!= -1 && format != "MID" || this.force_flash == "TRUE"){
	pop.popurl="/music/flashmusic.php";
	pop.w=310;
	pop.h=90;

      }

      if(mac){

	pop.popurl="/music/quicktime.php";
	pop.w=200;
	pop.h=90;

      }
*/

	return pop;

} 

function openpopupTest(x){
	eval("winpops=window.open( x.popurlTest, 'popupurlTest' , 'width=" + x.w + " , height=" + x.h + "');");
	document.cookie='poppedup=checked';
	}

function openpopup(x){
	eval("winpops=window.open( x.popurl, 'popupurl' , 'width=" + x.w + " , height=" + x.h + "');");
	document.cookie='poppedup=checked';
	}

function closeprompt(){
	document.cookie= 'poppedup=checked';
	document.getElementById('musicprompt').style.display='none';
	document.getElementById('musicprompt_inside').style.display='none';
	
	if (document.getElementById('musicprompt_link') != null) {
		document.getElementById('musicprompt_link').style.display='none';
	}
}

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";

  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(x){
	if (this.auto_start != 'FALSE' && get_cookie('poppedup') !='checked'){
		eval("winpops=window.open('" + x.popurl + "', 'popupurl' , 'width=" + x.w + " , height=" + x.h + "');");

		if(winpops==null || winpops == "undefined" || typeof(winpops) == "undefined"){
			document.getElementById('musicprompt').style.display='block';
			document.getElementById('musicprompt_inside').style.display='block';
			moveDiv('musicprompt');
		}else{
			document.cookie="poppedup=checked";
		}

	}

}

//this is for Fanhua website
function loadornotTest(x){
	if (this.auto_start != 'FALSE' && get_cookie('poppedup') !='checked'){
		eval("winpops=window.open('" + x.popurlTest + "', 'popupurlTest' , 'width=" + x.w + " , height=" + x.h + "');");

		if(winpops==null || winpops == "undefined" || typeof(winpops) == "undefined"){
			document.getElementById('musicprompt').style.display='block';
			document.getElementById('musicprompt_inside').style.display='block';
			moveDiv('musicprompt');
		}else{
			document.cookie="poppedup=checked";
		}

	}

}

var the_timeout;

function moveDiv()
{
  var the_style = getStyleObject('musicprompt');
  if (the_style)
  {

    // get the current coordinate and add 5
    //
    var current_left = parseInt(the_style.left);
    var new_left = current_left + 5;

    // set the left property of the DIV, add px at the
    // end unless this is NN4
    //
    if (document.layers) 
    {

      the_style.left = new_left;
    }
    else 
    {
      the_style.left = new_left + "px";
    }
    
    // if we haven't gone too far, call moveDiv() again in a bit
    // 
    if (new_left < -10)
    {
      the_timeout = setTimeout('moveDiv();',1);
    }
  }
}


function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject


