function getMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}


function playTrailer() {
var player = getMovie("rumurPlayer");
player.playTrailer();
}


function setClip(ctxt) {
	//alert("txt: "+ctxt);
var m = getMovie("rumurPlayer");
m.copyText(ctxt);
}

function addComment() {
	var t = window.location.pathname;
	var title = t.substr(t.lastIndexOf("/")+1);
	var n = document.getElementById("cname").value;
	var ctxt = document.getElementById("comment").value;
    if(ctxt != "") {
    var item = $.ajax({
    type: "post",
    dataType: "html",
    url: "/comment.php",
    data: "c="+ctxt+"&n="+n+"&f="+title,
    success: function(item) {
      $("#comments").append(item);
      document.getElementById("cname").value = "";
      document.getElementById("comment").value = "";
       }
    });
    }
  }
	
 
 function highlight(item) {
 	switch(item.name) {
 		case 'cName':
 		//$("#theName").css("color","#3399ff");
 		$("#theName").css("color","#eeeee");
 		break;
 		
 		case 'cEmail':
 		//$("#mail").css("color","#3399ff");
 		$("#mail").css("color","#eeeee");
 		break;
 		
 		case 'message':
 		//$("#msg").css("color","#3399ff");
 		$("#msg").css("color","#eeeee");
 		break;
 	}
 	
 }
 
 function dehighlight(item) {
   		switch(item.name) {
 		case 'cName':
 		$("#theName").css("color","#cccccc");
 		break;
 		
 		case 'cEmail':
 		$("#mail").css("color","#cccccc");
 		break;
 		
 		case 'message':
 		$("#msg").css("color","#cccccc");
 		break;
 	}
 
 }
 
 $(document).ready(function() {
 	$("#bMail").toggle(addForm,removeForm);
 	
 });
 
 function addForm() {
 	$("#emailForm").slideDown(300);
 }
 
 
 function removeForm() {
 	$("#emailForm").slideUp(300);
 }
 
 function resetFriendForm() {
 $("#toAddy").val("Enter yoru email address");
 $("#fromAddy").val("Enter you friend's address");
 $("#msg").val("Type a personal message");	
 }
 
 function emailFriend() {
 var url = $("#shareURL").val();
 var to = $("#toAddy").val();
 var from = $("#fromAddy").val();
 var msg = $("#msg").val();
 
 $.post("/mailer.php", {
 	    c: "f",
 		u: url,
 		to: to,
 		from: from,
 		msg:msg
 		},
 		function(res) {
 	    resetFriendForm();	
 		removeForm();	
 			
 	});
 }
 
  function download() {
 //alert("DOWNLOAD");
//alert(document.URL);
 location.href = document.URL+"/download";
 }
 
 function stream() {
 	location.href = document.URL+"/stream";
 }
 
 function startStream() {
 	//alert("stream");
 location.href = document.URL+"/play";
 }
 
 function startDownload() {
 	location.href= document.URL+"get"
 }
 
 function burn() {
 location.href = document.URL+"/burn";
 }
