//SiteWeave Services -General JS

 
//--------Load images with standard path/filename

function preloadImages() { 
  if(document.images){ 
 document.preload=new Array();
    		var i,
		j=document.preload.length,
		a=preloadImages.arguments;//arguments in onload - body tag 
		for(i=0; i<a.length; i++)
    { document.preload[j]=new Image; document.preload[j++].src=a[i];}}
};

//---------EoFn

function rollOver(img_name,img_src){
 if(document.images){
document[img_name].src=img_src;
}
};

function rollOut(img_name,img_src) {
if(document.images){
document[img_name].src=img_src;
}
};

//---------EoFn

//---------open detail windows with size passed from call
// reference like <a href="#" onclick="detailWindow('download-details.htm','400','450')">

function detailWindow(url,w,h){
if(document.images){
var dimensions
var winName
winName ='win1'
dimensions='width='+w+',height='+h+',resizable=1,scrollbars=1'
detailwin=window.open(url,winName,dimensions);
detailwin.focus()
}
}

//----------EoFn

//---------open detail windows in fixed size

function fixedWindow(url){

if(document.images){
detailwin=window.open(url,'win1','width=650,height=400,resizable=1,scrollbars=1');
detailwin.focus()
}
}

//----------EoFn


//----open a particular url in a new window -ns6 opens same window ns4 ignores completely

function kenrand()
{
var url
url='http://www.kenrand.co.uk'
if(document.images){
detailwin=window.open(url,'win1','');
detailwin.focus()
}
}

//-----------EoFn


// Random images -----

imgno= 7  // set to number of images in folder- number images starting with zero           

function loadRand() {
{
randomNum = Math.floor((Math.random()* imgno));
document.imagename.src= "imagefolder/" + randomNum + ".jpg"        
} 
}

//Eof ----------------------------------

// load image according to day of the week

function loadDay()
{
weekdays=new Date
thisday=weekdays.getDay()
document.imagename.src= "imagefolder/" + thisday + ".jpg"
}

//Eof ----------------------------------


// onmouseover sound in IE4 and above only
//put this on the page: <EMBED SRC="jb-click2.wav" autostart="false" hidden="true"></embed><bgsound id="sound">

function playSound() 
{
if (document.all)
 {
  document.all.sound.src = "jb-click2.wav";
 }
}
//---------EoFn

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//EoFn

//cross browser find element

function MM_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

//---------EoFn

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; }
    obj.visibility=v; }
}

//-------------EoFn

//clear any showing navigation layer using above function
function hideAll(){
MM_showHideLayers('hom','','hide','wel','','hide','who','','hide','wha','','hide','whe','','hide','you','','hide','con','','hide');
}

//------------EoFn

//-----------functions for scrolling text (see shopfittingunits)
//--referencing the script--onload="initializetypeit()"
//the scrolling text my have an id of "typing" - usually a div tag

 var typeitstart=0 //for function typeit - scrolling text	
   //var head="display:''" 
    function initializetypeit(){
	if(document.all)	
    mytext=typing.innerText
    var myheight=typing.offsetHeight
    typing.innerText=''
    document.all.typing.style.height=myheight
    typeit()
    }
    function typeit(){
		
    typing.insertAdjacentText("beforeEnd",mytext.charAt(typeitstart))
    if (typeitstart<mytext.length-1){
    typeitstart++
    setTimeout("typeit()",80)
    }
    else
    return
    }
//-------------------EoFns for scrolling text


