function chkObject(inParent,theVal) {
    if(inParent){
        if (window.opener.document.getElementById(theVal) != null) {
            return true;
        } else {
        return false;
    }
}else{
if (document.getElementById(theVal) != null) {
    return true;
} else {
return false;
}
}
}


function getWindowWidth(){
    var ww = 0;
    d = document;
    if ( typeof window.innerWidth != 'undefined' )
        ww = window.innerWidth;  // NN and Opera version
    else
        {
            if ( d.documentElement
                && typeof d.documentElement.clientWidth!='undefined'
                && d.documentElement.clientWidth != 0 )
            ww = d.documentElement.clientWidth;
            else
                if ( d.body
                    && typeof d.body.clientWidth != 'undefined' )
                ww = d.body.clientWidth;
                else alert ("Can't identify window width - please tell me which browser you are using.")
                }
                return ww;
            }
            function getWindowHeight(){
                var ww = 0;
                d = document;
                if ( typeof window.innerHeight != 'undefined' )
                    wh = window.innerHeight;  // NN and Opera version
                else
                    {
                        if ( d.documentElement
                            && typeof d.documentElement.clientHeight!='undefined'
                            && d.documentElement.clientHeight != 0 )
                        wh = d.documentElement.clientHeight;
                        else
                            if ( d.body
                                && typeof d.body.clientHeight != 'undefined' )
                            wh = d.body.clientHeight;
                            else alert ("Can't identify window width - please tell me which browser you are using.")
                            }
                            return wh;
                        }
                        
                        //Preloaded slideshow script- By Jason Moon
                        //For this script and more
                        //Visit http://www.dynamicdrive.com
                        
                        // PUT THE URL'S OF YOUR IMAGES INTO THIS ARRAY...
                        var Slides = new Array("img/pag1/1.jpg","img/pag1/2.jpg","img/pag1/3.jpg","img/pag1/5.jpg","img/pag1/6.jpg");
                        
                        // DO NOT EDIT BELOW THIS LINE!
                        var SlideReady = false;
                        function CacheImage(ImageSource) { // TURNS THE STRING INTO AN IMAGE OBJECT
                            var ImageObject = new Image();
                            ImageObject.src = ImageSource;
                            return ImageObject;
                        }
                        
                        function ShowSlide(Direction) {
                            if (SlideReady) {
                                NextSlide = CurrentSlide + Direction;
                                // THIS WILL DISABLE THE BUTTONS (IE-ONLY)
                                document.SlideShow.Previous.disabled = (NextSlide == 0);
                                document.SlideShow.Next.disabled = (NextSlide == 
                                    (Slides.length-1));
                                if (NextSlide >= Slides.length) NextSlide=0;
                                if ((NextSlide >= 0) && (NextSlide < Slides.length)) {
                                    document.images['Screen'].src = Slides[NextSlide].src;
                                    CurrentSlide = NextSlide++;
                                    Message = 'Picture ' + (CurrentSlide+1) + ' of ' + 
                                    Slides.length;
                                    self.defaultStatus = Message;
                                    if (Direction == 1) CacheNextSlide();
                                }
                                return true;
                            }
                        }
                        
                        function Download() {
                            if (Slides[NextSlide].complete) {
                                SlideReady = true;
                                self.defaultStatus = Message;
                            }
                            else setTimeout("Download()", 100); // CHECKS DOWNLOAD STATUS EVERY 100 MS
                            return true;
                        }
                        
                        function CacheNextSlide() {
                            if ((NextSlide < Slides.length) && (typeof Slides[NextSlide] == 
                                'string'))
                            { // ONLY CACHES THE IMAGES ONCE
                                SlideReady = false;
                                self.defaultStatus = 'Downloading next picture...';
                                Slides[NextSlide] = CacheImage(Slides[NextSlide]);
                                Download();
                            }
                            return true;
                        }
                        
                        function StartSlideShow() {
                            CurrentSlide = -1;
                            Slides[0] = CacheImage(Slides[0]);
                            SlideReady = true;
                            ShowSlide(1);
                        }