// - chris's new window function
function newWindow(WinName, ImgName, theTitle, theGicleeStuff, theDate) {
//alert(ImgName);
//alert(theTitle);
//alert(theGicleeStuff);
//alert(theDate);
// chris new vars
 var stripped = theTitle.replace(/&nbsp;/g," ");
 //alert(stripped);
 var cgMail ='mailto:malcolm-ryan@hotmail.co.uk?subject=Enquiry regarding: '+stripped ;
 //alert(cgMail);
   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>"+theDate+"<br>"+theGicleeStuff+"<br><span style='font-size:11px;'><a href='"+cgMail+"'>Click here to make an enquiry</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("Ely%20cathedral%20in%20sleet%202001%2081x81cm.jpg", "1", "Signed limited edition of 260 prints. Please click for further details.", "Signed limited edition of 260 prints (image size 400 x 400 mm)", "£88 each inc postage in UK", "Ely Cathedral in Sleet &nbsp;2001 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        var lastImg = readCookie('lastimage');
       // alert(lastImg);
 jumpToImage(replaceCharacter('Ely%20cathedral%20in%20sleet%202001%2081x81cm.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;
        }

