
// WWW Support Services concepts and systems are proprietary and strictly copyright all rights reserved since 1996. Use on servers, imitation and duplication of any part a WWW Support Services system including: look, feel, methodology, functionality and software is strictly prohibited without written license to do so and pre payment of appropriate fees.

var n="", cr=unescape("%0A")

var sizefactor=1
var autoscale=1260



function start()
{

// displaysidemenu()


displaysidepannel()

displayadverts()

sizefactor=1
autoscale=1260

autosize()

checkeditmode()

}


// both ch and cw needed for viewpic also

var ch=0  
var cw=0

var sizefactor=1
var autoscale=1260

function autosize()
{

if (! document.getElementsByTagName){alert("Your Browser is not compatible with PageAutoSize(tm)"); return;}

if(document.body && typeof(document.body.clientWidth)=='number'){cw=document.body.clientWidth; ch=document.body.clientHeight;} // NS7+, IE5+
else if(typeof(innerWidth)=='number'){cw=innerWidth; ch=innerHeight} // NS4x, 6x, CS7, Opera

if(cw==0){return}

if(cw!=autoscale){

sizefactor=cw/autoscale

var w=0
var ih=0
var mw=0
var wtemp=0
var htemp=0


for(i=0; i<document.images.length; i++){

wtemp=document.images[i].width
htemp=document.images[i].height

document.images[i].width=Math.round(wtemp * sizefactor)
document.images[i].height=Math.round(htemp * sizefactor)

}

document.body.leftMargin=(document.body.leftMargin * sizefactor)
document.body.rightMargin=(document.body.rightMargin * sizefactor)
document.body.topMargin=(document.body.topMargin * sizefactor)

var size
var eachElement


var fontElement=document.getElementsByTagName("table")

for (i=0; i<fontElement.length; i++)
{
eachElement=fontElement[i]
// NS7, Opera
if (document.defaultView){size=document.defaultView.getComputedStyle(eachElement, null).getPropertyValue("font-size")}
// IE6
else if (eachElement.currentStyle){size=eachElement.currentStyle.fontSize}
size=size.substr(0,size.length-2)
eachElement.style.fontSize=Math.round(size*sizefactor)+"px"
}



var fontElement=document.getElementsByTagName("a")

for (i=0; i<fontElement.length; i++)
{
eachElement=fontElement[i]
// NS7, Opera
if (document.defaultView){size=document.defaultView.getComputedStyle(eachElement, null).getPropertyValue("font-size")}
// IE6
else if (eachElement.currentStyle){size=eachElement.currentStyle.fontSize}
size=size.substr(0,size.length-2)
eachElement.style.fontSize=Math.round(size*sizefactor)+"px"
}

var fontElement=document.getElementsByTagName("font")
for (i=0; i<fontElement.length; i++)
{
eachElement=fontElement[i]
// NS7, Opera
if (document.defaultView){size=document.defaultView.getComputedStyle(eachElement, null).getPropertyValue("font-size")}
// IE6
else if (eachElement.currentStyle){size=eachElement.currentStyle.fontSize}
size=size.substr(0,size.length-2)
eachElement.style.fontSize=Math.round(size*sizefactor)+"px"
}
}
}


function checkeditmode()
{

if(top.editenable){

var editElement=document.getElementsByName("editlink")

for (i=0; i<editElement.length; i++)
{
eachElement=editElement[i]

eachElement.style.backgroundColor="FF0000"

}
}
}



// display adverts V2.0

var verticalAdSpace=0
var ads=""
var temp=""
var temp2=0
var adheight=0
var numads=0
var adnum=0

function displayadverts()
{

verticalAdSpace=0
ads=""
temp=""
temp2=0
adheight=0
numads=0
adnum=0

ta=getPositionY('smartbannerTop')
ba=getPositionY('AdsBottom')
verticalAdSpace=(ba-ta)-200

numads=advert.length
var ranpic=new Array(numads)

for(i=0; i<numads; i++)
{

adnum=parseInt(Math.random()*numads)
while(ranpic[adnum]==1){adnum=parseInt(Math.random()*numads)}
ranpic[adnum]=1

temp=unescape(advert[adnum])
temp2=temp.indexOf(">")
adheight=parseInt(temp.substring(2,temp2))
if(verticalAdSpace>0){ads+=temp}
verticalAdSpace-=adheight
}
document.getElementById('smartbannerTop').innerHTML=ads
}



// display side menu

function displaysidemenu(){document.getElementById('sideMenu').innerHTML=unescape(sidemenu)}


// display side pannel V2.0


function displaysidepannel()
{

verticalAdSpace=0
ads=""
temp=""
temp2=0
adheight=0
numads=0
adnum=0

ta=getPositionY('fixedAdsTop')
ba=getPositionY('AdsBottom')
verticalAdSpace=(ba-ta)-200

numads=sideitem.length
var ranpic=new Array(numads)

for(i=0; i<numads; i++)
{

adnum=parseInt(Math.random()*numads)
while(ranpic[adnum]==1){adnum=parseInt(Math.random()*numads)}
ranpic[adnum]=1

temp=unescape(sideitem[adnum])
temp2=temp.indexOf(">")
adheight=parseInt(temp.substring(2,temp2))
if(verticalAdSpace>0){ads+=temp}
verticalAdSpace-=adheight
}
document.getElementById('fixedAdsTop').innerHTML=ads
}

function getPositionY(n)
{
obj=document.getElementById(n)
positionY=0
if (document.getElementById || document.all){while(obj.offsetParent){positionY+=obj.offsetTop; obj=obj.offsetParent }}
else if(document.layers){positionY+=obj.y}
return positionY
}


// view picture

var minWidthForPopUpPicMode=470
var popupmargin=20

var picframe=0
var winnum=1
var buttonbarsize=54
var popupblocker=0
var minwidth=240
var picwins=new Array()
var wincount=0
var winx=10
var winy=popupmargin
var yinc=30
var xinc=100

var winystart=winy
var winxstart=winx
var tempy=0
var windowmoved=0


function viewpic(f)
{


if(top.frames.pictureframe){top.frames.clipboard.showpic(f)}

if (! top.frames.pictureframe)
{

now=new Date()
winnum=now.valueOf()      
wn=winnum.toString()

temp=f.split('_')
tempxy=temp[3].split('x')
u="/cgi-bin/picwin-2.pl?imagefile="+f+"&imgx="+tempxy[0]+"&imgy="+tempxy[1]
wp=window.open(u,wn,"scrollbars=no,toolbar=no,Width="+tempxy[0]+",Height="+((tempxy[1]*1)+(buttonbarsize*1))+", left="+winx+", top="+winy)
picwins[wincount]=wp
wincount++

winy+=yinc

if(((winy*1)+(tempxy[1]*1))>ch){winy=winystart; winx+=xinc; winxstart=winx}

if(! top.window.wp){popupblocker=1}

}

if((popupblocker==1)&&(! top.frames.pictureframe)){top.document.location="/cgi-bin/no-popup-picture.pl?imagefile="+f+"&imgx="+tempxy[0]+"&imgy="+tempxy[1]}

if((popupblocker==0)&&(wincount>1)){for(var i=0; i<wincount; i++){if(picwins[i].closed){}else{picwins[i].focus()}}}

}


// email

function email()
{

var recip="hd#saithstud@co.uk"

var re=/@/gi
recip=recip.replace(re, ".")
re=/#/gi
recip=recip.replace(re, "@")
open('mailto:'+recip+'?subject=Saith Stud Enquiry')
}


// side menu buttons

function smo(n){n.style.backgroundColor="FFFFFF"}
function smu(n){n.style.backgroundColor="84BDFF"}


// main menu buttons

function mmo(n){n.style.backgroundColor="CCECFF"}
function mmu(n){n.style.backgroundColor="84BDFF"}








