var openDiv = null;
var last = '';
var win = null;

function showDiv(object, width, height) {
	scroll(0, 0);
	if(window.innerWidth) {
		document.getElementById(object).style.left = ((window.innerWidth / 2) - (width / 2)) + 'px';
	} else {
		document.getElementById(object).style.left = ((document.body.offsetWidth / 2) - (width / 2)) + 'px';
	}
	
	height = height / 2;
	document.getElementById(object).style.top = height + 'px';
	
	document.getElementById(object).style.display = 'block';
	
	openDiv = object;
	
	if (object == 'videoBox'){
		changeVideo('makingoff2008.flv');
	}
}

function hideDiv(object) {
	document.getElementById(object).style.display = 'none';
	openDiv = null;
	if (object == 'videoBox'){
		changeVideo(null);
		//document.getElementById('videoBox').innerHTML = '';
	}
	
}

function changeVideo(v) {
	var FO = {	movie:"flvplayer.swf",width:"320",height:"278",majorversion:"7",build:"0",bgcolor:"#000000",
				flashvars:"file="+v+"&showdigits=true&autostart=true&showfsbutton=false" };
				//flashvars:"file=VTS_01_1.VOB.FLV&showdigits=true&autostart=true&showfsbutton=true" };
	UFO.create(	FO, "player1");
}


function Centrar(pagina,titulo,w,h,scrollu,resize){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollu+',resizable='+resize+'';
	win = window.open(pagina,titulo,settings)
}

function setCookie(c_name,value,expiredays){
	
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name){
	
	if (document.cookie.length>0){
  		c_start=document.cookie.indexOf(c_name + "=");
  		if (c_start!=-1){ 
		    c_start=c_start + c_name.length+1; 
		    c_end=document.cookie.indexOf(";",c_start);
    	
			if (c_end==-1) c_end=document.cookie.length;
			
    		return unescape(document.cookie.substring(c_start,c_end));
    	} 
  	}
	
	return "";
	
}
function deleteCookie(c_name){
	if ( getCookie( c_name ) ) document.cookie = c_name + "=" + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
