// - chris's new window function
function newWindow(WinName, ImgName, theTitle, theDate) {
   winStats='toolbar=no,location=no,directories=no,menubar=no, status=no,titlebar=no'
   winStats+='scrollbars=yes'
   if (navigator.appName.indexOf("Microsoft")>=0) {
      winStats+=',left=40,top=30,width=690,height=666'
    }else{
      winStats+=',screenX=40,screenY=30,width=690,height=666'
    }
   newWindow=window.open(WinName,"notation",winStats)

   newWindow.document.write ("<link rel='stylesheet' type='text/css' href='http://www.malcolmryanpaintings.co.uk/style/galleryStyle.css'><body bgcolor=#2F2B27 style='margin-top:4px;'><center>")
   newWindow.document.write ("<table border='0'><tr><td align='center' style='font-family:verdana; font-size: 18px; color:white'>Malcolm Ryan<span style='font-size:14px;'> Paintings</span></td></tr><tr><td><img src='" + ImgName + "' vspace='6'></td></tr>")
   newWindow.document.writeln ("<tr><td style='font-family:verdana; font-size: 12px; color:white'>"+theTitle+"<br>Oil on Canvas<br><a class='windowlink' href='prints_for_sale.html' target='_blank'>"+theDate +"</a><br><span style='font-size:11px;'><a href='mailto:malcolm-ryan@hotmail.co.uk?subject=Enquiry from website'>email malcolm ryan</a></span></td></tr>")
   newWindow.document.writeln ("<tr><td align='center'><p><form>")
   newWindow.document.write ("<input type='button' value='Close Window' ")
   newWindow.document.writeln ("onclick='top.close()'>")
   newWindow.document.writeln ("</font></center></form></td></tr></table>")
   newWindow.document.writeln ("</body>")
      newWindow.document.close()
location.reload()
//   winStats='toolbar=yes,location=yes,directories=yes,menubar=yes,width=700,height=630'
// -   self.focus()
//   onUnload=(winStats='toolbar=yes,location=yes,directories=yes,menubar=yes,width=700,height=630')
}
function createCookie(name,value,days) {
        if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
}

function eraseCookie(name) {
        createCookie(name,"",-1);
}
function nc_reloadPrev() {
myImagesIndexed[0] = new Array("Alice%20at%20Cwmbrwyno%201995%2056x61cm.jpg", "", "The innocence of her childish figure required sharper contrast than the intended vase of flowers.  She stands in this house where she was born.  In the Cambrian mountains of Wales.", "", "", "Alice at Cwmbrwyno &nbsp;1995 &nbsp;(56x61cm)&nbsp;&nbsp;&nbsp;&nbsp;");
        var lastImg = readCookie('lastimage');
       // alert(lastImg);
 jumpToImage(replaceCharacter('Alice%20at%20Cwmbrwyno%201995%2056x61cm.jpg', '%20', ''));
//        jumpToImage(replaceCharacter(lastImg, '%20', ''));
//        alert(lastImg);
        return;
}
function nc_reloadPrev_top() {
 if  (document.cookie){
       var lastImg = readCookie('lastimage');
       }
       else {
       var lastImg = 0;
       }
 // chris       var lastImg = readCookie('lastimage');
//        top.BottomFrame.currentImage = lastImg;
top.BottomFrame.setTopFrameImage("theImage", ("../images/" + replaceCharacter(top.BottomFrame.myImagesIndexed[lastImg][0], '%20', ' ')),top.BottomFrame.myImagesIndexed[lastImg][2]);   
        return;
}
 function replaceCharacter(str, oldCharacter, newCharacter) {
                if(str != -1) {
                        var strArray = str.split(oldCharacter);
                        str = strArray.join(newCharacter);
                        //alert(str);
                }
                return str;
        }

