﻿// ext.js in http://eul0001048.eu.verio.net for xml site

/*
function showAlert(){
alert("hi");
}
*/

//detection stuff

var bName = navigator.appName;
var bVersion = parseInt(navigator.appVersion);
var plat = navigator.platform;
ua=navigator.userAgent;

if (bName.indexOf('Netscape') != -1){
var isNS = 1;
}
else if(bName.indexOf('Microsoft') != -1){
var isIE = 1;
}

if(plat.indexOf('Win')!= -1){
var isWin = 1;
}

if(ua.indexOf('AOL') != -1){
var isAOL = 1;
}

// script to set menu items
function set_menu(itemno){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(itemno) : document.all(itemno)
obj.style.background='#edebe6';
obj.style.color='#000000';
}


function set_last_visited(itemno){
if(itemno!=0){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(itemno) : document.all(itemno)
if(obj){obj.style.background='#d4e7ee';
obj.style.color='#000000';}
}
}

// script to set menu items in tools
function set_menu_tools(itemno){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(itemno) : document.all(itemno)
obj.style.background='#edebe6';
obj.style.color='#000000';
}


// script to set lev3 menu
function set_month(itemno){
obj = (document.getElementById ? 1 : 0) ? document.getElementById(itemno) : document.all(itemno)
obj.style.borderTopWidth='1';obj.style.borderBottomWidth='1';obj.style.borderLeftWidth='0';obj.style.borderRightWidth='0';obj.style.borderColor='#000000';obj.style.borderStyle='solid';
}

function iFrameHeight() {
if(document.getElementById && !(document.all)) {
h = document.getElementById('iframename').contentDocument.body.scrollHeight ;
document.getElementById('iframename').style.height = h + "px";
}
else if(document.all) {
h = document.frames('iframename').document.body.scrollHeight;
document.all.iframename.style.height = h;
}
}









/*
Open a new window called win2.
Switch the window features on or off as required e.g. scrollbars=yes
The size is dependent on the browser/platform etc.
This could be rewritten to tie in with the detection stuff at the top of this page.
*/
function openWin(url) {
var x=10,y=10;
//var x=(screen.availWidth-630)
var vs=navigator.appVersion,v=parseFloat(vs),m=(vs.indexOf('Mac')>-1?true:false),w=(vs.indexOf('Win')>-1?true:false),ie=(document.all?true:false);
var bts=vs.split(' ');for(var i=0;i<bts.length;i++){if(parseFloat(bts[i])>=5&&parseFloat(bts[i])<10)v=parseFloat(bts[i])};

if(ie&&m&&v>=4&&v<5)
var sz=",width=610,height=426";

else if(ie&&m&&v>=5)
var sz=",width=610,height=406";

else if(ie&&w&&v>=4)
var sz=",width=610,height=388";

else
var sz=",width=610,height=408";

window.open(url,'win2','left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=yes,scrollbars=no,resizable=no,menubar=yes'+sz);
}


function openWinTools(url) {
var x=10,y=10;
//var x=(screen.availWidth-630)
var vs=navigator.appVersion,v=parseFloat(vs),m=(vs.indexOf('Mac')>-1?true:false),w=(vs.indexOf('Win')>-1?true:false),ie=(document.all?true:false);
var bts=vs.split(' ');for(var i=0;i<bts.length;i++){if(parseFloat(bts[i])>=5&&parseFloat(bts[i])<10)v=parseFloat(bts[i])};

if(ie&&m&&v>=4&&v<5)
var sz=",width=610,height=486";

else if(ie&&m&&v>=5)
var sz=",width=610,height=466";

else if(ie&&w&&v>=4)
var sz=",width=610,height=448";

else
var sz=",width=610,height=468";

window.open(url,'win2','left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=yes,scrollbars=yes,resizable=yes,menubar=yes,location=yes'+sz);
}


function openwin_counter(url) {
window.open(url,'win2','width=50,height=50,status=no,resizable=no,menubar=no,scrollbars=no');
}


function openWinPoll(url) {
var x=50,y=50;
//var x=(screen.availWidth-630)
var vs=navigator.appVersion,v=parseFloat(vs),m=(vs.indexOf('Mac')>-1?true:false),w=(vs.indexOf('Win')>-1?true:false),ie=(document.all?true:false);
var bts=vs.split(' ');for(var i=0;i<bts.length;i++){if(parseFloat(bts[i])>=5&&parseFloat(bts[i])<10)v=parseFloat(bts[i])};

if(ie&&m&&v>=4&&v<5)
var sz=",width=550,height=500";

else if(ie&&m&&v>=5)
var sz=",width=550,height=500";

else if(ie&&w&&v>=4)
var sz=",width=550,height=500";

else
var sz=",width=550,height=500";

window.open(url,'win3','left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=yes,scrollbars=yes,resizable=yes,menubar=no,location=no'+sz);
}


function openWinSmall(url) {
var x=50,y=50;
//var x=(screen.availWidth-630)
var vs=navigator.appVersion,v=parseFloat(vs),m=(vs.indexOf('Mac')>-1?true:false),w=(vs.indexOf('Win')>-1?true:false),ie=(document.all?true:false);
var bts=vs.split(' ');for(var i=0;i<bts.length;i++){if(parseFloat(bts[i])>=5&&parseFloat(bts[i])<10)v=parseFloat(bts[i])};

if(ie&&m&&v>=4&&v<5)
var sz=",width=350,height=400";

else if(ie&&m&&v>=5)
var sz=",width=250,height=400";

else if(ie&&w&&v>=4)
var sz=",width=350,height=400";

else
var sz=",width=350,height=400";

window.open(url,'win4','left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=yes,scrollbars=yes,resizable=yes,menubar=no,location=no'+sz);
}


function openWinSize(url,w,h) {
var x=50,y=50;

var sz=",width="+w+",height="+h+"";

window.open(url,'win5','left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=no,scrollbars=no,resizable=no,menubar=no,location=no'+sz);
}


// HIDE EMAILS FROM SPAMBOTS - START

//pick up lines for valentine's day
function emailhider_pickuplines()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'pickuplines';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('<font color="#FFFFFF">');
document.write('<strong>email us</strong>');
//span text formatting ends here
document.write('</font>');
document.write('</a>');
}

//comments for vw polo suicide bomber viral
function emailhider_comments()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'comments';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('" class="link-size-12">');
//span text formatting starts here
document.write('<strong>email us</strong>');
//span text formatting ends here
document.write('</a>');
}

//captions competition
function emailhider_captions()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'captions';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a class="caption-link" href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('email us');
//span text formatting ends here
document.write('</a>');
}

//nic stevens
function emailhider_nic()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'nic';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('<span class="tools">');
document.write('&#110;&#105;&#099;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;');
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}


//contribute
function emailhider_contribute()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'contribute';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('" onfocus="this.blur()">');
//span text formatting starts here
document.write('<span class="tools">');
document.write('&#099;&#111;&#110;&#116;&#114;&#105;&#098;&#117;&#116;&#101;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;');
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}


//contribute - contact page
function emailhider_contribute_contact_page()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'contribute';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('<span class="tools">');
document.write('&#099;&#111;&#110;&#116;&#114;&#105;&#098;&#117;&#116;&#101;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;');
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}


//sophie
function emailhider_sophie()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'sophie';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('<span class="tools">');
document.write('&#115;&#111;&#112;&#104;&#105;&#101;&#064;&#098;&#111;&#114;&#101;&#109;&#101;&#046;&#099;&#111;&#109;');
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}


//subscribe
function emailhider_subscribe()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'subscribe';
var the_domain = 'boreme';
var ext = 'com';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('<span class="tools">');
document.write('email us');
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}


//harry
function emailhider_harry()
{
var code1 = 'm';
var code2 = 'ail';
var code3 = 'to';
var code4 = ':';
var the_address = 'boreme';
var the_domain = 'hotcherry';
var ext = 'co.uk';
document.write('<a href="');
document.write(code1+code2+code3+code4);
document.write(the_address);
document.write('&#64;');
document.write(the_domain);
document.write('.');
document.write(ext);
document.write('">');
//span text formatting starts here
document.write('<span class="tools">');
document.write('&#098;&#111;&#114;&#101;&#109;&#101;&#064;&#104;&#111;&#116;&#099;&#104;&#101;&#114;&#114;&#121;&#046;&#099;&#111;&#046;&#117;&#107;');
//span text formatting ends here
document.write('</span>');
document.write('</a>');
}

// HIDE EMAILS FROM SPAMBOTS - END


////////////////// TOGGLE LAYER ////////////////

function hide_visibility(id)
{
	var e = document.getElementById(id);
	if(e!=null)
	{
		e.style.display = 'none';
		if(document.images[id]!=null)
		{
			document.images[id].src = 'http://www.boreme.com/boreme/images/clear.gif';
		}
	}	
}

function show_visibility(id)
{
	var e = document.getElementById(id);
	if(e!=null)
	{
		e.style.display = 'block';
	}	
}

function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}


function toggleRow(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}

function keep_highlight(id,btn,img,ref) 
{
	var e = document.getElementById(id);
	var f = document.getElementById(btn);
	if(e.style.display == 'none')
	{
		document.images[img].src = 'http://www.boreme.com/boreme/images/clear.gif';
	}
	else
	{
		document.images[img].src = ref;
	}
}

function mo_on_hidden(img1,ref1)
{
	var e = document.getElementById(img1);
	if(e.style.display=='none')
	{
		document.images[img1].src = ref1;
	}
}


// clunky solution to onLoad setTimeout escaping problem - these 2 functions can be deleted soon, not used anymore 07/11/07
function captionspanelstate_block() {
var e = document.getElementById('captionspanel');
	e.style.display = 'block';
}


function captionspanelstate_none() {
var e = document.getElementById('captionspanel');
	e.style.display = 'none';
}


////////////////// JUMP MENU ////////////////

function jumpMenu(selObj,restore)
{
eval("parent.location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}


//////////////////////////////// NEW CODE FOR XML SITE /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//active x workaround for MOV
function writeMOVCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="' + bm_movie_height + '" width="' + bm_movie_width + '">');
document.write('<param name="bgcolor" value="' + bm_movie_bgcolor + '">');
document.write('<param name="src" value="' + path + '/' + bm_movie_fileroot + '.mov">');
document.write('<param name="autoplay" value="' + bm_autostart + '">');
document.write('<param name="controller" value="true">');
document.write('<embed height="' + bm_movie_height + '" width="' + bm_movie_width + '" name="' + bm_movie_name + '" pluginspage="http://www.apple.com/quicktime/download/" src="' + path + '/' + bm_movie_fileroot + '.mov" type="video/quicktime" controller="true" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></embed></object>');
}


// active x workaround for QT (e.g. m_mccoy_kiss_kirk.qt)
function writeQTCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="' + bm_movie_height + '" width="' + bm_movie_width + '" name="' + bm_movie_fileroot + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="src" value="' + path + '/' + bm_movie_fileroot + '.qt" /><param name="autoplay" value="' + bm_autostart + '" /><param name="controller" value="true" /><embed height="' + bm_movie_height + '" name="' + bm_movie_fileroot + '" pluginspage="http://www.apple.com/quicktime/download/" src="' + path + '/' + bm_movie_fileroot + '.qt" type="video/quicktime" width="' + bm_movie_width + '" controller="true" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></object>');
}



// active x workaround for WMV
function writeWMVCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' + bm_movie_width + '" height="' + bm_movie_height + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="AutoStart" value="' + bm_autostart + '"><param name="uiMode" value="full"><param name="url" value="' + path + '/' + bm_movie_fileroot + '.wmv" /><embed type="application/x-mplayer2" src="' + path + '/' + bm_movie_fileroot + '.wmv" name="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '" autostart="' + bm_autostart + '"></embed></object>');
}


// active x workaround for AVI
function writeAVICode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="MediaPlayer1" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" height="' + bm_movie_height + '" width="' + bm_movie_width + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="src" value="' + path + '/' + bm_movie_fileroot + '.avi" /><param name="FileName" value="' + bm_movie_fileroot + '.avi" /><param name="animationatStart" value="true" /><param name="transparentatStart" value="false" /><param name="autoStart" value="' + bm_autostart + '" /> <embed height="' + bm_movie_height + '" name="MediaPlayer1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="' + path + '/' + bm_movie_fileroot + '.avi" type="application/x-mplayer2" width="' + bm_movie_width + '" AutoStart="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></object>');
}


// active x workaround for MPG
function writeMPGCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="AutoStart" value="' + bm_autostart + '" /><param name="uiMode" value="full"><param name="url" value="' + path + '/' + bm_movie_fileroot + '.mpg"><embed src="' + path + '/' + bm_movie_fileroot + '.mpg"  type="video/mpg" name="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></embed></object>');
}


// active x workaround for MPEG
function writeMPEGCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="AutoStart" value="' + bm_autostart + '" /><param name="uiMode" value="full"><param name="url" value="' + path + '/' + bm_movie_fileroot + '.mpeg"><embed src="' + path + '/' + bm_movie_fileroot + '.mpeg"  type="video/mpeg" name="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></embed></object>');
}


// active x workaround for MPA
function writeMPACode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="AutoStart" value="' + bm_autostart + '" /><param name="uiMode" value="full"><param name="url" value="' + path + '/' + bm_movie_fileroot + '.mpa"><embed src="' + path + '/' + bm_movie_fileroot + '.mpa"  type="video/mpa" name="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></embed></object>');
}


// active x workaround for MPE
function writeMPECode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="AutoStart" value="' + bm_autostart + '" /><param name="uiMode" value="full"><param name="url" value="' + path + '/' + bm_movie_fileroot + '.mpa"><embed src="' + path + '/' + bm_movie_fileroot + '.mpe"  type="video/mpe" name="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></embed></object>');
}


// active x workaround for MP4
function writeMP4Code(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object height="' + bm_movie_height + '" width="' + bm_movie_width + '" name="' + bm_movie_fileroot + '"> <param name="bgcolor" value="' + bm_movie_bgcolor + '"> <param name="src" value="' + path + '/' + bm_movie_fileroot + '.mp4"> <param name="autoplay" value="' + bm_autostart + '"> <param name="controller" value="true"> <embed height="' + bm_movie_height + '" name="' + bm_movie_fileroot + '" src="' + path + '/' + bm_movie_fileroot + '.mp4" width="' + bm_movie_width + '" controller="true" autoplay="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></object>');
}


// active x workaround for ASF
function writeASFCode(bm_movie_height,bm_movie_width,path,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '"><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="AutoStart" value="' + bm_autostart + '"><param name="uiMode" value="full"><param name="url" value="' + path + '/' + bm_movie_fileroot + '.asf"><embed src="' + path + '/' + bm_movie_fileroot + '.asf"  type="video/asf" name="Player" width="' + bm_movie_width + '" height="' + bm_movie_height + '" autoplay="true" bgcolor="' + bm_movie_bgcolor + '" autostart="' + bm_autostart + '"></embed></object>');
}


// active x workaround for RM
function writeRMCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="' + bm_movie_height + '" width="' + bm_movie_width + '"><param name="controls" value="ImageWindow" /><param name="autostart" value="' + bm_autostart + '" /><param name="src" value="' + path + '/' + bm_movie_fileroot + '.rm" /><embed height="' + bm_movie_height + '" src="' + path + '/' + bm_movie_fileroot + '.rm" type="audio/x-pn-realaudio-plugin" width="' + bm_movie_width + '" controls="ImageWindow" autostart="' + bm_autostart + '"></object>');
}


// active x workaround for MP3 forcing QT player
function writeMP3Code(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_autostart)
{
document.write('<embed height="' + bm_movie_height + '" width="' + bm_movie_width  + '" name="' + bm_movie_name + '" pluginspage="http://www.apple.com/quicktime/download/" src="' + path + '/' + bm_movie_fileroot + '.mp3" type="video/quicktime" controller="true" autoplay="' + bm_autostart + '"></embed>');
}


// active x workaround for WAV
function writeWAVCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_autostart)
{
document.write('<object height="' + bm_movie_height + '" width="' + bm_movie_width + '"><param name="autostart" value="' + bm_autostart + '"><param name="src" value="' + path + '/' + bm_movie_fileroot + '.wav"><embed height="' + bm_movie_height + '" src="' + path + '/' + bm_movie_fileroot + '.wav" type="audio/wav" width="' + bm_movie_width + '" autostart="' + bm_autostart + '"></object>');
}


// active x workaround for WMA
function writeWMACode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor,bm_autostart)
{
document.write('<object id="MediaPlayer1" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" height="' + bm_movie_height + '" width="' + bm_movie_width + '"> <param name="bgcolor" value="' + bm_movie_bgcolor + '"> <param name="src" value="' + path + '/' + bm_movie_fileroot + '.wma"> <param name="FileName" value="' + bm_movie_fileroot + '.wma"> <param name="animationatStart" value="true"> <param name="transparentatStart" value="false"> <param name="autoStart" value="' + bm_autostart + '"> <embed height="' + bm_movie_height + '" name="MediaPlayer1" src="' + path + '/' + bm_movie_fileroot + '.wma" type="application/x-mplayer2" width="' + bm_movie_width + '" AutoStart="' + bm_autostart + '" bgcolor="' + bm_movie_bgcolor + '"></object>');
}


// active x workaround for DCR
function writeDCRCode(bm_movie_height,bm_movie_width,path,bm_movie_name,bm_movie_fileroot,bm_movie_bgcolor)
{
document.write('<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" height="' + bm_movie_height + '" width="' + bm_movie_width + '" name="' + bm_movie_fileroot + '"><param name="quality" value="best" /><param name="bgcolor" value="' + bm_movie_bgcolor + '" /><param name="src" value="' + path + '/' + bm_movie_fileroot + '.dcr" /><param name="autoplay" value="true" /><param name="controller" value="true" /><embed height="' + bm_movie_height + '" name="' + bm_movie_fileroot + '" src="' + path + '/' + bm_movie_fileroot + '.dcr" width="' + bm_movie_width + '" controller="true" autoplay="true" bgcolor="' + bm_movie_bgcolor + '" quality="best"></object>');
}


//////////////////////////////////////////////////////////////////////////////////////////////////////


// active x workaround for SWF
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs)
{
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}


function AC_FL_Run_Skinable(murl,vid,ipAdd,configXml,snd){
  AC_FL_RunContent("codebase","http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0","allowScriptAccess","sameDomain","width","424","height","491","wmode","opaque","src",murl,"quality","high","name","newplayer","pluginspage","http://www.macromedia.com/go/getflashplayer","movie",murl,"FlashVars","&playerWidth=424&playerHeight=491&videoId=" + vid + "&ipAdd=" + ipAdd + "&configXml=" + configXml + "&snd=" + snd);
  
}

function AC_FL_Run_Small_Skinable(murl,vid,ipAdd,configXml,snd){
  AC_FL_RunContent("codebase","http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0","allowScriptAccess","sameDomain","width","424","height","338","wmode","opaque","src",murl,"quality","high","name","newplayer","pluginspage","http://www.macromedia.com/go/getflashplayer","movie",murl,"FlashVars","&playerWidth=424&playerHeight=338&videoId=" + vid + "&ipAdd=" + ipAdd + "&configXml=" + configXml + "&startPaused=&smallPlayer=1" + "&snd=" + snd);
  
}

/*
function AC_FL_Run_MPP(murl,vid,ipAdd,configXml,height,width){
  AC_FL_RunContent("codebase","http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0","allowScriptAccess","sameDomain","width",width,"height",height,"wmode","opaque","src",murl,"quality","high","name","newplayer","pluginspage","http://www.macromedia.com/go/getflashplayer","movie",murl,"FlashVars","&playerurl=../../flash/skinablePlayer.swf&playerWidth=" + width + "&playerHeight=" + height + "&videoId=" + vid + "&ipAdd=" + ipAdd + "&configXml=" + configXml + "&startPaused=&smallPlayer=1");
}
*/

function AC_FL_Run_MPP(murl,vid,ipAdd,configXml,height,width,mppid,mpptrackingurl,snd){
  AC_FL_RunContent("codebase","http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0","allowScriptAccess","sameDomain","width",width,"height",height,"wmode","opaque","src",murl,"quality","high","name","newplayer","pluginspage","http://www.macromedia.com/go/getflashplayer","movie",murl,"FlashVars","&playerurl=../../flash/skinablePlayer.swf&playerWidth=" + width + "&playerHeight=" + height + "&videoId=" + vid + "&ipAdd=" + ipAdd + "&configXml=" + configXml + "&mpptrackingurl=" + mpptrackingurl + "&mppid=" + mppid + "&startPaused=&smallPlayer=1" + "&snd=" + snd);
}


function AC_SW_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();

    switch (currArg){
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function toggle_visibility_set_colourxxx(id,btn) {
var e = document.getElementById(id);
var f = document.getElementById(btn);
if(e.style.display == 'none')
	{
	e.style.display = 'block';
	if(f!=null)
	{
		f.style.color = 'white';
	}
	}
else
	{
	e.style.display = 'none';
	if(f!=null)
	{
		f.style.color = 'white';
	}
	if(document.images[id]!=null)
	{
	document.images[id].src = 'http://www.boreme.com/boreme/images/clear.gif';
	}
	}
}



function toggle_visibility_set_colour(id,btn) {
var e = document.getElementById(id);
var f = document.getElementById(btn);
if(e.style.display == 'none')
	{
	e.style.display = 'block';
	if(f!=null)
	{
		f.style.color = 'white';
	}
	}
else
	{
	e.style.display = 'none';
	if(f!=null)
	{
		f.style.color = 'white';
	}
	}
}







function checkcomment(id)
{
	if (id==undefined)
	{
		id='';
	}
	var field="loginregistercomment"+id;
	var fieldobject=document.getElementById(field);
	var content=fieldobject.value;
	if (!content)
	{
		alert('Please supply a comment');
		return false;
	}
	return true;
}

function clearforms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}

function clearform(formname)
{
	aform=document.getElementById(formname);
	aform.reset();
}

function clearregister()
{
	field=document.getElementById('username_r');
	field.value='';
	field=document.getElementById('code_r');
	field.value='';
	field=document.getElementById('email_r');
	field.value='';
	field=document.getElementById('password_r');
	field.value='';
	field=document.getElementById('password2_r');
	field.value='';
}

function mo(img1,ref1)
{
document.images[img1].src = ref1;
}

function getHTTPObject()
{
	if(window.ActiveXObject)
	{
		try
		{
			var waystation=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Cannot create Microsoft request");
			}
		}
	}
	else if(window.XMLHttpRequest)
	{
		var waystation=new XMLHttpRequest();
		if(waystation.overrideMimeType) waystation.overrideMimeType('text/xml');
	}
	else
	{
		alert("Cannot create request");
		var waystation=false;
	}
	return waystation;
}

function ajaxSendData(data)
{
	var request=getHTTPObject();
	request.open("POST","/members/addbmtosite.php",true);
	request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	request.onreadystatechange= function()
	{
		doAjaxSendData(request);
	}
	request.send(data);
}

function doAjaxSendData(request)
{
	try
	{
		if(request.readyState==4)
		{
			if(request.status==200)
			{
				var xmldoc=request.responseXML;
    			var root=xmldoc.documentElement;
				var avalue=root.getElementsByTagName('response')[0];
    			avalue=avalue.firstChild.nodeValue;
    			if(avalue!='Upload successfully added to your site')
				{
					alert(avalue);
				}
				else
				{
					var holder=document.getElementById('addsite');
					holder.innerHTML='Added';
				}
			}
			else
			{
				alert("ERROR in request: "+request.status);
			}
		}
	}
	catch (e)
	{
		alert("ERROR in response: "+e.description);
	}
}

function addbmtosite(addybm,viral_id)
{
	poststring='';
	poststring+="addybm="+encodeURIComponent(addybm);
	poststring+="&backid="+encodeURIComponent(viral_id);
	ajaxSendData(poststring);
}



///////////////// functions moved from EMF form emf-form.php BEGIN ////////////////////

//change colour of input fields to black onFocus
function getObj(name)
{
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}

function changeCol(fieldid,col)
{
	var x = new getObj(fieldid);
	x.style.color = col;
}
//////////////////////////////

function initialisefriendemail()
{
field1=document.emf_form.friendemail.value;
	if(field1=="friend1@abc.com, friend2@def.com etc")
	{
	document.emf_form.friendemail.value="";
	changeCol('friendemail','#000000');
	}
}

function initialisemessage()
{
field1=document.emf_form.message.value;
	if(field1=="Your message (optional)")
	{
	document.emf_form.message.value="";
	changeCol('message','#000000');
	}
}

function initialiseyourname()
{
field2=document.emf_form.yourname.value;
	if(field2=="Your name")
	{
	document.emf_form.yourname.value="";
	changeCol('yourname','#000000');
	}
}


function initialiseyouremail()
{
field3=document.emf_form.youremail.value;
	if(field3=="Your email")
	{
	document.emf_form.youremail.value="";
	changeCol('youremail','#000000');
	}
}



function resetme(){
field1=document.emf_form.friendemail.value;
field2=document.emf_form.message.value;
field3=document.emf_form.yourname.value;
field4=document.emf_form.youremail.value;

if(field1=="")
	{
	document.emf_form.friendemail.value="friend1@abc.com, friend2@def.com etc";
	changeCol('friendemail','#6a6a6a');
	}
if(field2=="")
	{
	document.emf_form.message.value="Your message (optional)";
	changeCol('message','#6a6a6a');
	}
if(field3=="")
	{
	document.emf_form.yourname.value="Your name";
	changeCol('yourname','#6a6a6a');
	}
if(field4=="")
	{
	document.emf_form.youremail.value="Your email";
	changeCol('youremail','#6a6a6a');
	}
}


function submitForm()
{
if (multiFriendEmail() && validateYourEmail() && isYourName() && isMessage())
	{
	//alert("\nThanks for telling your friends about this");
	return true;
	}
else 
	{
	return false;
	}
}


// validate friendemail
function validateFriendEmail(passedEmail)
{
emailStr = passedEmail;

if (emailStr == ''||emailStr == 'friend1@abc.com, friend2@def.com etc')
	{
	alert ("You have not filled in your friend's email address")
	document.emf_form.friendemail.focus();
	return false;
	}

//var emailFilter=/^.+@.+\..{2,3}$/;
var emailFilter=/^.+@.+\..{2,4}$/;

var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;	

if (!(emailFilter.test(emailStr)) || emailStr.match(illegalChars))
	{ 
		return false;
	}

return true;
}


//your name
function isYourName() {
if (document.emf_form.yourname.value == ""||document.emf_form.yourname.value == "Your name")
{
alert ("\n You have not supplied your name")
document.emf_form.yourname.focus();
return false;
}
return true;
}


// validate youremail
function validateYourEmail()
{
emailStr = document.emf_form.youremail.value;

if (emailStr == ''||emailStr == 'Your email')
	{
	alert ("You have not filled in your email address")
	document.emf_form.youremail.focus();
	return false;
	}

//var emailFilter=/^.+@.+\..{2,3}$/;
var emailFilter=/^.+@.+\..{2,4}$/;

var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;	

if (!(emailFilter.test(emailStr)) || emailStr.match(illegalChars))
	{ 
	alert ("Your email address is invalid");
		return false;
	}

return true;
}


//message length
function isMessage() {
if (document.emf_form.message.value.length > 250)
{
alert ("\n Sorry, the message can be no longer than 250 characters")
document.emf_form.message.focus();
return false;
}

else if (document.emf_form.message.value == 'Your message (optional)')
{
document.emf_form.message.value="";
return true;
}

return true;
}


/* ORIGINAL FUNCTION
function multiEmail(email_field) {
var email = email_field.split(',');
for (var i = 0; i < email.length; i++) {
if (!validateEmail(email[i], 1, 0)) {
alert('one or more email addresses entered is invalid');
return false;
}
}
return true;
} 
*/

//validate multiple friend emails
function multiFriendEmail() {

testemailvalue = document.emf_form.friendemail.value;
//alert(testemailvalue);

//rob note: var email should be an array
var email = document.emf_form.friendemail.value.split(',');
////////////////////////////
//alert("1st email is " + email[0]);
//alert("2nd email is " + email[1]);

for (var i = 0; i < email.length; i++) {
if (!validateFriendEmail(email[i], 1, 0)) {
alert("one or more of your friends' email addresses entered is invalid");
document.emf_form.friendemail.focus();
return false;
}
}
return true;
}

///////////////// functions moved from EMF form emf-form.php END ////////////////////


/* FACEBOOK FUNCTIONS */
function fb_load () {
	FB.ensureInit(function() { 
		FB.Connect.ifUserConnected(update_user_box);
	} );
}

function addEvent(ev, func, o, trickle) {
    o = o || this;
    trickle = trickle || false;
    if (document.addEventListener) {
        o.addEventListener(ev, func, trickle);
    }else{
        o.attachEvent("on" + ev, func);
    }
}
/* END FACEBOOK FUNCTIONS */

