// JavaScript Document

function viewVideo(theID, theTitle, theDate, theCat, stats, theHd, theUrl) {
	
	var txt_title='<p><b>' + theTitle + '</b><br /><font class="red">' + theDate + '</font> | <font class="blue">' + theCat + '</font></p>';
	
	var txt_code='<p><a onClick="javascript:viewpanel(1)"><img src="images/embed.png" align="absmiddle" border="0" />CONDIVIDI</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onClick="javascript:viewpanel(2)"><img src="images/vote.png" align="absmiddle" border="0" />VOTA IL VIDEO</a></p>';
	
	var txt_hd='<img src="images/hd.png" border="0" alt="Video in HD" title="Video in HD" />';
	
	var txt_embed ='<object width="520" height="292" data="http://www.inabruzzo.com/flowplayer.commercial-3.1.4.swf" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value= \'config={"key": "#$f90cbb4bff0511793e5", "plugins":{"pseudo":{"url":"http://www.inabruzzo.com/flowplayer.pseudostreaming-3.1.3.swf"}},"clip":{"url":"http://www.inabruzzo.com/' + theUrl + '"},"canvas":{"backgroundGradient":"none","border":"2px solid #778899"},"logo":{"url":"http://www.inabruzzo.com/logo.png","fullscreenOnly": false, "displayTime": 0, "linkUrl": "http://www.inabruzzo.com"}}\' /><embed type="application/x-shockwave-flash" width="520" height="292" src="http://www.inabruzzo.com/flowplayer.commercial-3.1.4.swf" flashvars=\'config={"key": "#$f90cbb4bff0511793e5", "plugins":{"pseudo":{"url":"http://www.inabruzzo.com/flowplayer.pseudostreaming-3.1.3.swf"}}, "clip":{"url":"http://www.inabruzzo.com/'+theUrl+'"},"canvas":{"backgroundGradient": "none","border":"2px solid #778899"},"logo": {"url": "http://www.inabruzzo.com/logo.png","fullscreenOnly": false, "displayTime": 0, "linkUrl": "http://www.inabruzzo.com"}}\' /></object>';
	
	var txt_url='http://www.inabruzzo.com/mediagallery.php?id='+theID+'';
	
	var txt_hd_off='';
	
	vote_video(theID,stats);

	document.getElementById("container_title").innerHTML=txt_title;
	document.getElementById("container_title_right").innerHTML=txt_code;
	
	document.getElementById("codice_embed").value=txt_embed;
	document.getElementById("url").value=txt_url;
	
	if(theHd == 1){
	document.getElementById("container_title_tv_right").innerHTML=txt_hd;
	}else{
	document.getElementById("container_title_tv_right").innerHTML=txt_hd_off;
		}
}

function createRequestObject()
{
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}
/* Function called to handle the list that was returned from the internal_request.php file.. */


var http = createRequestObject();

function vote_video(oggId, oggCLICK){
 http.open('GET','vote_video.php?id='+oggId+'&click='+oggCLICK);
 //http.onreadystatechange = test;
 http.send(null); 
}

function playmedia(id, id_button){
if (document.getElementById){
if(id == 'pl_1'){
document.getElementById('pl_1').style.display = 'block';
document.getElementById('pl_2').style.display = 'none';
document.getElementById('votePane').style.display = 'none';
document.getElementById('embedPane').style.display = 'none';
document.getElementById('button_1').style.backgroundImage = 'url(images/tab.png)';
document.getElementById('button_2').style.backgroundImage = 'url(images/tab_off.png)';
} else {
document.getElementById('pl_1').style.display = 'none';
document.getElementById('pl_2').style.display = 'block';
document.getElementById('votePane').style.display = 'none';
document.getElementById('embedPane').style.display = 'none';
document.getElementById('button_1').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_2').style.backgroundImage = 'url(images/tab.png)';
}
}
}

function disable_media_cat(){
if (document.getElementById){
document.getElementById('categoria_4').style.display = 'none';
document.getElementById('categoria_3').style.display = 'none';
document.getElementById('categoria_7').style.display = 'none';
document.getElementById('categoria_5').style.display = 'none';
document.getElementById('categoria_12').style.display = 'none';
document.getElementById('categoria_6').style.display = 'none';
document.getElementById('categoria_1036').style.display = 'none';
document.getElementById('categoria_all').style.display = 'none';
document.getElementById('button_cat_4').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_3').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_7').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_5').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_12').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_6').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_1036').style.backgroundImage = 'url(images/tab_off.png)';
document.getElementById('button_cat_all').style.backgroundImage = 'url(images/tab_off.png)';
	}
}


function view_media_cat(id, id_button, id_cat){
if (document.getElementById){

disable_media_cat();

/*$("#"+id+"_content").load("mediagallery_content.php?id_cat="+id_cat+"");*/

document.getElementById(id).style.display = 'block';
document.getElementById(id_button).style.backgroundImage = 'url(images/tab.png)';

}
}


function viewpanel(id){
if (document.getElementById){
	
if(id == 1){
document.getElementById('embedPane').style.display = 'block';
document.getElementById('votePane').style.display = 'none';
} else {
document.getElementById('embedPane').style.display = 'none';
document.getElementById('votePane').style.display = 'block';
}

}
}

function closepanel(){
if (document.getElementById){

document.getElementById('votePane').style.display = 'none';
document.getElementById('embedPane').style.display = 'none';

}
}