    
	var newWindow;


	function si(str,id){
                var obj=(document.getElementById) ? document.getElementById('i_content') : eval("document.all['i_content']");
                if( obj == null ){
                        /*RELOAD THE PAGE AT THE DESIRED OPTION*/
                        loadOption(id);
                }else{
                        if(!obj.src){ loadOption(id); }
                        obj.src="http://www.lifestorynet.com/"+str;

                        var btn=(document.getElementById) ? document.getElementById(id) : eval("document.all['"+id+"']");

                        if( btn != null && btn.src !=null && document.ml != null && document.ml.length != null ){
                                for ( var i=0,n=document.ml.length; i<n; i++ ){document.ml[i].src="http://www.lifestorynet.com/image/inactive.gif";}
                                btn.src="http://www.lifestorynet.com/image/active.gif";
                                return false;
                        }else{
                                loadOption(id);
                        }
                }
        }


        function loadOption(option){
                document.location.href="http://www.lifestorynet.com/memories/<?php echo $pageid;?>/"+option+"/";
        }

        function closeUploader(){
                document.getElementById("galleryuploader").style.visibility="hidden";
                document.getElementById("galleryuploader").style.display="none";
        }

        function closeUploaderRefresh(){
                var obj=(document.getElementById) ? document.getElementById('galleryuploader') : eval("document.all['galleryuploader']");
                obj.style.visibility="hidden";
                si("gallery.php?obitid=<?php echo $pageid?>","gallery");
        }

        function openUploader(){
                var obj=(document.getElementById) ? document.getElementById('galleryuploader') : eval("document.all['galleryuploader']");
                obj.style.visibility="visible";
                obj.style.display="block";
        }


	function addEvents(pid){
		var list=new Array('lifestory','visitationservice','thoughts','guestbook','contributions','flowers','memoryfolder','film','gallery');
		var nl,objL,str;		
		var pages=new Array();
			pages.push('lifestory.php?obitid='+pid);
			pages.push('vscf.php?pageid='+pid+'&option=vs');
			pages.push('shareamemory.php?obitid='+pid+'&start=0&action=view');
			pages.push('guestbook.php?obitid='+pid+'&start=0&action=view');
			pages.push('vscf.php?pageid='+pid+'&option=contributions');
			pages.push('vscf.php?pageid='+pid+'&option=flowers');
			pages.push('memoryfolder.php?obitid='+pid);
			pages.push('film.php?obitid='+pid);
			pages.push('gallery.php?obitid='+pid);

		for(var i=0; i<list.length; i++){
			nl=list[i]+"link";

			objL=(document.getElementById) ? document.getElementById(nl) : eval("document.all['"+nl+"']");

			if(objL != null){
				str="javascript:si('"+pages[i]+"','"+list[i]+"'); void(0); return false;";
				fn="function(){si('"+pages[i]+"','"+list[i]+"'); void(0); return false;}";
			
				/*THE ORDER TO WHICH WE ADD THE CLICK EVENTS IS IMPORTANT*/	
				if( objL.onclick ){objL.onclick=str;}
				if( objL.attachEvent ){eval('objL.attachEvent("onclick",'+fn+',false)');}
				if( objL.addEventListener ){eval('objL.addEventListener("click",'+fn+',false)');}
				if( objL.setAttribute ){objL.setAttribute("onclick",str);}
	
			}
		}
	}


	function faqpop(){
		if(newWindow!=null){newWindow.close();}
		newWindow=window.open('http://www.lifestorynet.com/faq/1/','LSN','width=468,height=200,left=200,top=200,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');
		newWindow.focus();
	}
