<!--  SET PATHS  -->






<!--  LOAD CAPTIONS  -->
<!-- CHARSET -->


<!-- CAPTIONS -->








<!-- HOME -->


<!-- CALCIO -->













<!-- MOTORI -->






<!-- CICLISMO -->











<!-- GIRO D'ITALIA -->











<!-- BASKET -->









<!-- ALTRI SPORT -->

















<!-- MAGIC CUP -->








<!-- GAZZETTATV -->


<!-- SPORTWEEK -->


<!-- BLOG -->


<!-- GAZZASPACE -->

















<!-- MAGIC -->


<!-- GIOCHI_SCOMMESSE -->


<!-- RICERCA -->



<!-- META DESCRIPTION -->

	
	






<!--  DEBUG MODE  -->

	


<!--  DEBUG MODE a 1 forzato per inserire i css singolarmente  -->



<!--  SET DEFAULTS (SEZIONE, SOTTOSEZIONE, TIPOLOGIA)  -->

	



	



	


<!-- test per sondaggi -->
<!-- PAGINA: (none) -->

<!-- Variabile per controllare se il global.config è già stato caricato -->



//#############################################
//##########  Global vars           ###########
//#############################################

var basePolymediaShowUrl = "http://static2.video.gazzettaobjects.it/widget/"; // modify this to the value of your installation
var searchPolymediaShowUrl = "http://services.rcs.it/webtvrcs/search.jsp?jsoncallback=?";

var relJsPath = "js/";
var relCssPath = "css/";
var relSwfPath = "swf/";
var relConfPath = "content/conf/";
var relAdvPath = "content/adv/";
var relPlaylistPath = "content/playlist/";
var relVideoPath = "content/video/rss/";
var baseUrl = "http://video.gazzetta.it/";


//#############################################
//##########  Check flash version    ##########
//#############################################
document.write('<script type="text/javascript" src="'+basePolymediaShowUrl+relJsPath+'AC_OETagsCustom.js"></scr' + 'ipt>');
//document.write('<script type="text/javascript" src="'+basePolymediaShowUrl+relJsPath+'FEED_CHANNEL.js"></scr' + 'ipt>');
document.write('<script type="text/javascript" src="'+basePolymediaShowUrl+relJsPath+'sifr.js"></scr' + 'ipt>');
document.write('<script type="text/javascript" src="'+basePolymediaShowUrl+relJsPath+'sifr-config.js"></scr' + 'ipt>');

// Major version of Flash required
var requiredMajorVersion = 10;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;

// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = null;
// Version check based upon the values defined in globals
var hasRequestedVersion = null;

//#############################################
//##########       Write CSS         ##########
//#############################################
document.write('<link media="all" type="text/css" href="'+basePolymediaShowUrl+relCssPath+'search.css" rel="stylesheet">');
document.write('<link media="all" type="text/css" href="'+basePolymediaShowUrl+relCssPath+'sifr.css" rel="stylesheet">');

//#############################################
//##########  global functions       ##########
//#############################################

function createSearchPlayer(idWidget,src,params,width,height)
{
	if (hasProductInstall == null) hasProductInstall = DetectFlashVer(6, 0, 65) ;
	if (hasRequestedVersion == null) hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
	if (hasProductInstall && !hasRequestedVersion ) {
	   // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	   // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	   // DO NOT MODIFY THE FOLLOWING FOUR LINES
	   // Location visited after installation is complete if installation is required
	   var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	   var MMredirectURL = encodeURI(window.location);
	   document.title = document.title.slice(0, 47) + " - Flash Player Installation";
	   var MMdoctitle = document.title;

	   return AC_FL_GetContentString(
		   "src", "playerProductInstall",
		   "flashVars", "MMredirectURL="+MMredirectURL+"&MMplayerType="+MMPlayerType+"&MMdoctitle="+MMdoctitle+"",
		   "width", "100%",
		   "height", "100%",
		   "align", "middle",
		   "id", "playerProductInstall",
		   "quality", "high",
		   "bgcolor", "#869ca7",
		   "name", "playerProductInstall",
		   "allowScriptAccess","sameDomain",
		   "type", "application/x-shockwave-flash",
		   "pluginspage", "http://www.adobe.com/go/getflashplayer"
	   );
	} else if (hasRequestedVersion) {
	   // if we've detected an acceptable version
	   // embed the Flash Content SWF when all tests are passed
		return AC_FL_GetContentString(
				"src", src,
				"FlashVars", params,
				"width", width,
				"height", height,
				"align", "middle",
				"id", idWidget,
				"quality", "high",
				"name", idWidget,
				"wmode", "transparent",
				"allowFullScreen", "true",
				"allowScriptAccess","always",
				"type", "application/x-shockwave-flash",
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	 } else {  // flash is too old or we can't detect the plugin
	   var alternateContent = 'Alternate HTML content should be placed here. '
		 + 'This content requires the Adobe Flash Player. '
		  + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
	   //document.write(alternateContent);  // insert non-flash content
	   return alternateContent;
	 }
}

function getPlaylistUrl(playlistId, playlistOrder)
{
	return basePolymediaShowUrl + relPlaylistPath + "playlist_" + playlistId + (playlistOrder != null ? "_" + playlistOrder : "_dateDesc") + ".rss";
}

function getVideoUrl(videoId)
{
	return basePolymediaShowUrl + relVideoPath + "video_" + videoId + ".rss";
}

//#############################################
//##########	Widget Player	     ##########
//#############################################

function getStrPlayer(width, height, configId, mainVideoId, background, backgroundAlpha, autoplay, context, textColor)
{
	/* operazioni di creazione player */
	if (width == null || height == null || configId == null)
	{
		alert("Missing mandatory parameter");
	}

	var flashVars = "configId=" + configId;
	flashVars += "&configUrl=" + basePolymediaShowUrl + relConfPath + "PolymediaShow_" + configId + ".xml";
	if (mainVideoId != null)
	{
		flashVars += "&videoId=" + mainVideoId;
		flashVars += "&videoUrl=" + getVideoUrl(mainVideoId);
	}
	if (background != null)
	{
		flashVars += "&background=" + background;
	}
	else
	{
		flashVars += "&background=#e72f6b";
	}
	if (backgroundAlpha != null)
	{
		flashVars += "&backgroundAlpha=" + backgroundAlpha;
	}
	if (autoplay != null) flashVars += "&autostart=" + autoplay;
	if (context != null)
	{
		if (context.indexOf('/') >= 0)
		{
			flashVars += "&channelName=" + context.substring(0, context.indexOf('/'));
			flashVars += "&subChannelName=" + context.substring(context.indexOf('/') + 1);
		}
		else flashVars += "&channelName=" + context;
	}
	if (textColor != null) flashVars += "&textColor=" + textColor;
	flashVars += "&advChannel=Home";
	
	return createSearchPlayer("PolymediaShow", basePolymediaShowUrl + relSwfPath + "PolymediaShow", flashVars, width, height);

}

//#############################################
//############		Search	     ##############
//#############################################


function changeOrder(order) {
	window.location = baseUrl + "search.shtml?q="+getURLParam('q')+"&sort="+order;
}

function serachByForm() {
	//alert($('#search_input').val());
	//var callUrl = searchPolymediaShowUrl + "&q=" + $('#search_input').val();
	//callSearch(callUrl);
	window.location = baseUrl + "search.shtml?q="+$('#search_input').val();
}

function searchByUrl() {
	var callUrl = searchPolymediaShowUrl + "&q=" +getURLParam('q') + "&start="+getURLParam('start') + "&sort="+getURLParam('sort');
	callSearch(callUrl);
}

var video_close = null;

function callSearch(callUrl) {

	 $.ajax({
		 url: callUrl,
		 dataType: 'jsonp',
		 success: function(data){
			$('#left-col').html(data.html);

			$('div.clickcontainer').click( function(e) {
				closePlayer();

				var c = $(e.target).closest("li");
		
				video_close = c;

				var player = getStrPlayer(669, 590, "0", c.attr("id"), "#d96a8d", "100", "true", "HOME/", "#98143f");
				c.after('<li class="li_Player" id="show-player"><label onclick="closePlayer()" style="cursor: pointer;">CHIUDI</label>'+player+'</li>');
				video_close.removeClass("li_UNselected").addClass("li_selected");
			
				move_player_video();
				
				e.preventDefault();
			});
		 }
	});
}

function move_player_video() {
	document.getElementById('show-player').scrollIntoView(true);
}

function closePlayer() {
	if ($('#show-player') != undefined) {
		$('#show-player').remove();
	}
	try
	{
		 if (video_close != null) 
		 {
			video_close.removeClass("li_selected").addClass("li_UNselected");
			video_close = null;
		 }
	} catch(e){}
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
	var aQueryString = strQueryString.split("&");
	for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
	  if ( aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
		var aParam = aQueryString[iParam].split("=");
		strReturn = aParam[1];
		break;
	  }
	}
  }
  return unescape(strReturn);
}