function highlightScrollItem(tag){ 

var divBox = document.getElementById(tag);
//alert(tag);
divBox.style.backgroundColor = "";
//divBox.style.backgroundColor = "#222222";
return;
}

function restoreScrollItem(tag){ 

var divBox = document.getElementById(tag);
divBox.style.backgroundColor = "";
return;
}

function highlightButton(butID){ 
var docButton = document.getElementById(butID);
docButton.src = "./images/left-menu-selected-button.gif";
//divBox.style.backgroundColor = "#222222";
return;
}

function restoreButton(butID){ 
//alert(""+button);
var docButton = document.getElementById(butID);
docButton.src = "./images/Left-menu-button-unselected.gif";
return;
}

function highlightButton2(butID){ 
var docButton = document.getElementById(butID);
docButton.src = "./images/right-menu-selected-area.gif";
//divBox.style.backgroundColor = "#222222";
return;
}

function restoreButton2(butID){ 
//alert(""+button);
var docButton = document.getElementById(butID);
docButton.src = "./images/right-menu-unselected-button.gif";
return;
}

function ajaxFunction(type, vid, offset, cid){

	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState==4 || ajaxRequest.readyState=="complete"){
          if (type == 'paginate')
			var ajaxDisplay = document.getElementById('ajaxDiv');
          if (type == 'channelGuide')
			var ajaxDisplay = document.getElementById('scrollingVideosText');
			ajaxDisplay.style.display = "";		
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}

//	alert("hi");	

    if (type == 'paginate'){
  
	  var rowsPerPage = 4;
      var queryString = "?vid=" + vid + "&rowsPerPage=" + rowsPerPage + "&offset=" + offset + "&cid=" + cid ; 
	  ajaxRequest.open("GET", "commentsAjax.php" + queryString, true);
	  ajaxRequest.send(null);
    }	
	
    if (type == 'channelGuide'){
	  var rowsPerPage = 10;
//	  alert("Hi");
      var queryString = "?vid=" + vid + "&rowsPerPage=" + rowsPerPage + "&page=" + offset + "&cid=" + cid ; 
	  ajaxRequest.open("GET", "ajaxChannelGuide.php" + queryString, true);
	  ajaxRequest.send(null);	
	}
	
    if (type == 'expand'){
	  var rowsPerPage;
 	  if (global_expand == true)
	  {
		  rowsPerPage = 5;
		  global_expand = false;
	  }else
	  {
		  rowsPerPage = 3;
		  global_expand = true;		  
	  }
	    
      var queryString = "?mf_mid=" + mf_mid + "&rowsPerPage=" + rowsPerPage; /* + "&phone1=" + phone1 + "&phone2=" + phone2 + "&email=" + email + "&items=" + items + "&info=" + info + "&address=" + address;*/
	  ajaxRequest.open("GET", "comments.php" + queryString, true);
	  ajaxRequest.send(null);
    }		
	
}

function changeAdminChannel(cid){
  var link = "./video.php?cid=" + cid;
  window.location = link;
}

function Expand(divID)
{
	var oBox = document.getElementById(divID);
	if (oBox)
	{
		if (oBox.style.display == 'none')
		{
			oBox.style.display = 'block';
		}
		else
		{
			oBox.style.display = 'none';
		}
	}
}


function addToBlast(numBlast) {
var blastTo = "";
var box;
for (var j = 0; j < numBlast; j++) {
box = eval("document.blastForm.blast" + j); 	
if (box.checked == true) 
  blastTo += box.value + ", ";
   }  
blast = eval("document.blastForm.blast");    
blast.innerHTML = blastTo;
}

function addToSendGift(numBlast, cost) {
var blastTo = "";
var box;
var i = 0;
var totalCost;
var estCost;
for (var j = 0; j < numBlast; j++) {
  box = eval("document.blastForm.blast" + j); 	  
  if (box.checked == true)
  {
	estCost = cost*(i+1);
	if (estCost < document.blastForm.totalPts.value)
	{
      blastTo += box.value + ", ";
      i++;
	}else{
	  alert("Sorry, you don't have enough points to send this gift to this user.")
      box.checked = "";
	}
  }  
}
blast = eval("document.blastForm.blast");    
blast.innerHTML = blastTo;
totalCost = eval("document.blastForm.totalCost");    
totalCost.value = cost*i;
}

function detailsTab(divID)
{
    var oBox = document.getElementById(divID);
    var oBoxTab = document.getElementById(divID+"Tab");	
	if (oBox)
	{
//        var biography = document.getElementById('biography');
//        var creditStar = document.getElementById('creditStar');	
        document.getElementById("biography").style.display = 'none';		
        document.getElementById("creditStar").style.display = 'none';
        document.getElementById("creditDirector").style.display = 'none';		
        document.getElementById("creditProducer").style.display = 'none';
        document.getElementById("biographyTab").style.backgroundColor = '#AA0000';		
        document.getElementById("creditStarTab").style.backgroundColor = '#AA0000';
        document.getElementById("creditDirectorTab").style.backgroundColor = '#AA0000';		
        document.getElementById("creditProducerTab").style.backgroundColor = '#AA0000';		
        oBox.style.display = 'block';
		oBoxTab.style.backgroundColor = '#000000';
	}
}

function friendsTab(divID)
{
    var oBox = document.getElementById(divID);
    var oBoxTab = document.getElementById(divID+"Tab");	
	if (oBox)
	{
//        var biography = document.getElementById('biography');
//        var creditStar = document.getElementById('creditStar');	
        document.getElementById("confirmed").style.display = 'none';		
        document.getElementById("pending").style.display = 'none';
        document.getElementById("confirmedTab").style.backgroundColor = '#AA0000';		
        document.getElementById("pendingTab").style.backgroundColor = '#AA0000';		
        oBox.style.display = 'block';
		oBoxTab.style.backgroundColor = '#000000';
	}
}

function showTip(divID)
{
	var oBox = document.getElementById(divID);
	var oBoxPtr = document.getElementById("ptr"+divID);	
	if (oBox)
	{
		if (oBox.style.display == 'none')
		{
			oBoxPtr.style.display = 'block';			
			oBox.style.display = 'block';
		}
	}
}
function hideTip(divID)
{
	var oBox = document.getElementById(divID);
	var oBoxPtr = document.getElementById("ptr"+divID);		
	if (oBox)
	{
			oBoxPtr.style.display = 'none';			
			oBox.style.display = 'none';
	}
}
