function breakOut() {

	if ( top.location != self.location ) {
		top.location = self.location.href;
	} 

}


function popup(fold, img, title, comment, width, height){

	var commentText;
	var popHeight;
	var popWidth;

	if(height == null)	{ popHeight = 400; }else{ popHeight = height; }
	if(width == null)	{ popWidth = 400; }else{ popWidth = width; }
	if(comment == null || comment == '')	{ commentText = ''; }else{ commentText = '&comment='+escape(comment); }
	if(title == null || title == '')	{ titleText = ''; }else{ titleText = '&title='+escape(title); }

	newWindow = window.open('/popups/popup.html?folder='+fold+'&image='+img+titleText+commentText,'petrolpopup','width=1px,height=1px,resizable=1');
	return false;

}

function displayEmail(who)
{
	//
	//<script type="text/javascript">document.write(displayEmail("who"))</script>
	//

	var address;
	var thedomain;
	var ext;
	var fullAddress;
	var returnAddress;
	var subject = "";

	if (who == "affiliates")
	{
		address = "affiliate";
		thedomain = "petrolprices";
		ext = ".com";
		subject = "?subject=Affiliate&#32;Request";
		displayAddress = '';
	}

	if (who == "press")
	{
		address = "press";
		thedomain = "petrolprices";
		ext = ".com";
		subject = "?subject=Press&#32;Enquiry";
		displayAddress = '';
	}

	if (who == "competition")
	{
		address = "hannah";
		thedomain = "petrolprices";
		ext = ".com";
		subject = "?subject=Competition&#32;Entry";
		displayAddress = '';
	}

	if (who == "biodiesel")
	{
		address = "hannah";
		thedomain = "petrolprices";
		ext = ".com";
		subject = "?subject=Biodiesel&#32;Enquiry";
		displayAddress = '';
	}

	if (who == "poster")
	{
		address = "dana";
		thedomain = "fubra";
		ext = ".com";
		subject = "?subject=Poster&#32;Request";
		displayAddress = '';
	}

	fullAddress = address+"@"+thedomain+ext+subject;
	if(!displayAddress){
		displayAddress = address+"@"+thedomain+ext;
	}
  
	returnAddress = "<span class=\"bold\"><a href=\"mailto:"+fullAddress+"\">"+displayAddress+"</a></span>";
  
	return(returnAddress);
}

/* General Function to show or hide a div / html element */
function show_div(div_id, display_type) {
	var target = document.getElementById(div_id);
	target.style.display = display_type;
}

/* Handles the fubra passport popup - PG */

function fubraPassportPopup(){

	var width		= 460;
	var height		= 540;

    var sWidth		= screen.availWidth;
    var sHeight		= screen.availHeight;
    var leftpos		= (sWidth - width) / 2;
    var toppos		= (sHeight - height) / 2;

	var _popup = window.open( '/popups/fubra-passport-about.html', 'fpPopup', 'width='+width+'px, height='+height+'px, top='+toppos+', left='+leftpos+', resizable=1, directories=0, menubar=0, titlebar=0, scrollbars=1, status=0, location=0' );

	if( _popup.focus ){ _popup.focus(); }

	///setTimeout( function(){ if( ! _popup.closed ){ _popup.resizeTo( width + 20, height + 50 ); } }, 400 );

	return false;

}

function autoPopup( triggerElement ){

	if( triggerElement ){

		var tar = triggerElement.getAttribute( 'target' );
		var hrf = triggerElement.getAttribute( 'href' );
		var pop = triggerElement.getAttribute( 'popup' );
		var str = '';
		
		if( pop ) eval( 'pop = '+pop );

		switch( pop.type ){
		case 'standard': pop.resizable = 'yes'; break;
		}

		for( var i in pop ){ if( str ) str += ','; str += i + '=' + pop[i]; }

		var win = window.open( hrf, tar, str );
		if( win && win.focus ) win.focus();

		return false;

	}

}

/*
var floatFooter = {};
	floatFooter.onscroll = function(){

		var onefoot = document.getElementById('footer');
		var body	= ( ( onefoot.getAttribute && onefoot.getAttribute( 'safari' ) ) ? document.body.scrollHeight : document.documentElement );

		if( floatFooter.lastPageHeight != body.scrollHeight ){

			onefoot.style.position = 'absolute';
			onefoot.style.top = '-100px';
			onefoot.style.top = ( body.scrollHeight - 40 ) + 'px';

			floatFooter.lastPageHeight = body.scrollHeight;

		}

	}
	floatFooter.onresize = function(){
		
		floatFooter.onscroll();
		setTimeout( function(){ floatFooter.onscroll() }, 10 );

	}
	floatFooter.onload = function(){

		floatFooter.onscroll();

	}

window.onload = function() {
	
	floatFooter.onscroll();

}*/
