function initMovie(div_container, player_url, file_url, preview_url, width, height){
	var s1 = new SWFObject(player_url,"ply"+div_container,width,height,"9","#FFFFFF");
	s1.addParam("allowfullscreen","true");
	s1.addParam("allowscriptaccess","always");
	s1.addParam("flashvars","file="+file_url+"&image="+preview_url);
	s1.write(div_container);
}


function showPlayer(div_hidden_movie) {
	if(document.getElementById("video_container") != null && document.getElementById(div_hidden_movie) != null){
		document.getElementById("video_container").innerHTML = document.getElementById(div_hidden_movie).innerHTML;
	}
}

function getWindowHeight() { 

    var p = [window.innerHeight ? window.innerHeight : null, document.body ? document.body.clientHeight : null, document.documentElement ? document.documentElement.clientHeight : null];

    for (var i = 0; i < p.length; i++) {

        if (p[i] > 0) return p[i];

    }

    return 0;

}



function getWindowWidth() { 

    var p = [window.innerWidth ? window.innerWidth : null, document.documentElement ? document.documentElement.clientWidth : null, document.body ? document.body.clientWidth : null];

    for (var i = 0; i < p.length; i++) {

        if (p[i] > 0) return p[i];

    }

    return 0;

}



function showVideo(id){    

    var f_width = getWindowWidth();

    var f_height = getWindowHeight();

    

    var h = '<div id="video'+id+'" class="videoBack">';

    h += '<div id="video'+id+'C" class="videoC" style=" position:relative;margin-top:'+parseInt(f_height/2 - 290)+'px;margin-left:'+parseInt(f_width/2 - 320)+'px">';

	h += '<div id="closevideo" style="height:50px; width:50px; position:absolute; z-index:99;margin-left:640px;cursor:pointer;background:url(./fileadmin/templates/img/X_close.png) no-repeat" onclick="hideVideo('+id+');"><img src="./fileadmin/templates/img/trasp.gif" width="50" height="50" onclick="hideVideo('+id+');" alt="chiudi" /></div>';

    h += '<div style="height:560px; width:640px;padding-top:50px;">';

    h += '<!-- longtail start -->';
    h += '<div id="video_container"></div>';
    //h += '<div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div> ';
    //h += '<script type="text/javascript" src="./fileadmin/templates/js/swfobject.js"></script>';
    //h += '<script type="text/javascript">';
    //h += 'var s1 = new SWFObject("./fileadmin/templates/mediaplayer/player.swf","ply","328","200","9","#FFFFFF"); ';
    //h += 's1.addParam("allowfullscreen","true");';
    //h += 's1.addParam("allowscriptaccess","always");';
    //h += 's1.addParam("flashvars","file=./fileadmin/templates/mediaplayer/video.flv&image=preview.jpg");';
    //h += 's1.write("container");';
    //h += '</script> ';
    //h += '<img src="./fileadmin/templates/mediaplayer/preview.jpg"> ';
    //h += '<p>dasdasdasdas</p>';

    //h += '<!-- longtail stop -->';



    h += '</div>';

    h += '</div>';

    h += '</div>';

    

	var div = document.getElementById("videocarrier");

	if(div == null){

    	div = document.createElement("DIV");

    	document.body.appendChild(div);

		div.id = "videocarrier";		

	}

    div.innerHTML = h;



    div.style["height"] = f_height + "px";



	if(typeof(pngfix) != typeof(undefined)){

		pngfix();

	}

}



function hideVideo(id){

	var div = document.getElementById("video"+id);
	
	if(div != null){
		document.getElementById("video"+id).innerHTML="";
		div.parentNode.removeChild(div);
	}

}



function setValue(val, label){

	var hiddenFA = document.getElementById('hiddenFA');

	hiddenFA.value = val;

	var selectShow = document.getElementById('selectShow');

	selectShow.value = label;

	var div = document.getElementById('faMenu');

	div.style["display"] = "none"

}

function shoowMenu(who){

	var div = document.getElementById(who);

	div.style["display"] = "block";

	div.style["left"] = document.getElementById('selectShow').offsetLeft + "px";

	div.style["top"] = "28px";

}

function hideMenu(who){

	var div = document.getElementById(who);

	div.style["display"] = "none";

}



