/* f.uk ad delivery javascript July 17, 2000

This is a generic script for producing the dynamic elements of fashionuk ad banners. 


Function makeref() for generates a number between 100 and 999. Use this in all ad banner calls.

Function getSection is used to generate the section id (eg resources, fashion etc). 

It checks the URL path and uses the top level folder in fashionuk to generate a default value.

This value can be overriden by adding the following code to the head section of a page in fuk:

<script language= "JavaScript">
var adsection = "clinic"
</script>


Series of write statements used to build the advertising box. All URLs absolute references

To generate some new adcode, replace the HTML below and use the 'sect' and random number variables (here called
badgeID and ad2, but can be whatever you want as long as they call the makeref() function/

*/


function makeref() {
	var adref = 0;
	while (adref < 100) {
	adref= Math.random() * 1000;
	}
	adref= parseInt(adref, 10);
	return adref;
}

function getSection(pt) {
var sectval
parts = pt.split("/");
if (parts.length < 3) {
	return "front"}
suff= new String(parts[2]);
if (suff.indexOf(".html") != "-1"){
	return "front"}
return parts[2]
}


var adsection; // this variable is used to override the default section id, set it in the calling page to override.
var sect = 'front';
var loc = document.location.pathname;
var badgeID = makeref(); // random ad code number for badge
var bannerID = makeref(); // random ad code number for banner


sect= getSection(loc)
/*
if (adsection == undefined || adsection == null) {
sect= getSection(loc); // default section id from the top level folder
}
else {
sect = adsection
}


*/

/*
// banner and badge code, uncomment to use

document.write('<CENTER><TABLE BGCOLOR="#FFFFFF" BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="540">')
document.write('<TR><TD ALIGN="RIGHT" VALIGN="MIDDLE"><IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_left.gif" ALT="" WIDTH="35" HEIGHT="60" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="right">')
document.write('</TD><TD><!-- begin badge -->')
document.write('<A TARGET="_new" HREF="http://ad.uk.doubleclick.net/jump/badges.fuk.co.uk/'+sect+';sz=120x60;ord='+badgeID+'?">')
document.write('<IMG SRC="http://ad.uk.doubleclick.net/ad/badges.fuk.co.uk/'+sect+';sz=120x60;ord='+badgeID+'?" WIDTH="120" HEIGHT="60" ALT="" BORDER="1">')
document.write('</A><!-- end badge --></TD><TD ALIGN="RIGHT" VALIGN="MIDDLE"><IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_divider.gif" ALT="" WIDTH="16" HEIGHT="60" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="right">')
document.write('</TD><TD ALIGN="CENTER" VALIGN="MIDDLE"><!-- BEGIN AD CODE --><A TARGET="_new" HREF="http://ad.uk.doubleclick.net/jump/www.fuk.co.uk/'+sect+';sz=468x60;ord='+bannerID+'?">')
document.write('<IMG SRC="http://ad.uk.doubleclick.net/ad/www.fuk.co.uk/'+sect+';sz=468x60;ord='+bannerID+'?" WIDTH="468" HEIGHT="60" ALT="f.uk advertising" BORDER="1">')
document.write('</A><!-- END AD CODE --></TD><TD ALIGN="LEFT" VALIGN="MIDDLE">')
document.write('<IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_right.gif" ALT="" WIDTH="35" HEIGHT="60" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="left"></TD></TR><TR>')
document.write('<TD ALIGN="RIGHT" VALIGN="MIDDLE">&#160;</TD><TD ALIGN="CENTER" VALIGN="TOP" COLSPAN= 3>')
document.write('<IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_bottom01.gif" ALT="" WIDTH="608" HEIGHT="10" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="top"></TD>')
document.write('<TD ALIGN="LEFT" VALIGN="MIDDLE">&#160;</TD></TR></TABLE></CENTER>')

*/



// single banner code
/*
document.write('<CENTER><TABLE BGCOLOR="#FFFFFF" BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="540">')
document.write('<TR><TD ALIGN="RIGHT" VALIGN="MIDDLE"><IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_left.gif" ALT="" WIDTH="35" HEIGHT="60" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="right">')
document.write('</TD><TD ALIGN="CENTER" VALIGN="MIDDLE"><!-- BEGIN AD CODE -->')
document.write('<A TARGET="_new" HREF="http://ad.uk.doubleclick.net/jump/www.fuk.co.uk/'+sect+';sz=468x60;ord='+bannerID+'?">')
document.write('<IMG SRC="http://ad.uk.doubleclick.net/ad/www.fuk.co.uk/'+sect+';sz=468x60;ord='+bannerID+'?" WIDTH="468" HEIGHT="60" ALT="fuk advertising" BORDER="1">')
document.write('</A><!-- END AD CODE --></TD>')
document.write('<TD ALIGN="LEFT" VALIGN="MIDDLE"><IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_right.gif" ALT="" WIDTH="35" HEIGHT="60" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="left"></TD></TR>')
document.write('<TR><TD ALIGN="RIGHT" VALIGN="MIDDLE">&#160;</TD><TD ALIGN="CENTER" VALIGN="TOP"><IMG SRC="http://www.widemedia.com/fashionuk/bank/adbag_bottom.gif" ALT="" WIDTH="470" HEIGHT="10" HSPACE="0" VSPACE="0" BORDER="0" ALIGN="top"></TD>')
document.write('<TD ALIGN="LEFT" VALIGN="MIDDLE">&#160;</TD></TR></TABLE></CENTER>')

*/
