// - chris's new window function
function newWindow(WinName, ImgName, theTitle, theDate) {
WinName=ImgName;
var stripped = theTitle.replace(/&nbsp;/g," ");
    if (theDate=="Y")
    {
    //alert("yes");
      var hrefText1='A signed Gicl&eacute;e print of this painting is available';
      var hrefText2='Click here to make an enquiry';
       var cgMail ='mailto:malcolm-ryan@hotmail.co.uk?subject=Enquiry regarding: '+stripped ;
        }
       else
       {
     //  alert("noooo");
      var cgMail ='mailto:malcolm-ryan@hotmail.co.uk?subject=Enquiry from website';
        var hrefText1=' ';
         var hrefText2='email malcolm ryan';
        }
   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>"+hrefText1 +"<br><span style='font-size:11px;'><a href='"+cgMail+"'>"+hrefText2+"</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("A%20butterfly%20in%20winter%201996%2076x51cm.jpg", "", "As a boy in London, given an old bicycle I escaped to the countryside.  In the early 1950s even North Essex was remote.  It was a revelation discovering  medieval churches and so I began my drawing skills.", "", "", "A butterfly in winter &nbsp;1996 &nbsp;(76x51cm)&nbsp;&nbsp;&nbsp;&nbsp;");
      //chris  var lastImg = readCookie('lastimage');
       // alert(lastImg);
               jumpToImage(replaceCharacter('A%20butterfly%20in%20winter%201996%2076x51cm.jpg', '%20', ''));
//chris        jumpToImage(replaceCharacter(lastImg, '%20', ''));
//        alert(lastImg);
        return;
}
function nc_reloadPrev_top() { if  (document.cookie){
       var lastImg = readCookie('lastimage');
       }
       else {
       var lastImg = 0;
       }
//        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;
        }

