//Creado con Ardora - www.webardora.net
//bajo licencia Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
//para otros usos contacte con el autor
function loadPage() {if (tiAval){parent.iniciaActividade()} $(".photoContainer").mouseover(function(){var indexHelp = parseInt($(this).attr("id").substring(4));if ($.trim(itemHelp[indexHelp - 1])){
paintHelp($("#item"+indexHelp.toString()));}}).mouseleave(function () {document.getElementById("ardoraHelpCanvas").style["visibility"] = "hidden";});cssColors();
}
function unloadPage(){}
function showIma(num) {
var imaN="ima"+num.toString();var titN="tit"+num.toString();var nextN="next"+num.toString();var prevN="prev"+num.toString();var musN="mus"+num.toString();var txtN="txt"+num.toString();
var upN = "up" + num.toString();var upTxtN = "upTxt" + num.toString();
var wImaN = fileX[num-1]; var hImaN = fileY[num-1];
$("#ardoraMain").append("<div id='"+imaN+"' class='photoMG'><img src='0_resources/media/imaMG/" + fileIma[num-1] + "'/></div>");
if ($.trim(itemHelp[num - 1])) {$("#"+imaN).append("<div class='titleIma'><p>"+itemHelp[num - 1]+"</p></div>");}
$("#"+imaN).append("<div  id='"+titN+"' class='bClose' title='Close'>E</div>");
$("#"+imaN).append("<div  id='"+nextN+"' class='bNext' title='Next'>C</div>");
$("#"+imaN).append("<div  id='"+prevN+"' class='bPrev' title='Previous'>A</div>");
if (($.trim(fileMP3[num - 1])) || ($.trim(fileOgg[num - 1]))) {audioCreate(num);}
if ($.trim(conType[num-1])){showCon(num)}
if ($.trim(txt[num-1])){
$("#" + imaN).append("<div  id='" + upN + "' class='bUp' title='Comments'>I</div>");
$("#" + imaN).append("<div  id='" + upTxtN + "' class='bUpTxt'><p>"+txt[num-1]+"</p></div>");
$("#" + upTxtN).css("visibility","hidden");
$("#" + upN).click(function () {
if ($("#" + upTxtN).css("visibility")=="hidden"){
$("#" + upTxtN).css("visibility","visible");
}else{
$("#" + upTxtN).css("visibility","hidden");
}});
}
$("#"+nextN).click(function() {
$("#"+imaN).animate({
left: ($("#item" + num.toString()).position().left+$("#item" + num.toString()).width()/2).toString() + "px",
top: ($("#item" + num.toString()).position().top+$("#item" + num.toString()).height()/2).toString()+"px",
width: "0px",
height: "0px"
}, 500, function () {
$("#"+imaN).remove();
if (num > fileIma.length - 1) {if (($("#ima1").length)==0){showIma(1);}
} else {if (($("#ima"+(num+1).toString()).length)==0){showIma(num + 1)};}
});});
$("#" + prevN).click(function () {
$("#" + imaN).animate({
left: ($("#item" + num.toString()).position().left + $("#item" + num.toString()).width() / 2).toString() + "px",
top: ($("#item" + num.toString()).position().top + $("#item" + num.toString()).height() / 2).toString() + "px",
width: "0px", height: "0px"}, 500, function () {$("#" + imaN).remove();
if (num < 2) {if (($("#ima"+(fileIma.length).toString()).length)==0){showIma(fileIma.length)};
}else {if (($("#ima"+(num-1).toString()).length)==0){showIma(num - 1)};}});});
$("#"+titN).click(function() {
$("#"+imaN).animate({
left: ($("#item" + num.toString()).position().left+$("#item" + num.toString()).width()/2).toString() + "px",
top: ($("#item" + num.toString()).position().top+$("#item" + num.toString()).height()/2).toString()+"px",
width: "0px",
height: "0px"
}, 500, function () {$("#"+imaN).remove();});
});
var vTop = $("#item" + num.toString()).position().top + $("#ardoraAct").position().top;
var cssObj = {
"top": vTop.toString() + "px",
"left": $("#item" + num.toString()).position().left.toString() + "px",
"width": "10px",
"height": "10px", 
"z-index":giveZindex("div"), 
"background": colorBack 
}; 
$("#"+imaN).css(cssObj);
$("#"+imaN).click(function() {
$("#"+imaN).css("z-index",giveZindex("div")+1);
});
var posX = ($(window).width() - 800) / 2;
if (posX < 0) {posX = 0}
var posY = ($(window).height() - 600) / 2;
if (posY < 0) {posY = 0}
$("#"+imaN).animate({
left: posX,
top: posY,
width: wImaN+"px",
height: hImaN+"px"
}, 500, function () {});
$(".photoMG").draggable({
handle: "img",
cursor: "move"
});
cssColors();
}
function showCon(num){
var objN = "obj" + num.toString(); var imaN="ima"+num.toString();var txtN="txt"+num.toString();
$("#"+imaN).append("<div  id='"+txtN+"' class='bTxt' title=' Contido'>N</div>");
$("#" + txtN).click(function () {if ($("#"+objN).length){$("#"+objN).remove();
$("#"+imaN).append("<img src='0_resources/media/imaMG/" + fileIma[num-1] + "'/>");
}else{
$("#"+imaN+ " img").remove();
if (conType[num-1]=="0"){
$("#"+imaN).append("<object id='"+objN+"' class='obj' type='text/html' data='"+conLink[num-1]+"'></object>")
}if (conType[num-1]=="1"){
$("#"+imaN).append("<div id='"+objN+"' class='obj'>"+conLink[num-1]+"</div>");}
if (conType[num - 1] == "2") {
var cTy="text/html";
var ext=(conLink[num - 1].substring(conLink[num - 1].lastIndexOf("."))).toLowerCase();
if (ext==".pdf"){ cTy="application/pdf"}
if (ext==".swf"){ cTy="application/x-shockwave-flash"}
if (ext==".jar"){ cTy="application/x-java-applet"}
if (ext==".mov"){ cTy="video/quicktime"}
if (ext==".flv"){ cTy="image/x-flv"}
if (ext==".mp4"){ cTy="image/mp4"}
if (ext==".mpg"){ cTy="image/mpeg"}
if (ext==".jpg"){ cTy="image/jpeg"}
if (ext==".gif"){ cTy="image/gif"}
if (ext==".png"){ cTy="image/png"}
if (ext==".svg"){ cTy="image/svg+xml"}
if (ext==".png"){ cTy="image/png"}
if (ext==".tiff") {cTy="image/tiff"}
if (ext==".xml"){ cTy="image/xml"}
$("#" + imaN).append("<object id='" + objN + "' class='obj' type='"+cTy+"' data='" + conLink[num - 1] + "'></object>")
}
if (conType[num-1]=="3"){
$("#"+imaN).append("<object id='"+objN+"' class='obj' type='text/html' data='"+conLink[num-1]+"'></object>")}
}});}
function audioCreate(num){var imaN = "ima" + num.toString();var musN = "mus" + num.toString();var playN = "player" + num.toString();var sourceLine="";
$("#"+imaN).append("<div  id='"+musN+"' class='bMus' title='Audio'>K</div>");
$("#" + musN).click(function () {
if ($("#"+playN).length){ $("#" + playN).remove();}
else{if ($.trim(fileMP3[num-1])) {
sourceLine=sourceLine+"<source src='0_resources/media/"+fileMP3[num-1]+"' type='audio/mp3' />";}
if ($.trim(fileOgg[num-1])) {
sourceLine=sourceLine+"<source src='0_resources/media/"+fileOgg[num-1]+"' type='audio/ogg'/>";}
$("#"+imaN).append("<div  id='" +playN+ "' class='playerAudio'><audio controls='controls'>"+sourceLine+"</audio></div>");}});}
function paintHelp(item){document.getElementById("ardoraHelpCanvas").style.zIndex=3;var canvas = document.getElementById("ardoraHelpCanvas");canvas.width = canvas.width;var contexto = canvas.getContext("2d");
contexto.font="10px fActi";var indexHelp=parseInt($(item).attr("id").substring(4));var metricsW = contexto.measureText(itemHelp[indexHelp-1]).width+20;
var metricsH = 20+10+10;$("#ardoraHelpCanvas").attr({"width": metricsW,"height": metricsH});var topHelp=Math.round($(item).position().top)-metricsH;
var leftHelp=Math.round($(item).position().left)+10-(canvas.width/2);var xPoint=0;if (leftHelp<5){leftHelp=5;xPoint=Math.round($(item).position().left)+10;};
document.getElementById("ardoraHelpCanvas").style["visibility"]="visible";document.getElementById("ardoraHelpCanvas").style["position"]="absolute";document.getElementById("ardoraHelpCanvas").style["top"]=topHelp.toString()+"px";
document.getElementById("ardoraHelpCanvas").style["left"]=leftHelp.toString()+"px";
contexto.fillStyle=colorSele;paintBubble(contexto,0,0,canvas.width-10, canvas.height-3,xPoint,10);
contexto.beginPath();contexto.lineWidth="1";contexto.textAlign="left";
contexto.font="10px fActi";contexto.shadowBlur = 0;contexto.shadowOffsetX = 0;contexto.shadowOffsetY = 0;
contexto.fillStyle=colorText;contexto.fillText(itemHelp[indexHelp-1], 5, 20);contexto.fill();}
function cssColors(){
$("body").css("background-color",colorBack);$(".photoContainer").css("background-color",colorSele);
$("#ardoraMain").css("color",colorText);
$("#ardoraMain").css("font-family",fEnun); $(".photoMG").css("font-family",fActi);
}
