// JavaScript Document

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function changeFrame(iframe1URL, frame_id)
{
document.getElementById("info"+frame_id).className = "white_selected";
var prev = document.getElementById("prev_info_div");
document.getElementById("info"+prev.value).className = "white";
document.getElementById("prev_info_div").value = frame_id;
parent.mainFrame.location.href=iframe1URL;
}

function changesubFrame(iframe1URL)
{
parent.mainFrame.location.href="choose_sub_gallery.php";
parent.subframe.location.href=iframe1URL;
}


function changeImage(imageURL) {

document.getElementById('main_image').src=imageURL

}

function doNothing()
{
}

function confirm_delete(go_url, message)
{
var answer = confirm("ΠΡΟΣΟΧΗ! ΟΛΟΙ ΟΙ ΣΥΝΔΕΣΜΟΙ ΤΗΣ ΚΑΤΗΓΟΡΙΑΣ " + message + " ΘΑ ΔΙΑΓΡΑΦΟΥΝ ΑΠΟ ΤΗΝ ΒΑΣΗ. ΘΕΛΕΤΕ ΝΑ ΠΡΟΧΩΡΗΣΕΤΕ;");
if (answer)
	{
location=go_url;
	}
}

function confirm_delete2(go_url, message)
{
var answer = confirm("ΠΡΟΣΟΧΗ! ΕΙΣΤΕ ΣΙΓΟΥΡΟΣ ΟΤΙ ΘΕΛΕΤΕ ΝΑ ΔΙΑΓΡΑΨΕΤΕ ΤΟΝ ΣΥΝΔΕΣΜΟ " + message + " ΑΠΟ ΤΗΝ ΒΑΣΗ;");
if (answer)
	{
location=go_url;
	}
}

function confirm_delete3(go_url, message)
{
var answer = confirm("ΠΡΟΣΟΧΗ! ΕΙΣΤΕ ΣΙΓΟΥΡΟΣ ΟΤΙ ΘΕΛΕΤΕ ΝΑ ΔΙΑΓΡΑΨΕΤΕ ΤΟ ΚΕΙΜΕΝΟ " + message + " ΑΠΟ ΤΗΝ ΒΑΣΗ;");
if (answer)
	{
location=go_url;
	}
}

function confirm_delete4(go_url, message)
{
var answer = confirm("ΠΡΟΣΟΧΗ! ΕΙΣΤΕ ΣΙΓΟΥΡΟΣ ΟΤΙ ΘΕΛΕΤΕ ΝΑ ΔΙΑΓΡΑΨΕΤΕ ΤΟ ΝΕΟ " + message + " ΑΠΟ ΤΗΝ ΒΑΣΗ;");
if (answer)
	{
location=go_url;
	}
}

function remote(){
NewWindow=window.open('gallery_items.php?status=add','newWin','width=400,height=350,left=0,top=0,toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No');
NewWindow.focus();
screen_height = window.screen.availHeight; screen_width = window.screen.availWidth; left_point = parseInt(screen_width/2)-(400/2); top_point = parseInt(screen_height/2)-(350/2); 
setTimeout('NewWindow.moveTo(left_point,top_point)',0); 
void(0);
NewWindow.creator=self
}

function remote_edit(id){
NewWindow=window.open('gallery_items.php?id='+id+'&status=edit','newWin','width=400,height=350,left=0,top=0,toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No');
NewWindow.focus();
screen_height = window.screen.availHeight; screen_width = window.screen.availWidth; left_point = parseInt(screen_width/2)-(400/2); top_point = parseInt(screen_height/2)-(350/2); 
setTimeout('NewWindow.moveTo(left_point,top_point)',0); 
void(0);
NewWindow.creator=self
}

var newwindow = ''
function popitup(url,w,h) {
if (newwindow.location && !newwindow.closed) {
    newwindow.location.href = url;
    newwindow.focus(); }
else
	{
    newwindow=window.open(url,'htmlname','width='+w+',height='+h+',resizable=0, left=500, top=60')
	}

}
function tidy() {
if (newwindow.location && !newwindow.closed) {
   newwindow.close(); }
}


function loading() {

}

function initImage() {
  imageId = 'main_photo';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function change_photo(album_id, photo_id, m_top, photo_title) {
	document.main_photo.src = '../gallery/loading.gif';
	document.main_photo.src = '../gallery/' + album_id + '/' + photo_id + 'large.jpg';
	document.getElementById("photo_link").href = '../gallery/' + album_id + '/' + photo_id + 'xlarge.jpg';
	document.getElementById("main_photo").style.marginTop = m_top + "px";
	document.getElementById("photo_title").innerHTML = photo_title;
//	initImage();
}

function confirm_delete() {
	var answer = confirm('Είστε σίγουρος οτι θέλετε να προχωρήσετε σε διαγραφή;');
	if(answer) {return true;}
	else {return false;}
}

