function playMovie(file,category,id)
{
//  document.getElementById("playerHeader").innerHTML = '<font color="#FFFFFF" size="+1">&nbsp;' + category + '</font>';
  document.getElementById("playerHeader").innerHTML = category ;
  document.getElementById("movie").value = id;
  var s1 = new SWFObject('./js/player.swf', 'playlist', '566', '328', '7');
	  s1.addParam('allowfullscreen',     'true');
	  s1.addVariable('width',            '566');
	  s1.addVariable('height',           '328');
	  s1.addVariable('displayheight',    '328');
	  s1.addVariable('file',             '../files/' + file);
	//s1.addVariable('file',             'http://my.domain.com/path/playlist.xml');
	//s1.addVariable('overstretch',      'true');  // expands to fit h & v   "true"  -will stretch them proportionally to fill the display
	  s1.addVariable('overstretch',      'false'); // expands to fit h or v  "false" -will stretch them to fit
	//s1.addVariable('overstretch',      'fit');   // expands to fit h & v   "fit"   -will stretch them disproportionally to fit both height and width
	//s1.addVariable('overstretch',      'none');  // displays native size   "none"  -will show all items in their original dimensions
	  s1.addVariable('showdigits',       'true');
	  s1.addVariable('autostart',        'true');
	  s1.addVariable('shuffle',          'false');
	  s1.addVariable('repeat',           'list');
	  s1.addVariable('showicons',        'true');
	  s1.addVariable('thumbsinplaylist', 'true');
	  s1.addVariable('logo',             '');
	  s1.addVariable('backcolor',        '0xFFFFFF'); // face of buttons
	  s1.addVariable('frontcolor',       '0x404040'); // button symbols & playlist text
	  s1.addVariable('lightcolor',       '0x808080'); // highlighted playlist item
	  s1.addVariable('screencolor',      '0x000000'); // screen background color
	  s1.addVariable('stretching',       'exactfit');
	  s1.addParam('abouttext',     'Tv Nynäs');
	  s1.addParam('aboutlink',     'http://www.tvnynas.se');
	  s1.write('player');
	  showComments(id);
	  DisplayRating(id);
	  
//	  document.getElementById("sharediv").innerHTML = '<div class="share"><a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'play.php?media=' + id + ' \', \'' + file + '\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s9.addthis.com/button1-share.gif" width="125" height="16" border="0" alt="" /></a></div>';
	  
};

function LoadCategory(id)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			var str = xmlHttp.responseText;
			var a = new Array();
			a = str.split("<!--split-->");
			document.getElementById('programhead').innerHTML = a[0];
			document.getElementById('ulpopular').innerHTML = a[1];
		}
	}


	document.getElementById('programhead').innerHTML = '<center><img src="images/loading.gif"></center>';	
	document.getElementById('ulpopular').innerHTML = '<center><img src="images/loading.gif"></center>';
  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/loadcategory.php?tid=" + t + "&id=" + id ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function LoadArchive(id)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			var str = xmlHttp.responseText;
			var a = new Array();
			a = str.split("<!--split-->");
			document.getElementById('programhead').innerHTML = a[0];
			document.getElementById('ulpopular').innerHTML = a[1];
		}
	}


	document.getElementById('programhead').innerHTML = '<center><img src="images/loading.gif"></center>';	
	document.getElementById('ulpopular').innerHTML = '<center><img src="images/loading.gif"></center>';
  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/loadarchive.php?tid=" + t + "&id=" + id ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function showComments(id)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			var str = xmlHttp.responseText;
			document.getElementById('addedComments').innerHTML = str;
		}
	}


	document.getElementById('addedComments').innerHTML = '<center><img src="images/loading.gif"></center>';	
  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/showcomments.php?tid=" + t + "&id=" + id ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function addComment()
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			var str = xmlHttp.responseText;
			document.getElementById('addedComments').innerHTML = str;
			document.getElementById('senddiv').innerHTML = '<img onClick="addComment();" src="images/send_button.gif">';	
			document.getElementById('namn').value="";
			document.getElementById('comment').value="";			
		}
	}

	id = document.getElementById('movie').value;
	title = document.getElementById('namn').value;
	desc = document.getElementById('comment').value;

	document.getElementById('senddiv').innerHTML = '<center><img src="images/loading.gif"></center>';	
  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/showcomments.php?tid=" + t + "&id=" + id + "&title=" + title + "&desc=" + desc ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function removeComment(id)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			var str = xmlHttp.responseText;
			showComments(document.getElementById('movie').value);			
		}
	}

  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/removecomment.php?tid=" + t + "&id=" + id ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function LoadTabla(datum)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('topplistaContainer2').innerHTML = xmlHttp.responseText;
		}
	}


	document.getElementById('topplistaContainer2').innerHTML = '<center><img src="images/loading.gif"></center>';	
	
  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/loadtabla.php?tid=" + t + "&datum=" + datum ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function newsletter()
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('id_first_name').value="";	
			document.getElementById('id_last_name').value="";	
			document.getElementById('id_email').value="";			
			document.getElementById('newsletterstat').innerHTML = xmlHttp.responseText;
		}
	}

	document.getElementById('newsletterstat').innerHTML = '<center><img src="images/loading.gif"></center>';	
	
	var firstname = document.getElementById('id_first_name').value;	
	var lastname = document.getElementById('id_last_name').value;	
	var email = document.getElementById('id_email').value;	
	
  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp.open("GET","calls/newsletter.php?tid=" + t + "&firstname=" + firstname + "&lastname=" + lastname + "&email=" +email ,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}

function DisplayRating(id)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp2=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp2.onreadystatechange=function()
  	{
		if(xmlHttp2.readyState==4)
		{
			
			document.getElementById('rating').innerHTML = xmlHttp2.responseText;
		}
	}


  	var d = new Date();
	var t = d.getTime();
	
	xmlHttp2.open("GET","calls/displayrating.php?tid=" + t + "&id=" + id,true);
	xmlHttp2.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp2.send(null); 
}

function showupcomming(id)
{

try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  	xmlHttp.onreadystatechange=function()
  	{
		if(xmlHttp.readyState==4)
		{
			
			document.getElementById('topplistaPlayer').innerHTML = xmlHttp.responseText;
		}
	}


  	var d = new Date();
	var t = d.getTime();
	
	document.getElementById('topplistaPlayer').innerHTML = '<center><img src="images/loading.gif"></center>';	
	
	xmlHttp.open("GET","calls/upcomming.php?tid=" + t + "&id=" + id,true);
	xmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
  	xmlHttp.send(null); 
}


