/**
 * @author Dream Web
 */
function timecode(){
	var now = new Date();
	var hour        = now.getHours();
	var minute      = now.getMinutes();
	var second      = now.getSeconds();
	var monthnumber = now.getMonth();
	var monthday    = now.getDate();
	var year        = now.getYear();
	tc=year+""+monthnumber+""+monthday+""+hour+""+minute+""+second;
	return tc;
}
function resize(){
	if (navigator.appName=="Netscape") {
		winH = window.innerHeight;
		winW = window.innterWidth;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winH = document.documentElement.clientHeight;
		winW = document.documentElement.clientWidth;

 	}	
	$('photo').height=(winH*0.85);
	$('photo').width=($("photo").height*0.61);
	$('title').height=(winH-$('photo').height-10);
	$('title').width=$('title').height*3.61;
	$('separatorLeftRed').style.width=Math.ceil($('title').width*0.58)+"px";
	$('separatorLeftWhite').style.width=Math.ceil($('title').width-($('title').width*0.58))+"px";
}
function changeBtn(name){
	$(name+"Btn").src="images/btns/"+language+"/"+name+"_over.gif";
	$(name+"Under").className="separatorRightRed";
}
function restoreBtn(name){
	$(name+"Btn").src="images/btns/"+language+"/"+name+".gif";
	$(name+"Under").className="separatorRightWhite";
}
function changeBackground(obj){
	obj.className="rowOver";
}
function restoreBackground(obj){
	obj.className="rowOut";
}
function openContent(name,isLanguage){
	
	arrName=name.split(".");
	$('content').className=arrName[0]+"Bg"+language;
	if (isLanguage==undefined){
		isLanguage=false;
	}
	if(isLanguage==true){
		url="pages/"+language+"/"+name;
	}else{
		url=name+"?language="+language;
	}

	param="timecode="+timecode();
	var myAjax = new Ajax.Request(url, {method: 'get', asynchronous: false, parameters: param, onComplete: changeDiv});
}
function openAlbum(id,from){
	if(from==null){
		from='mostre';
	}
	$('content').className="opereBg"+language;
	url="album.php?language="+language;
	param="album_id="+id+"&from="+from+"&timecode="+timecode();
	var myAjax = new Ajax.Request(url, {method: 'get', asynchronous: false, parameters: param, onComplete: changeDiv});
}
function changeDiv(res){
	if(res!=null){
		$('divContent').innerHTML=res.responseText;
	}
	$('divContent').style.height=$('photo').height-90+"px";
	$('divContent').style.display="block";
	$('divContent').style.overflow="auto";
	$("divContent").scrollTop = 0;
	CB_Init();
}
function openPopup(page){
	window.open(page,"Popup","width=500,height=400,scrolls=yes");
}
