/*
	Lets you toogle a picture on and off. On page image should be invisible (clearpic)
	then on tooglePic, the loaded-src is saved, and exchanged to the new src suppiled as arg
	on the second tooglePic, the load-time src is restored, and so on...
	one advantage is that the pictures are actually loaded on demand, when they are showed first time
	
*/

var loadPics = Array();	
function tooglePic(imgId,url){
        	    
    if(loadPics[imgId] == null){
        loadPics[imgId] = document.all[imgId].src;
    }    
    if(loadPics[imgId] != null && document.all[imgId].src == loadPics[imgId]){
        document.all[imgId].src = url;
    } else if(loadPics[imgId] != null && document.all[imgId].src != loadPics[imgId]){
        document.all[imgId].src = loadPics[imgId];
    }        
}
	
	
	
function showZoom(img,title) {  <!--<< Smarty fix -->
		//alert(img);
		
		var zoomAddress = 'zoom.php?zoomImage=' + img + '&title=' + title;
		args = new Array();
		args['height'] = 600;
		args['width'] = 800;
		args['scrollbars'] = true;
		myref = openPopUp(zoomAddress, 'piczoom',true,args);
		myRef.focus();
		//window.open(zoomAddress,'zoom', 'width=800,height=600,left=50,top=50,toolbar=no,scrollbars=yes,titlebar=no,status=no,resizable=yes');
    
} 

var w = 800, h = 600; //<--default screen-size if none detected
var defs = new Array();
defs['height'] = 400;
defs['width'] = 500;
defs['left'] = 50;
defs['top'] = 50;

function openPopUp(url, name, center, args){
            
            if (document.all || document.layers) {
                w = screen.availWidth;
                h = screen.availHeight;
            }            
            topP = (args['top'])?args['top']:defs['top']; 
            left = (args['left'])?args['left']:defs['left'];            
            height = (args['height'])?args['height']:defs['height'];
            width = (args['width'])?args['width']:defs['width'];
            scrollbars = (args['scrollbars'])?1:0;
            status = (args['status'])?1:0;
            
            if(center){
                left = (w-width)/2;
                topP = (h-height)/2;
            }                        
	    myRef = window.open(url,name,'left='+left+',top='+topP+',width='+width+',height='+height+',menubar=0, scrollbars='+scrollbars +', toolbar=0,resizable=1,  location=0, directotries=0, status='+status+'');	
            return myRef;    
}

      
       
function openEditor(edurl, popW, popH){
            
		args = new Array();
		args['height'] = popH;
		args['width'] = popW;
		args['scrollbars'] = true;
		args['status'] = true;
		
		//window.showModalDialog(edurl,"editor","dialogHeight: "+popH+"px; dialogWidth: "+popW+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: Yes; status: Yes;");
		
		myref = openPopUp(edurl, 'editor',true,args);
		myRef.focus();
}


function confirmLink(theLink, confirmMsg)
{
    // Confirmation is not required in the configuration file
    //if (confirmMsg == '') {
    //    return true;
    //}

    var is_confirmed = confirm(confirmMsg);
    if (is_confirmed) {
        theLink.href += '&confirmed=1';
    }

    return is_confirmed;
} // end of the 'confirmLink()' function

<!--<< Smarty fix -->
