function emailForm(_posting_id, _title){ 
	var daReferrer = document.referrer; 
	var theLink = escape("http://" + location.hostname + "/products/publications/specific_pub.php?posting_id=" + _posting_id);
	var subject = "Requested FPL Publication";
	var body_message = "Title: " + _title + ": " + theLink;
	var recipient = 'who@where.com';
	var mailto_link = 'mailto:'+recipient+'?subject='+subject+'&body='+body_message; 
	window.location = mailto_link;
} 


function displayDocument(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=100,top=20,scrollbars=yes,menubar=no,height=600,width=600,resizable=yes,toolbar=no,location=no,status=no');
}
function displayPromotion(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=200,top=20,scrollbars=yes,menubar=no,height=600,width=700,resizable=yes,toolbar=no,location=no,status=no');
}
function displayDocumentHighResolution(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=10,top=10,scrollbars=yes,menubar=no,height=600,width=1000,resizable=yes,toolbar=no,location=no,status=no');
}
function displayDocumentCustomHighResolution(_pathAndFileName,vheight,vwidth) {
	var load = window.open(_pathAndFileName,'','left=1,top=1,scrollbars=yes,menubar=no,height='+vheight+',width='+vwidth + ',resizable=yes,toolbar=no,location=no,status=no');
}
function displayDocumentCustomHighResolutionIndentation(_pathAndFileName,vheight,vwidth,indentation) {
	var load = window.open(_pathAndFileName,'','left='+indentation+',top=1,scrollbars=yes,menubar=no,height='+vheight+',width='+vwidth + ',resizable=yes,toolbar=no,location=no,status=no');
}
function displayCaptcha(_pathAndFileName) {
	var vheight = 400;
	var vwidth = 400;
	var load = window.open(_pathAndFileName,'','left=200,top=150,scrollbars=no,menubar=no,height='+vheight+',width='+vwidth + ',resizable=no,toolbar=no,location=no,status=no');
}
function displayDocumentWithTools(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=100,top=20,scrollbars=yes,menubar=yes,height=600,width=600,resizable=yes,toolbar=yes,location=yes,status=yes');
}
function displayDocument640x428(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=100,top=20,scrollbars=yes,menubar=no,height=468,width=680,resizable=yes,toolbar=no,location=no,status=no');
}
function displayDocumentMadw640x428(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=100,top=20,scrollbars=yes,menubar=no,height=468,width=680,resizable=yes,toolbar=no,location=no,status=no');
}

function displayDocumentWithDynamicDimensions(_pathAndFileName,_dimensions) {
	var load = window.open(_pathAndFileName,'','left=150,top=20,scrollbars=yes,menubar=no,' + _dimensions + ',resizable=yes,toolbar=no,location=no,status=no');
}

function displayDocument428x640(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=100,top=20,scrollbars=yes,menubar=no,height=680,width=468,resizable=yes,toolbar=no,location=no,status=no');
}
function displayDocumentForCWAR(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=40,top=20,scrollbars=yes,menubar=yes,height=680,width=870,resizable=yes,toolbar=no,location=no,status=no');
}
function proceedToDocument(_pathAndFileName) {
	window.location = _pathAndFileName;
}
function playSound(soundobj) {
	var thissound=document.getElementById(soundobj);
	thissound.Play();
}
function playVideo(_pathAndFileName) {
	var load = window.open(_pathAndFileName,'','left=200,top=20,scrollbars=no,menubar=no,height=470,width=400,resizable=no,toolbar=no,location=no,status=no');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function showHide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}


var theImages = new Array() // do not change this
theImages[0] = 'http://lh4.ggpht.com/_dQ2LrwxYCR4/S7ymLL-THoI/AAAAAAAAAFA/KrcVlWI7uTk/bg_01.gif'
theImages[1] = 'http://lh4.ggpht.com/_dQ2LrwxYCR4/S7ymLCgb8FI/AAAAAAAAAFE/8oCC_oen6Bw/bg_02.gif'
theImages[2] = 'http://lh6.ggpht.com/_dQ2LrwxYCR4/S7ymLVqo1bI/AAAAAAAAAFI/AbAzh6HBPs4/bg_03.gif'
theImages[3] = 'http://lh3.ggpht.com/_dQ2LrwxYCR4/S7ymLQVVR6I/AAAAAAAAAFM/-KF-Rxn9GhM/bg_04.gif'
theImages[4] = 'http://lh5.ggpht.com/_dQ2LrwxYCR4/S7ymLtqqHSI/AAAAAAAAAFQ/LvKlX4Fxf0Y/bg_05.gif'
theImages[5] = 'http://lh4.ggpht.com/_dQ2LrwxYCR4/S7ymQaeWQhI/AAAAAAAAAFU/IjDLGQdGYq8/bg_06.gif'
theImages[6] = 'http://lh3.ggpht.com/_dQ2LrwxYCR4/S7ymQlJ4iTI/AAAAAAAAAFY/nIgxLR3i7Wc/bg_07.gif'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

var whichImage = Math.floor((Math.random() * p));

function showImage(){
	// document.write('<img align=left border=0 width=600 height=85 src="'+theImages[whichImage]+'" usemap=\"#m_headermain\">');
}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}




//** Stay on Top content script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Script available at usage terms at http://www.dynamicdrive.com
//** v1.0 (May 12th, 09')

var alwaysOnTop={

	dsettings: {
		targetid: '',
		orientation: 2,
		position: [10, 30],
		externalsource: '',
		frequency: 1,
		hideafter: 0,
		fadeduration: [500, 500],
		display: 0 //internal setting on whether to display target element at all (based on frequency setting)
  },

	settingscache: {},

	positiontarget:function($target, settings){
		var fixedsupport=!document.all || document.all && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
		var posoptions={position:fixedsupport? 'fixed':'absolute', visibility:'visible'}
		if (settings.fadeduration[0]>0) //if fade in
			posoptions.opacity=0
		posoptions[(/^[13]$/.test(settings.orientation))? 'left' : 'right']=settings.position[0]
		posoptions[(/^[12]$/.test(settings.orientation))? 'top' : 'bottom']=settings.position[1]
		if (document.all && !window.XMLHttpRequest) //loose check for IE6 and below
			posoptions.width=$target.width() //IE6- seems to require an explicit width on a DIV
		$target.css(posoptions)
		if (!fixedsupport){
			this.keepfixed($target, settings)
			var evtstr='scroll.' + settings.targetid + ' resize.'+settings.targetid
			jQuery(window).bind(evtstr, function(){alwaysOnTop.keepfixed($target, settings)})
		}
		this.revealdiv($target, settings, fixedsupport)
		if (settings.hideafter>0){ //if hide timer enabled
			setTimeout(function(){
				alwaysOnTop.hidediv(settings.targetid)
			}, settings.hideafter+settings.fadeduration[0])
		}
	},

	keepfixed:function($target, settings){
		var $window=jQuery(window)
		var is1or3=/^[13]$/.test(settings.orientation)
		var is1or2=/^[12]$/.test(settings.orientation)
		var x=$window.scrollLeft() + (is1or3? settings.position[0] : $window.width()-$target.outerWidth()-settings.position[0])
		var y=$window.scrollTop() + (is1or2? settings.position[1] : $window.height()-$target.outerHeight()-settings.position[1])
		$target.css({left:x+'px', top:y+'px'})
	},

	revealdiv:function($target, settings){
		if (settings.fadeduration[0]>0) //if fade in
			$target.show().animate({opacity:1}, settings.fadeduration[0])
		else
			$target.show()
		if (settings.frequency=="session") //set session only cookie (name: 'sots' + targetid)? 
			this.setCookie('sots'+settings.targetid, 'shown')
		else if (/^\d+ day/i.test(settings.frequency)){ //set persistent cookie (name: 'sotp' + targetid)? 
			var persistdays=parseInt(settings.frequency)
			this.setCookie('sotp'+settings.targetid, persistdays, persistdays)
		}
	},

	hidediv:function(targetid){ //public function
		var $target=jQuery('#'+targetid)
		if ($target.css('display')=='none') //if target hidden already
			return
		var settings=this.settingscache[targetid]
		if (settings.fadeduration[1]>0) //if fade out
			$target.animate({opacity:0}, settings.fadeduration[1], function(){$target.hide()})
		else
			$target.hide()
		var evtstr='scroll.' + settings.targetid + ' resize.'+settings.targetid
		jQuery(window).unbind(evtstr)
	},

	loadajaxcontent:function($, settings){
		$.ajax({
			url: settings.externalsource,
			error:function(ajaxrequest){
				alert('Error fetching Ajax content.\nServer Response: '+ajaxrequest.responseText)
			},
			success:function(content){
				var $target=$(content)
				if ($target.get(0).id==settings.targetid)
					alwaysOnTop.positiontarget($target.appendTo('body'), settings)
				else
					alert('Error: The value you have entered for "targetid" ('+settings.targetid+') '
						+ 'doesn\'t match the ID of your remote content\'s DIV container ('+$target.get(0).id+'). This must be corrected'
					)
			}
		})
	},

	init:function(options){
		var settings={}
  	settings=jQuery.extend(settings, this.dsettings, options)
		this.settingscache[settings.targetid]=settings
		if (typeof settings.frequency=="number") //value of 1=show, 0=hide
			settings.display=(settings.frequency>Math.random())? 1 : 0
		else if (settings.frequency=="session")
			settings.display=(this.getCookie('sots'+settings.targetid)=='shown')? 0 : 1 //session cookie name: 'sots' + targetid
		else if (/^\d+ day/i.test(settings.frequency)){ //match 'xx days'
			//If admin has changed number of days to persist from current cookie records, reset persistence by deleting cookie
			if (parseInt(this.getCookie('sotp'+settings.targetid))!= parseInt(settings.frequency))
				this.setCookie('sotp'+settings.targetid, '', -1)
			settings.display=(this.getCookie('sotp'+settings.targetid)!=null)? 0 : 1 //persistent cookie name: 'sotp' + targetid
		}
		jQuery(document).ready(function($){
			if (settings.externalsource!='' && settings.display){ //if ajax content
					alwaysOnTop.loadajaxcontent($, settings)
			}
			else if (settings.externalsource==''){ //inline content
				var $target=$('#'+settings.targetid)
				if (!settings.display){ //if hide content (based on frequency setting)
					$target.hide()
					return false
				}
				else{
					alwaysOnTop.positiontarget($target, settings)
				}
			}
		}) //end ready
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair
		if (document.cookie.match(re)) //if cookie found
			return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
	},

	setCookie:function(name, value, days){
		if (typeof days!="undefined"){ //if set persistent cookie
			var expireDate = new Date()
			var expstring=expireDate.setDate(expireDate.getDate()+days)
			document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()
		}
		else
			document.cookie = name+"="+value+"; path=/"
	}
}

 var pls_viewportwidth;
 var pls_viewportheight;
 var pls_noticelocationwidth;
 var pls_noticelocationwidthException;
 var pls_noticelocationheight;

 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      pls_viewportwidth = window.innerWidth,
      pls_viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       pls_viewportwidth = document.documentElement.clientWidth,
       pls_viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       pls_viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       pls_viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }

pls_noticelocationwidth = ((pls_viewportwidth - 500)/ 2)-0;
pls_noticelocationwidthException = ((pls_viewportwidth - 500)/ 2)-500;
pls_noticelocationheight = (pls_viewportheight / 2) - 0;
