/*
        ggggggggggg
        ggggggggggg
        ggggggggggg
 gggg   gggg   gggg
 gggg   gggg   gggg
 gggg   gggg   gggg
 gggg          gggg
 gggg          gggg
 gggggggggggggggggg
 gggggggggggggggggg   
 gggggggggggggggggg    © 2000 - 2005 graphicator.com | masterscript v2.01 | by blexa */
 
 
 
// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function over_button(his,farba){his.style.backgroundColor=farba;}
function over_border(his,farba){his.style.borderColor=farba;}
function over_image(his,obr){his.src=obr;}

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.div_hidden : document.getElementById("div_hidden");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="div_hidden"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="div_hidden"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.div_hidden.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.div_hidden.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");
 
 
 
 
 
 
 
 
 
 
 
 
 

function show_simple(img,note,title) {
	window.open("system/modules/popupgallery/showpic.php?"+img+"&"+note+"&"+title, "photoWin", "scrollbars=no,status=no,width=500,height=390");
}

function show_simple_gallery(images,img) {
	window.open("system/modules/popupgallery/showgallery.php?"+images+"&"+img, "photoWin", "scrollbars=no,status=no,width=500,height=390");
}

function hide_simple_gallery_div() {
	var div = document.getElementById("div_hidden");
	div.style.display="none";
}

function show_simple_gallery_div(images,img) {
	var div = document.getElementById("div_hidden");
	var div_hidden_content = document.getElementById("div_hidden_content");
	
	var imgs = images.split("^");
	var imgid = img;
	var desc = new Array();
	for(var i=0; i<imgs.length; i++) {
		if(imgs[i].indexOf(":::")!=-1) {
			imgid=i;
			imgs[i] = imgs[i].substr(0,imgs[i].indexOf(":::"));
		}
		desc[i] = '';			
		var pipe=imgs[i].indexOf('|||');
		if(pipe != -1) {
			desc[i] = imgs[i].substr(pipe+3);
			imgs[i] = imgs[i].substr(0,pipe);
		}
	}
	images = images.replace(/:::/g,"");	
	images = images.replace(/\"/g, "&quot;");
	
	var htmlcode;
	
	var img = document.getElementById("show_simple_gallery_img");
	if(img != undefined) {
		img.src="system/routines/imagemagic/imagethumb.php?s="+imgs[imgid]+"&w=600&h=600";			
		
		var bottom = document.getElementById("show_simple_gallery_div_bottom");
		htmlcode = '';
		
		htmlcode += "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>";
		
		htmlcode += "<td align=\"left\" width=\"30\">";
		if(imgid>0) {
			htmlcode += "<img src=\"system/modules/popupgallery/images/btn_back.gif\" onclick=\"show_simple_gallery_div('"+images+"','"+(imgid-1)+"')\"></div>";
		}
		htmlcode += "</td><td align=\"center\" style=\"color:black\">"+desc[imgid]+"\u00a0</td>";
		if(imgid<imgs.length-2) {
			htmlcode += "<td align=\"right\" width=\"53\"><img src=\"system/modules/popupgallery/images/btn_stop.gif\" onclick=\"hide_simple_gallery_div()\"> <img src=\"system/modules/popupgallery/images/btn_next.gif\" onclick=\"show_simple_gallery_div('"+images+"','"+(imgid-1+2)+"')\">";
			img.onclick = function() {show_simple_gallery_div(images,(imgid-1+2));}
		}
		else {
			htmlcode += "<td align=\"right\" width=\"30\"><img src=\"system/modules/popupgallery/images/btn_stop.gif\" onclick=\"hide_simple_gallery_div()\"> ";
			img.onclick = function() {hide_simple_gallery_div();}
		}
		htmlcode += "</td></tr></table>";
		
		bottom.innerHTML = htmlcode;
		div.style.display="block";
	}
	else {
		htmlcode = "<div style=\"cursor:move;\"><div style=\"margin:10px 10px 5px 10px;\"><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"center\"><img id=\"show_simple_gallery_img\" "+(imgid<imgs.length-2?"onclick=\"show_simple_gallery_div('"+images+"','"+(imgid-1+2)+"')\"":"onclick=\"hide_simple_gallery_div()\"")+ "src=\"system/routines/imagemagic/imagethumb.php?s="+imgs[imgid]+"&w=600&h=500\"></td></tr><tr><td>";
		
		
		htmlcode += "<div id=\"show_simple_gallery_div_bottom\">";
		
		htmlcode += "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>";
		
		htmlcode += "<td align=\"left\" width=\"30\">";
		if(imgid>0) {
			htmlcode += "<img src=\"system/modules/popupgallery/images/btn_back.gif\" onclick=\"show_simple_gallery_div('"+images+"','"+(imgid-1)+"')\"></div>";
		}
		htmlcode += "</td><td align=\"center\" style=\"color:black\">"+desc[imgid]+"\u00a0</td>";
		if(imgid<imgs.length-2) {
			htmlcode += "<td align=\"right\" width=\"53\"><img src=\"system/modules/popupgallery/images/btn_stop.gif\" onclick=\"hide_simple_gallery_div()\"> <img src=\"system/modules/popupgallery/images/btn_next.gif\" onclick=\"show_simple_gallery_div('"+images+"','"+(imgid-1+2)+"')\">";
		}
		else
			htmlcode += "<td align=\"right\" width=\"30\"><img src=\"system/modules/popupgallery/images/btn_stop.gif\" onclick=\"hide_simple_gallery_div()\"> ";
		htmlcode += "</td></tr></table>";
		
		htmlcode += "</div></td></tr></table></div></div>";
		
		div_hidden_content.innerHTML = htmlcode;
		div.style.display="block";
		div.style.top = document.body.scrollTop+10;
	
	}
	//window.open("system/modules/popupgallery/showgallery.php?"+images+"&"+img, "photoWin", "scrollbars=no,status=no,width=500,height=390");
}

function over(his,obr){
	document.getElementById(his).src=obr;
}
	
function display(evt,id,content){
	var status;
	status=document.getElementById(id).style.display;
	var divX = evt.clientX + document.documentElement.scrollLeft || evt.clientX + window.scrollX,
        divY = evt.clientY + document.documentElement.scrollTop || evt.clientY + window.scrollY;
	if (status=='none'){
		document.getElementById(id).style.display='block';
		if (divX<900){
			document.getElementById(id).style.top=''+(divY+5)+'px'
			document.getElementById(id).style.left=''+(divX+5)+'px'
		}
		else{
			document.getElementById(id).style.top=''+(divY+5)+'px'
			document.getElementById(id).style.left=''+(divX-160)+'px'
		}
		document.getElementById(id).innerHTML='<span id=\"close_help\" onclick=\"hide(\'help\');\">x</span>';
		document.getElementById(id).innerHTML+=content;
	}
	if (status=='block'){
		document.getElementById(id).style.display='none';
		document.getElementById(id).innerHTML='';
		display(evt,id,content);
	}
}

function hide(id){
document.getElementById(id).style.display='none';
document.getElementById(id).innerHTML='';
}
