   var mpobj;
   function hL1(a, b) {
      url="?type="+a[0];
      c=1;
      while (a[c]) {
        url += "&p"+c+"="+a[c++];
      }
      mpobj = window.open('','fmPlayer','directories=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,copyhistory=no,status=no,width=728,height=480');
      if (mpobj.location.href.indexOf('player.php') == -1) {
         mpobj.location.href = "/media/player.php"+url;
      } else {
         // add to playlist
         var obj = {file: "getXSPF.php"+url};
         if (b==0) {
       loadFile(obj);
         } else {
       appendFile(obj);
         }
      }
   };
   
    jQuery(document).ready(function($) {
      $('a[rel*=facebox]').facebox({
        loading_image : '/images/loading.gif',
        close_image : '/images/closelabel.gif',
        overlay : true
      });
      
        $.facebox.settings.opacity = 0.5;
        
      $('a.no-overlay').click(function () { 
        $('#facebox_overlay').hide(); 
      });
    });
      

   function LAUNCH(type, p1, p2, obj, playadd) {
      mpobj = window.open('','fmPlayer','directories=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,copyhistory=no,status=no,width=728,height=480');
      if (mpobj.location.href.indexOf('player.php') == -1) {
         mpobj.location.href = "/media/player.php?type="+type+"&p1="+p1+"&p2="+p2;
      } else {
         // add to playlist
         if (playadd==0) {
       loadFile(obj);
         } else {
       appendFile(obj);
         }
      }
   };
   function openEmailWindow(page) {
      window.open(page,'email','width=345,height=350,resizable=yes,scrollbars=yes');
   };

   function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1) endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
   function GetCookie(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){ var j=i+alen; if(document.cookie.substring(i,j)==arg) return getCookieVal(j); i=document.cookie.indexOf(" ",i)+1;if(i==0) break;} return null;}
   function SetCookie(name,value){var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expires=(2<argc)?argv[2]:null;var path=(3<argc)?argv[3]:null;var domain=(4<argc)?argv[4]:null;var secure=(5<argc)?argv[5]:false;document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");}
   function DisplayInfo(){if(!document.layers){var expdate=new Date();var visit;expdate.setTime(expdate.getTime()+(24*60*60*1000*365));if(!(visit=GetCookie("visit"))) visit=0;visit++;SetCookie("visit",visit,expdate,"/",null,false);var message;if(visit==1) openEmailWindow('/email.html')}}
   function ResetCounts(){if(!document.layers){var expdate=new Date();expdate.setTime(expdate.getTime()+(24*60*60*1000*365));visit=0;SetCookie("visit",visit,expdate,"/",null,false);}}

// some variables to save
var currentPosition;
var currentVolume;
var currentItem;

// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm) { thisMovie("mpl").sendEvent(typ,prm); };
function getUpdate(typ,pr1,pr2,pid) {
	if(typ == "time") { currentPosition = pr1; }
	else if(typ == "volume") { currentVolume = pr1; }
	else if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100); }
	var id = document.getElementById(typ);
	id.innerHTML = typ+ ": "+Math.round(pr1);
	pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
	if(pid != "null") {
		document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
	}
};

// These functions are caught by the feeder object of the player.
function loadFile(obj) { thisMovie("mpl").loadFile(obj); };
function appendFile(obj) { thisMovie("mpl").appendFile(obj); };
function addItem(obj,idx) { thisMovie("mpl").addItem(obj,idx); };
function removeItem(idx) { thisMovie("mpl").removeItem(idx); };
function getItemData(idx) {
	var obj = thisMovie("mpl").itemData(idx);
	var nodes = "";
	for(var i in obj) {
		// nodes += "<li>"+i+": "+obj[i]+"</li>";
	}
	// document.getElementById("data").innerHTML = nodes;
};

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return mpobj.part2.window[movieName];
	} else {
		return mpobj.part2.document[movieName];
	}
};
window.name = "hsmain";



function XMLHTTPObject() {
var xmlhttp=false
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
    return xmlhttp;
};
var http = new XMLHTTPObject();


//This function will be called when the form is submited
function saveData() {
    var comment = document.getElementById("comment").value;
    var email = document.getElementById("email").value;

    //By calling this file, we have saved the data.
    http.open("GET","/save_data.php?comment=" + comment + "&email=" + email + "&return=confirm",true);

    http.onreadystatechange = function() {
        if(http.readyState == 4) {
            if(http.status == 200) {
                var result = http.responseText;
                var msg = ""
                if(result == '1') {
                    //Display the thank you message.
                    msg = "Thanks, you have been added to our invite request list.";
                } else {
                    msg = "Thanks, you have been added to our invite request list.";
                }
                document.getElementById("form_elements").innerHTML = msg;
            }
        }
    }
    http.send(null);
    // document.getElementById("src3_child").style.visibility="hidden";

    return false;//Prevent the form from being submited
}
function init() {
    if(http) {//If the browser supports Ajax functions
        document.getElementById("feedback_form").onsubmit = saveData; //The saveData function is attached to the submit action of the form.
    }
}
window.onload = init; //The 'init' function will be called when the page is loaded.

