
var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false

var w, h;
function NSresizeFix() {
 if(document.layers)
  w = window.innerWidth;
  h = window.innerHeight;
  window.onResize = reloadIt;
}

function reloadIt() {
 if(w != window.innerWidth || h != window.innerHeight)
  location.reload();
}

function print_content() {
   parent.frames['mainFrame'].focus();
   parent.frames['mainFrame'].print();
}

function print_content_re() {
   parent.frames['dataFrame'].focus();
   if (parent.frames['dataFrame'].pheader)
   {
//      alert('pheader');
//      parent.frames['dataFrame'].setprintheader();
   }
   parent.frames['dataFrame'].print();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
   var i,j=0,objs,x,a=MM_swapImage.arguments;
   document.MM_sr=new Array;
//   alert (a[0])
   for(i=0;i<(a.length-2);i+=3)
      if ((x=MM_findObj(a[i]))!=null)
      {
         document.MM_sr[j++]=x;
         if(!x.oSrc) x.oSrc=x.src;
         x.src=a[i+2];
      }
}

function MM_preloadImages() { //v3.0
   var d=document;
   if(d.images){ 
      if(!d.MM_p) d.MM_p=new Array();
      var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
      for(i=0; i<a.length; i++){
         if (a[i].indexOf("#")!=0){ 
            d.MM_p[j]=new Image;
            d.MM_p[j++].src=a[i];
         }
      }
   }   
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;
  if(!d) d=document;
//  alert('in mm_findobj|'+n+'|');
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
}

function MM_showHideLayers() { //v3.0
   var i,p,v,obj,args=MM_showHideLayers.arguments;
   for (i=0; i<(args.length-2); i+=3) 
      if ((obj=MM_findObj(args[i]))!=null) 
      { 
         v=args[i+2];
         if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
         if(v)// if(v) Added by pf
         obj.visibility=v; 
      }
}
function MM_changezindex() { //v3.0
   var i,p,v,objz,args=MM_changezindex.arguments;
      i=0;
      if ((objz=MM_findObj(args[i]))!=null) 
      { 
         v=args[i+1];
         if (objz.style) 
         { 
            objz=obj.style;
         }
//         alert (objz[0].value;)
//         if(v) {objz.z-index=v;}
      }
}

function MM_swapColor() { //v3.0
  var i,j=0,x,a=MM_swapColor.arguments; document.MM_sc=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sc[j++]=x; if(!x.oCol) x.oCol=x.style.color; x.style.color=a[i+2];}
}

function MM_swapColRestore() { //v3.0
  var i,x,a=document.MM_sc; for(i=0;a&&i<a.length&&(x=a[i])&&x.oCol;i++) x.style.color=x.oCol;
}

function MM_swapClass() { //v3.0
   var i,j=0,x,a=MM_swapClass.arguments;
//   alert ("in MM_swapclass"+a[0]);
   document.MM_sc=new Array;
   for(i=0;i<(a.length-2);i+=3)
      if ((x=MM_findObj(a[i]))!=null)
      {
//         alert ("Found object-" + x.className + "-" + x.oClass);
         document.MM_sc[j++]=x;
         if(!x.oClass) x.oClass=x.className;
         x.className=a[i+2];
      }
}

function MM_swapClassRestore() { //v3.0
  var i,x,a=document.MM_sc; for(i=0;a&&i<a.length&&(x=a[i])&&x.oClass;i++) x.className=x.oClass;
}

function MM_goLocation() { //v3.0
   var i,p,f,h,nh,ht,s,t,q,obj,args=MM_goLocation.arguments;
//alert ("args0 : " + args[0] + "\n" + 
//       "args1 : " + args[1] + "\n" +
//       "args2 : " + args[2] + "\n" +
//       "args3 : " + args[3] + "\n" +
//       "args4 : " + args[4] + "\n");
   var findobj=args[0];
   i=0;
   obj=MM_findObj(findobj);
   b = args[i+1];
   t = args[i+2];
   tf= args[i+3];
   td= args[i+4];
   if (parent.site_mode && parent.site_mode=='preview')
   {
//      alert (parent.site_mode);
      t=t.replace('.html','.htmt');
   }   
   if (parent.site_mode && parent.site_mode=='build')
   {
//      alert (parent.site_mode+'-'+t);
//      t=t.replace('.html','.htmt');
   }   
//alert ("base : " + b + "\n" + 
//       "to   : " + t + "\n" +
//       "tf   : " + tf + "\n" +
//       "td   : " + td + "\n");
   h = obj.href;
   q = h.indexOf("?");
   if (q > 0)
   {
      nh=h.substring(0,q);
   }
   else
   {
      nh=h;
   }
   p = (nh.lastIndexOf("index-2.html") + 1);
   s = nh.substring(0,p);
//alert ("p    : " + p + "\n" + 
//       "q    : " + q + "\n" +
//       "href : " + nh + "\n" +
//       "pref : " + s + "\n" +
//       "hto  : " + ht + "\n");
   if (tf == "_blank")
   {
      ht= td + t;
//alert ("ht view   : " + ht + "\n");
      ViewHTML(ht);  
   }
   else 
   { 
      ht=t;
//      if (b) {ht= b +"/" + t;} else {ht=t;}
//      ht= b +"/" + t;
//alert ("ht obj    : " + ht + "\n");
      obj.href =  ht;

   }
}

function ViewHTML(doc) {
//alert ("doc-" + doc);
    VP=window.open(doc,'ViewHTML','menubar=yes,toolbar=yes,status=no,width=750,height=450,resizable=yes,left=10,top=10');

}

var progWin;
function showfxProg(theUrl,locx,locy,twidth,theight) {

 if(progWin)
 {
  if(!progWin.closed)
   progWin.close();
   delete progWin;
 }
 theUrl = theUrl+"?feedback=";
 progWin = window.open(theUrl,'prog','resizable,scrollbars,height='+theight+'px,width='+twidth+'px,left='+locx+',top='+locy);
 progWin.focus();
}

function ViewPhoto(title,imageLocation,pwidth,pheight,print,price) {
    var wwidth;
    var wheight;
    var mytitle = '';
   
    if (print == 1) {
        wwidth = pwidth + 50;
        wheight = pheight + 80;
        VP = window.open('', 'ViewPhoto', 'scrollbars,menubar=no,toolbar=no,status=no,width=' + wwidth + ',height=' + wheight + ',resizable=no,left=10,top=10');
    }
    else {
        wwidth = pwidth + 25;
        if (price != undefined)
            wheight = pheight + 180;
        else
            wheight = pheight + 100;
        VP = window.open('', 'ViewPhoto', 'menubar=no,toolbar=no,status=no,width=' + wwidth + ',height=' + wheight + ',resizable=no,left=10,top=10');
    }
    
    if (title != '')
        mytitle = 'Twinkle Tots - ' + title;
    else
        mytitle = 'Twinkle Tots - View Image';
    VP.document.open('text/html','replace');
    VP.document.write('<html><head><title>'+mytitle+'</title></head>');
    VP.document.write('<body><center>');
    if (price != undefined)
        VP.document.write('<H2><B>' + title + '</B></H2>');
    VP.document.write('<img src="' + imageLocation + '" border=1 width=' + pwidth + ' height=' + pheight + '>');
    VP.document.write('<br>')
    if (price != undefined)
        VP.document.write('<br>' + price + '<br>')
    VP.document.write('<form><input type=button value="Close Window" onclick="javascript:parent.window.close();"></form>');
    VP.document.write('</body></html>');
    VP.focus();
}

//function StoreTour(images,pwidth,pheight) {
function StoreTour(pwidth,pheight) {
    var wwidth = pwidth + 25;
    var wheight = pheight + 110;
	//var pics='images/tw01.jpg|images/tw02.jpg|images/tw03.jpg|images/tw04.jpg|images/tw05.jpg|images/tw06.jpg|images/tw07.jpg|images/tw08.jpg|images/tw09.jpg';

	VP = window.open('http://www.twinkletots.com.au/storetour.html','StoreTour','menubar=no,toolbar=no,status=no,width='+wwidth+',height='+wheight+',resizable=no,left=10,top=10');
	//VP = window.open('http://www.twinkletots.com.au/storetour.html','StoreTour','menubar=yes,toolbar=yes,status=yes,width='+wwidth+',height='+wheight+',resizable=yes,left=10,top=10');
    //VP.document.open('text/html','replace');
    //VP.document.write('<html><head><title>Twinkle Tots - Store Tour</title>');

	//VP.document.write('<script src="ac_runactivecontent.js" type="text/javascript"></script>');
	//VP.document.write('<script src="slideshow.js" type="text/javascript"></script>');
	//VP.document.write('<script type="text/javascript">');
	//VP.document.write('AC_FL_RunContent(''codebase'',''http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'',''width'','''+pwidth+''',''height'','''+pheight+''',''title'',''Slide Show'',''src'',''focus_Gj'',''wmode'',''opaque'',''FlashVars'',''pics='+images+'&borderwidth='+pwidth+'&borderheight='+pheight+',''menu'',''false'',''bgcolor'',''#FFFFFF'',''quality'',''high'',''width'','''+pwidth+''',''height'','''+pheight+''',''allowScriptAccess'',''sameDomain'',''type'',''application/x-shockwave-flash'',''pluginspage'',''http://www.macromedia.com/go/getflashplayer'',''movie'',''focus_Gj'' );');
	//VP.document.write('</script>');

	//VP.document.write('</head>');
    //VP.document.write('<body><center>');
    //VP.document.write('<H2><B>Twinkle Tots - Store Tour</B></H2>');
    /////////////VP.document.write('<img src="' + images + '" border=1 width=' + pwidth + ' height=' + pheight + '>');
    //VP.document.write('<br>')
    //VP.document.write('<form><input type=button value="Close Window" onclick="javascript:parent.window.close();"></form>');
    //VP.document.write('</body></html>');
    //VP.focus();
}

var lastmenu=0
var prevmenu=0;
function showMenus (divName,divNumber) 
{
   var menusUsed = parent.menusUsed;
   if (menusUsed > 0)
   {
      if (navigator.appName.indexOf ("Microsoft") == 0 || navigator.appName.indexOf ("Netscape") == 0) 
      {
         if (parseInt (navigator.appVersion) >= 4) 
         {
            var cnt = 0; 
            prevmenu=lastmenu;
            lastmenu=divNumber;
   //         alert (divName+"-"+divNumber+"-"+lastmenu+"-"+prevmenu);
            if (!(lastmenu==0 && prevmenu!=0))
            {
               for (cnt = 1; cnt <= menusUsed; cnt++) 
               {
                  var divCheck = divName + cnt; 
                  var divShow = divName + divNumber;
                  var divobj = divCheck+'?mainFrame';
                  if (divCheck == divShow)  
                  {
                     MM_showHideLayers(divobj,'','show');
                  }
                  else
                  {
                     MM_showHideLayers(divobj,'','hide');
                  }
               }
            }
         }
         else
         {
            alert ('Sorry, your browser does not support popup menus');
         }
      }
      else
      {
         alert ('Sorry, your browser does not support popup menus');
      }
   }   
}

function write_popups()
{
   if (obj=MM_findObj('popups?mainFrame'))
   {
      obj.innerHTML=vpopup;
   }
}

var designWin;
function designwindow() {
   if(designWin) {
      designWin.close()
      delete designWin;
   }
   var theUrl = 'design_frameset2427.html?&siteED=0'
//   designWin = parent.frames['buildFrame'].window.open(theUrl,'design','status=no,menubar=no,toolbar=no,location=no,directories=no,resizable=no,height=200,width=260,left=425,top=205');
   designWin = window.open(theUrl,'design','status=no,menubar=no,toolbar=no,location=no,directories=no,resizable=no,height=480,width=650,left=35,top=50');
   designWin.focus()
}
