function mkEmailAddress(pre,domain)
{
  str = "<a href='mailto:";
  str += pre;
  str += "@";
  str += domain;
  str += "'>";
  str += pre;
  str += "@";
  str += domain;
  str += "</a>";

  document.write(str);
}

function classifyPages(page)
{
  if (page == "home")
    return 1;
  else if (page == "about")
    return 2;
  else if (page == "products")
    return 3;
  else if (page == "export")
    return 4;
  else if (page == "downloads")
    return 5;
  else if (page == "links")
    return 6;
  else
    return 0;
}


function mkmenu(relpath,page)
{
  if (relpath != "")
  {
    relpath += "/";
  }

  str = "<table><tr><td><img width=174 height=51 src="+relpath+"common/styles/riclogo"+classifyPages(page)+".png></td>";
  if (page == "home")
    str += "<td width='65px'><a class=menu1 href="+relpath+"index.html><u>Home</u></a>&nbsp;&nbsp;&nbsp;</td>";
  else
    str += "<td width='65px'><a class=menu1 href="+relpath+"index.html>Home</a>&nbsp;&nbsp;&nbsp;</td>";

  if (page == "about")
    str += "<td width='85px'><a class=menu2 href="+relpath+"about/about.html><u>About RiC</u></a>&nbsp;&nbsp;&nbsp;</td>";
  else
    str += "<td width='85px'><a class=menu2 href="+relpath+"about/about.html>About RiC</a>&nbsp;&nbsp;&nbsp;</td>";

  if (page == "products")
    str += "<td width='85px'><a class=menu3 href="+relpath+"products/products_kitchen.html><u>Products</u></a>&nbsp;&nbsp;&nbsp;</td>";
  else
    str += "<td width='85px'><a class=menu3 href="+relpath+"products/products_kitchen.html>Products</a>&nbsp;&nbsp;&nbsp;</td>";

  if (page == "export")
    str += "<td width='130px'><a class=menu4 href="+relpath+"export/export.html><u>Sales & Export</u></a>&nbsp;&nbsp;&nbsp;</td>";
  else
    str += "<td width='130px'><a class=menu4 href="+relpath+"export/export.html>Sales & Export</a>&nbsp;&nbsp;&nbsp;</td>";

  if (page == "downloads")
    str += "<td width='100px'><a class=menu5 href="+relpath+"downloads/downloads.html><u>Downloads</u></a>&nbsp;&nbsp;&nbsp;</td>";
  else
    str += "<td width='100px'><a class=menu5 href="+relpath+"downloads/downloads.html>Downloads</a>&nbsp;&nbsp;&nbsp;</td>";

  if (page == "links")
    str += "<td width='65px'><a class=menu6 href="+relpath+"links/links.html><u>Links</u></a>&nbsp;&nbsp;&nbsp;</td>";
  else
    str += "<td width='65px'><a class=menu6 href="+relpath+"links/links.html>Links</a>&nbsp;&nbsp;&nbsp;</td>";

  str += "</tr></table>";

  document.write(str);
}

function mkfooter()
{
  document.write
  (
    "<div class=footer>"+
    "Layout and photo: Kristine Palsgaard, Birgitte Truelsen and Asger Eir<br>"+
    "Web Design & Master: <a class=sub href=http://www.eir-home.dk>"+
    "Asger Eir (www.eir-home.dk)</a> ... Last updated August 2010</div>"
  )
}

function mknewsisland()
{
  str =  "<div class=island>";
  str +=   "<div class=islandheader>Upcoming Events</div>";
  str +=   "<div class=islandcontent>";
  str +=     "<a href=''http://www.formland.dk''>Formland in Herning</a>, DK.<br>";
  str +=     "Feb. 20.-23. August 2010";  
  str +=     "<br><a href=''http://www.earlybird-messe.de''>Hamburger-Einkaufstage Fair</a><br>";
  str +=     "in Germany.<br>";
  str +=     "15.-17. Januar 2010<br>";
  str +=     "<br>";
  str +=   "</div>";
  str += "</div>";

  document.write(str);
}

function mkcatalogueisland(includeselfref)
{
  str =  "<div class=island>";
  str +=   "<div class=islandheader>Catalogues</div>";
  str +=   "<div class=islandcontent>";
  str +=     "<br>Download the product<br>";
  str +=     "catalogues.<br>";
  str +=     "<br>";
  if (includeselfref)
  {
    str +=     "<a target=<a href='products_kitchen_cat.html'>Kitchen</a> (<a target='_blank' href='../common/cat/kitchen.pdf'>new window</a>)<br>";
    str +=     "<a target=<a href='products_bath_cat.html'>Bath</a> (<a target='_blank' href='../common/cat/bath.pdf'>new window</a>)<br>";
    str +=     "<a target=<a href='products_children_cat.html'>Children</a> (<a target='_blank' href='../common/cat/children.pdf'>new window</a>)<br>";
    str +=     "<a target=<a href='products_livingroom_cat.html'>Living Room</a> (<a target='_blank' href='../common/cat/livingroom.pdf'>new window</a>)<br>";
  }
  else
  {
    str +=     "<a target='_blank' href='./common/cat/kitchen.pdf'>Kitchen</a><br>";
    str +=     "<a target='_blank' href='./common/cat/bath.pdf'>Bath</a><br>";
    str +=     "<a target='_blank' href='./common/cat/children.pdf'>Children</a><br>";
    str +=     "<a target='_blank' href='./common/cat/livingroom.pdf'>Living Room</a><br>";
  }
  str +=   "</div>";
  str += "</div>";

  document.write(str);
}

function mkcolourchart()
{
  str =  "<div class=island>";
  str +=   "<div class=islandheader>Colour chart</div>";
  str +=   "<div class=islandcontent>";
  str +=     "<br>See the variaty of<br>";
  str +=     "colours in the colour<br>";
  str +=     "chart.<br>";
  str +=     "<br>";
  str +=     "<a href='products_colourchart.html'>Browse</a> (<a href='../common/pictures/colourchart/colourchart.png' target='_blank'>in new window</a>)";
  str +=   "</div>";
  str += "</div>";

  document.write(str);
}

function verticalspace()
{
  document.write("<br>");
}


function mkBasicProductMenu()
{
  str =  "<div class=island>";
  str +=   "<div class=islandheader>Basic by RIC</div>";
  str +=   "<div class=contextmenu>";
  str +=     "<br><br>";
  str +=     "&nbsp;&nbsp;<a href='products_kitchen.html'>Kitchen</a><br><br>";
  str +=     "&nbsp;&nbsp;<a href='products_bath.html'>Bath</a><br><br>";
  str +=     "&nbsp;&nbsp;<a href='products_children.html'>Children</a><br><br>";
  str +=     "&nbsp;&nbsp;<a href='products_other.html'>Living Room</a><br><br>";
  str +=     "&nbsp;&nbsp;<a href='products_all.html'>All</a><br><br>";
  str +=   "</div>";
  str += "</div>";

  document.write(str);
}


/* Image preloading */

function changeProductImage(path,i)
{
  document.images.productimage.src = path + eval(i) + "med.jpg"
}

function changeProductText(newtext)
{
  var id;
  if (document.getElementById)
  {
    id = document.getElementById("producttext");
  }
  else
  {
    id = document.all.producttext;
  }
  id.innerHTML='<font face="Verdana"><small>'+newtext+'</small></font>';
}

function changeProductInfo(path,i,newtext)
{
  changeProductImage(path,i);
  changeProductText(newtext);
}


// begin absolutely positioned scrollable area object scripts
function verifyCompatibleBrowser()
{
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;

    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}

bw=new verifyCompatibleBrowser()

var speed=35

var loop, timer

function ConstructObject(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
    this.up=MoveAreaUp;this.down=MoveAreaDown;
    this.MoveArea=MoveArea; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}
function MoveArea(x,y){
    this.x=x;this.y=y
    this.css.left=this.x
    this.css.top=this.y
}

function MoveAreaDown(move)
{
    if(this.y>-this.scrollHeight+objContainer.clipHeight)
    {
    this.MoveArea(0,this.y-move)
    if(loop) setTimeout(this.obj+".down("+move+")",speed)
    }
}
function MoveAreaUp(move){
    if(this.y<0)
    {
    this.MoveArea(0,this.y-move)
    if(loop) setTimeout(this.obj+".up("+move+")",speed)
    }
}

function PerformScroll(speed){
    if(initialised){
        loop=true;
        if(speed>0) objScroller.down(speed)
        else objScroller.up(speed)
    }
}

function CeaseScroll(){
    loop=false
    if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
    objContainer=new ConstructObject('divContainer')
    objScroller=new ConstructObject('divContent','divContainer')
    objScroller.MoveArea(0,0)
    objContainer.css.visibility='visible'
    initialised=true;
}
// end absolutely positioned scrollable area object scripts

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

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_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_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; 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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 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 loadIndexImages()
{
  index_kitchen_on = new Image();
  index_kitchen_on.src = "kitchen.png";
  index_kitchen_off = new Image();
  index_kitchen_off.src = "kitchen-x.png";

  index_bath_on = new Image();
  index_bath_on.src = "bath.png";
  index_bath_off = new Image();
  index_bath_off.src = "bath-x.png";

  index_children_on = new Image();
  index_children_on.src = "children.png";
  index_children_off = new Image();
  index_children_off.src = "children-x.png";

  index_livingroom_on = new Image();
  index_livingroom_on.src = "livingroom.png";
  index_livingroom_off = new Image();
  index_livingroom_off.src = "livingroom-x.png";

}

function setImage(imagename,objectsrc)
{
  document.images[imagename].src = eval(objectsrc + ".src");
}


