
// 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 minWidthForAds=670
var minWidthForClipBoard=920
var minWidthForPopUpPicMode=470
var topmargin=20

var website=document.referrer
var valid=0
var cw=0
var ch=0
var temp=""
var title=""
var popupblocker=0
var cr=unescape("%0A%0D")

var screenheight=screen.availHeight
var screenwidth=screen.availWidth



function start()
{

// check for valid Alternate Referer website and show alternate logo / menu or stay with wcd default

n=document.getElementById('heading')
if(window.alternatereferer){
var validreferrers=alternatereferer.split(",")
for(var i=0; i<validreferrers.length; i++){
if(website.indexOf(validreferrers[i])>-1){
valid=1
advertEnable=eval("advertsenable"+i)
headlinecode=eval("headlinecode"+i)
}}
}
if(valid==1){if(headlinecode.length>10){n.innerHTML=headlinecode}}
n.style.visibility="visible"


// get screen size

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


// include ads if enabled and screen wide enough

if((cw>minWidthForAds)&&(advertEnable=="yes"))
{
document.getElementById('sidepanel').width=204
document.getElementById('gutter').width=parseInt(cw/32)
smartbannerPannel()
}

}


// SmartBanner Pannel V4.0

function smartbannerPannel()
{
ty=smartbannerGetY('smartbannerTop')
by=smartbannerGetY('smartbannerBottom')
h=(by-ty)-20
if(h>100){document.getElementById('smartbannerTop').innerHTML='<IFRAME ID="smartbanner" SRC="smartbanner/ads.htm" WIDTH=100% HEIGHT='+h+' frameborder=0 marginwidth=0 scrolling=no marginheight=0 allowtransparency=true vspace=0 hspace=0></IFRAME>'}
}


function smartbannerGetY(n)
{
obj=document.getElementById(n)
smartbannerY=0
if (document.getElementById || document.all){while(obj.offsetParent){smartbannerY+=obj.offsetTop; obj=obj.offsetParent }}
else if(document.layers){smartbannerY+=obj.y}
return smartbannerY
}

// end SmartBanner Pannel V4.0


// get video

function getvideo()
{
if(video.length>12){document.location=video}
else{alert("Sorry No Video Available")}
}


// get progeny

function progeny()
{
alert("Sorry Progeny Search not currently Available")
}


// get more

function more()
{
if(infolink.length>12){document.location=infolink}
else{alert("Sorry No More currently available")}
}


// edit page

function editpage(h)
{

alert("This feature will be enabled soon")

}


// view picture

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=topmargin
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="http://www.welshcobdirectory.co.uk/cgi-bin/picwin.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=winy+yinc

if(((winy*1)+(tempxy[1]*1))>ch){winy=winystart; winx+=xinc; winxstart=winx}

if(! top.window.wp){popupblocker=1}
else {

if(windowmoved==0)
{

windowmoved=1

// resize window

if(parseInt(navigator.appVersion)>3){
if(navigator.appName=="Netscape"){top.outerWidth=minWidthForPopUpPicMode}
else{top.resizeTo(minWidthForPopUpPicMode,screenheight-topmargin)}
}

// move window

window.moveTo(screenwidth-minWidthForPopUpPicMode, topmargin)

}
}
}

if((popupblocker==1)&&(! top.frames.pictureframe)){top.document.location="picture-frame.htm?"+document.location+"#"+f}

if((popupblocker==0)&&(wincount>1)){for(var i=0; i<wincount; i++){if(picwins[i].closed){}else{picwins[i].focus()}}}

}


function clipboard() {

if (top.frames.pictureframe){return}

// check screen wide enough

if(screenwidth<minWidthForClipBoard)
{
h="You need a minimum Screen Width of"+cr
h+=minWidthForClipBoard+" pixels to use Photo Clip Board."
alert(h)
return 
}

// check window big enough, if not enlarge

windowsize()
if(cw<minWidthForClipBoard){

// enlarge window

if(parseInt(navigator.appVersion)>3){
if(navigator.appName=="Netscape"){top.outerWidth=minWidthForClipBoard}
else{top.resizeTo(minWidthForClipBoard,screenheight-topmargin)}
}

// centre window

window.moveTo( parseInt((screenwidth-minWidthForClipBoard)/2), topmargin)

}

// start clipboard

top.document.location="picture-frame.htm?"+document.location

}


function windowsize()
{

if(typeof(window.innerWidth)=='number'){
//Non-IE
cw=window.innerWidth
ch=window.innerHeight
}
else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight )){
//IE 6+ in standards compliant mode
cw=document.documentElement.clientWidth
ch=document.documentElement.clientHeight
}
else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
//IE 4 compatible
cw=document.body.clientWidth
ch=document.body.clientHeight
}

}


function popuphelp()
{
h="It seems your Browser is unable to see or is stoping your"+cr
h+="mouse click to open a picture window. It could be a PopUp"+cr
h+="Blocker or your Browser Settings that is causing the problem."+cr
h+=cr
h+="We will now try and open the Picture Window as a regular page,"+cr
h+="but you may not be able to view and compare a number of pictures"+cr
h+="all on your screen at the same time."+cr
h+=cr
alert(h)
}


// breeding table mouse overs

function bv(n){n.style.backgroundColor="FFFFFF"}
function bos(n){n.style.backgroundColor="76A9CC"}
function bom(n){n.style.backgroundColor="FF99CC"}


// cobgle search engine

function search()
{
a="We are sorry the search service is not available."+cr+"The Cobgle Search Engine is being upgraded"
alert(a)
}


// photo help

var ph=""
var u="welsh-cob-and-pony-directory-photo-help.htm"

function photohelp()
{
ph=window.open(u,"photohelp","scrollbars=yes,toolbar=no,Width=730,Height=540,Left=20,Top=30")
if(! window.ph){popupadvice("Help")}
}

// popup advice

function popupadvice(){alert("Your PopUp Blocker may be Stoping the PopUp "+n+" Window")}


// stats 

var st=""
var sp="cgi-bin/stats-menu.pl"

function horsestats(n)
{
if(window.st){window.st.close()}
st=window.open(sp+"?countfile="+n,"stats","scrollbars=yes,toolbar=no,Width=784,Height=516,Left=20,Top=30")
if(! window.st){popupadvice("Stats")}
}

