//Post 'Em Notes Header by flooble.com
//This script is Copyright (c) 2003 Animus Pactum Consulting.
//For more information, visit:
//http://www.flooble.com/scripts/postems.php
//extended and added to by Vincent A Poile for Imaginet Ltd 2008
//http://www.imaginet.co.uk

//START of Post 'Em Notes Header code
var ie = false;
var lastNote = '';
if (document.all) { ie = true; }

function getObj(id) {
	if (ie) {
		return document.all[id];
	} else {
		return document.getElementById(id);
	}
}

function showNote(name) {
	if (name == lastNote && posx > 0) {
		hideNote(name);
		return;
	}

	if (lastNote != '') { hideNote(lastNote); }
	var title = getObj(name + '_title');
	var body = getObj(name + '_body');
	body.className = 'notevisible';
	lastNote = name;
   
   //sort out notes position -- added by vince 20080606
   if(posx > 1){
      //var totalwidth=getClientWidth();var pagewidth=(totalwidth < 790)? totalwidth:790;
      //offsetsize = (totalwidth-pagewidth);
      //document.getElementById('debug').innerHTML = offsetsize;
      //if(offsetsize > 0){
      body.style.left=(posx-300)+'px';//-offsetsize
      //}
   }
   
}

function hideNote(name) {
	var title = getObj(name + '_title');
	var body = getObj(name + '_body');
	body.className = 'notehidden';
	lastNote = '';
}

//end pop up functions


//break out of iframe on order page
if (top != window)
    top.location.href = window.location.href;


function pagePrint() {
    if (window.print) window.print();
	else alert("Please select the Print option from File Menu");
}

//added by vince 20080606
var posx = 0;
var posy = 0;
function getMouse(e){
posx=0;posy=0;
var ev=(!e)?window.event:e;//IE:Moz
if (ev.pageX){//Moz
posx=ev.pageX+window.pageXOffset;
posy=ev.pageY+window.pageYOffset;
}
else if(ev.clientX){//IE
posx=ev.clientX+document.body.scrollLeft;
posy=ev.clientY+document.body.scrollTop;
}
else{return false}//old browsers
}
document.onmousedown=getMouse;
function getClientWidth(){
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {//Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {//IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {//IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}

//hide/show function for broker form
 function hide(element){
     $('#'+element).hide();
 }
 function show(element){
     $('#'+element).show();
 }