// JavaScript Document

function col2Width(){
	var ewd =0,tvw,htv;
	var swd=document.documentElement.clientWidth;
	ewd= swd-400;
	tvw=swd-200;
	htv=tvw/2;
	if(swd > 1000)
	{
	document.getElementById("col2").style.width = ewd + "px";
	document.getElementById("tv_guide_cont").style.width = tvw + "px";
	document.getElementById("current_pro_cont").style.width = htv + "px";
	document.getElementById("upcoming_pro_cont").style.width = htv + "px";
	document.getElementById("mask_left").style.width ="100%";
	}
	else
	{
	document.getElementById("col2").style.width = "600px";
	document.getElementById("tv_guide_cont").style.width ="800px";
	document.getElementById("current_pro_cont").style.width ="400px";
	document.getElementById("upcoming_pro_cont").style.width = "400px";
	document.getElementById("mask_left").style.width ="1000px";	
	}
}


//-------------------------------------------------- 
var m_x,m_bg;
function menu_over(m_x){
	m_bg=m_x + "_";
	document.getElementById(m_x).style.color="#484848";
	document.getElementById(m_bg).style.backgroundColor="#44323b";
	document.getElementById(m_bg).style.color="#ffffff";
}
function menu_out(m_x){
	document.getElementById(m_x).style.color="#484848";
	document.getElementById(m_bg).style.backgroundColor="";
	document.getElementById(m_bg).style.color="#484848";
}

//-------------------------------------------------- Fedback
var feed_bt;
function feedBox(feed_bt){
	if(feed_bt=='feedback_b')
		document.getElementById("feedback_box_cont").style.width="400px";
	if(feed_bt=='cancel_b')
		document.getElementById("feedback_box_cont").style.width="0px";
}

//-------------------------------------------------- Movie trailer box

var mvi_bx;
var box_data;
function trailerclose(){
document.getElementById('mvi_trailer_vid').innerHTML="";
document.getElementById("mvi_trailer_cont").style.width="0px";
}

var xmlhttp_tr;
var mov_id;
var mov_data;
function trailerBox(title,x){
	mov_id=x;
xmlhttp_tr=GetXmlHttpObject();
var param="title="+title+"&sid"+Math.random();
var url="req_trailer.php";
xmlhttp_tr.open("POST",url,true);
xmlhttp_tr.onreadystatechange=trailer_req_res;
xmlhttp_tr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp_tr.setRequestHeader("Content-length", param.length);
xmlhttp_tr.setRequestHeader("Connection", "close");
xmlhttp_tr.send(param);
document.getElementById(mov_id).style.backgroundImage="url(common_img/preloading.gif)";
document.getElementById(mov_id).style.backgroundPosition="center";
document.getElementById(mov_id).style.backgroundRepeat="no-repeat";
}
function trailer_req_res(){
	if(xmlhttp_tr.readyState==4)
	{
		if(xmlhttp_tr.status==200)
		{mov_data=document.getElementById(mov_id).innerHTML;	
		var mbed_data_ajax=xmlhttp_tr.responseText
		document.getElementById(mov_id).innerHTML="'"+mbed_data_ajax+"'"+'<img id="close_mov_trailer" src="common_img/comments_close.gif" onclick="mov_trailerclose(&quot;'+mov_id+'&quot;)"; />';
		document.getElementById(mov_id).style.backgroundImage="";
		}	}
}
function mov_trailerclose(id){
document.getElementById(mov_id).innerHTML="";
document.getElementById(mov_id).innerHTML=mov_data;
	
	
	}


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

