try{
if (self != top)
{
   if (document.images)
      top.location.replace(window.location.href);
   else
      top.location.href = window.location.href;
}
}catch(er){}

// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
// Globals
// Major version of Flash required
var requiredMajorVersion = 6;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------



function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			//alert("flashVer="+flashVer);
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function dispFlash(fMovie){	
	// Version check based upon the values entered above in "Globals"
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	// Check to see if the version meets the requirements for playback
	if (hasReqestedVersion) {
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed
	
		document.write ("<div style='line-height:1px;'><br /></div>");			
		document.write ("<object	classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
		 		document.write ("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' ");
		 		document.write ("width='680' ");
				document.write ("height='296' ");
				document.write ("id='loader' ");
				document.write ("align=''>");
			document.write ("<param 	name='wmode' 	value='transparent' />");
		 	document.write ("<param 	name='movie' 	value='" + fMovie + "' />");
			document.write ("<param 	name='quality' 	value='high' />");
			document.write ("<param 	name='bgcolor'   value='#FFFFFF' />");
			document.write ("<embed	src='" + fMovie + "' ");
					document.write ("wmode='Transparent' ");
					document.write ("quality='high' ");
					document.write ("bgcolor='#FFFFFF' ");
					document.write ("width='680' ");
					document.write ("height='296' ");
					document.write ("name='loader'  ");
					document.write ("align='' ");
		 			document.write ("type='application/x-shockwave-flash' ");
					document.write ("pluginspage='http://www.adobe.com/go/getflashplayer'>");
			document.write ("</embed>");
		document.write ("</object>");	
	} else {  // flash is too old or we can't detect the plugin
		document.write ("<img src='/i/hpTopBox.jpg' alt='Kingpins.ca' />");
	}

}

function email_friend()
{
	var e_add= "";//prompt('Enter your friend\'s email address:',' ');
	var subj= "Kingpins.ca Web Page"; //prompt('Enter the subject of your message:',' ');
	var e_body = "You may be interested in this Kingpins.ca web page " + location.href;
	if ((subj==" ") || (subj==null))
	 	subj="Hi!";
	if (e_add==null)
		e_add=""; 
	window.location="mailto:"+e_add+"?subject="+subj+"&body="+e_body;
}

function openwincenter(url, width, height, id) {

// This is a generic popup utility from web site
// http://www.webdevfaqs.com/javascript.php, but modified a little.
// It opens a centered popupwin.
//
// Use a link like the following to access this function:
//
//   <a href="http://www.xyz.com" 
//   onClick="openwincenter(this.href,'600','400', 'xyz'); 
//   return false;">XYZ</a>
//
// It works, but something about our server currently kills the
// window while it tries to open. Or sometimes the browser will open
// the window in place.  ?? Actually I don't know where the problem lies
// at this time.  
//
// But, popups are generally frounded upon, so use sparingly.

var name = "popup";  // popup name
var width = width;   // popup width
var height = height; // popup height
var left = (screen.width - width) / 2 ;
var top = (screen.height - height) / 2;

var windowproperties = "width="+ width +",height="+ height +",left="+ left +",top="+ top +",scrollbars=1";

window.open(url, name, windowproperties);
window.name = id;
}

function moveBtn(leftV,IE6LeftV,url,linkText,strAr) {
	//positions a button graphic when hovering over item in the button bar(also display menu items if applicable) 
	try{
		var button = document.getElementById("btnBarSel");
		var btnContent = document.getElementById("btnBarSelText");
		var btnBarRight = document.getElementById("btnBarRightGif");
		var sHTML = "";		
		var dispBg = true;
		var tHeight=0;
		var botBorder="";
		var menuHeight=0;	
		button.style.width="139px";
		button.innerHTML = "<a href='" + url + "'><img src='/i/btnSelected.gif' alt='' /></a>";
		//change width for first button
		if(navigator.userAgent.indexOf("MSIE 6") != -1 || navigator.userAgent.indexOf("MSIE 5") != -1){
			leftV=IE6LeftV;
			button.innerHTML = "<a href='" + url + "'><img src='/i/btnSelected.gif' alt='' width='139' /></a>";
		}
		button.style.left=leftV;			 
		button.style.display='inline';
		if(leftV=="40px"){
			button.style.left="26px"; 
			button.innerHTML = "<a href='" + url + "'><img src='/i/btnSelected.gif' alt='' width='153' height=31 /></a>"; 
		}	
		button.style.overflow="visible";
		btnBarRight.innerHTML = "<img src='/i/btnBar/btnBarRwbg.png' alt='' />";
		if(leftV=="744px"){//if last btn help			
			if(navigator.userAgent.indexOf("MSIE 6") != -1 || navigator.userAgent.indexOf("MSIE 5") != -1){
				button.style.left="738px";
				button.style.width="150px";	
				button.innerHTML = "<a href='" + url + "'><img src='/i/btnSelected.gif' alt='' width='159' height=31 /></a>";
			}else{	
				button.innerHTML = "<a href='" + url + "'><img src='/i/btnSelected.gif' alt='' width='153' height=31 /></a>";
				button.style.width="140px";	
			} 		
			btnBarRight.innerHTML = "<img src='/i/btnBar/btnBarRSelBg.png' alt='' />";
			button.style.overflow="hidden";
		}	
				
		btnContent.style.left=leftV;
		btnContent.innerHTML = "<a href='" + url + "'>" + linkText + "</a>";
		btnContent.style.display='inline';			
		if(strAr!=""){
			var btnMenu = document.getElementById("btnMenu");			
			btnMenu.style.left=leftV;
			linkAr = strAr.split("|")			
			for(var i=0;i<linkAr.length;i+=2){	
				if(i==linkAr.length-2)
					botBorder = " style='border-bottom: 1px solid #237BB6;' ";						
				if(dispBg){	
					sHTML += "<div class='menuGrad'" + botBorder + "><div style='line-height:4px;'><br /></div>&nbsp;<a href='" + linkAr[i] + "'>" + linkAr[i + 1] + "</a></div>"	
					dispBg=false;					
				}else{ 					
					sHTML += "<div class='menuNoGrad'" + botBorder + "><div style='line-height:4px;'><br /></div>&nbsp;<a href='" + linkAr[i] + "'>" + linkAr[i + 1] + "</a></div>"
					dispBg=true;
				} 			
			}
			sHTML +="<div id='menuBot'></div>";	
			if(navigator.userAgent.indexOf("MSIE 6") != -1 || navigator.userAgent.indexOf("MSIE 5") != -1){		
				tHeight=linkAr.length/2*20;	//+3
			}else{
				tHeight=linkAr.length/2*21;
			}
			menuHeight=tHeight + 40;			
			document.getElementById("btnMenuLinks").style.height=tHeight + 'px';
			document.getElementById("btnMenuLinks").innerHTML = sHTML;
			document.getElementById("btnMenu").style.display = 'inline';				
		}else{
			document.getElementById("btnMenu").style.display = 'none';			
		}	
	}catch(er){}	
}
function hideBtn() {
	//for hiding the divs and images related to button bar that was just hovered off of by the user
	try{
		document.getElementById("btnBarSel").style.display = 'none';
		document.getElementById("btnBarSelText").style.display = 'none';	
		document.getElementById("btnMenu").style.display = 'none';		
		document.getElementById("btnBarRightGif").innerHTML = "<img src='/i/btnBar/btnBarRwbg.png' alt='' />";	
	}catch(er){}
}




function rCertify() { 
  popupWin = window.open
  ('http://www.bbbonline.org/cks.asp?id=10201258532820726', 'Participant', 'location=yes,scrollbars=yes,width=450,height=300') 
  window.name = 'opener'; 
} 
function openRepWindow(url) { 
  popupWin = window.open
  (url, 'Participant', 'location=no,scrollbars=yes,width=510,height=350') 
  window.name = 'repPopup'; 
}
function openPinWindow(url, id) { 
  popupWin = window.open
  (url, 'Participant', 'location=no,scrollbars=yes,width=350,height=350') 
  window.name = id; 
}
function openPinWindow2(url, id, width, height) { 
  popupWin = window.open
  (url, 'Participant', 'location=no,scrollbars=yes,width=' + width + ' ,height=' + height) 
  window.name = id; 
}
function openMacromedia() { 
  url = 'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
  popupWin = window.open
  (url, 'Participant', '') 
  window.name = 'macromedia'; 
}


function getMousePosition(e) 
{
 try{
   return !isNaN(e.pageX) ? {'x':e.pageX, 'y':e.pageY} : 
      {'x':e.clientX + document.documentElement.scrollLeft + document.body.scrollLeft, 
 'y':e.clientY + document.documentElement.scrollTop + document.body.scrollTop}; 
 }catch(er){}
};



function showMousePos(e)
{
	try{
		var yOffset = 0;
		var yOffBtns=document.getElementById('btn_Bar').offsetTop;
		var xOffBtns=document.getElementById('btn_Bar').offsetLeft;
		var btnBarBot=document.getElementById('btnBarBot').offsetTop;
		var xOffBtnRight=document.getElementById('btnBarRightGif').offsetLeft;
		var xOffMenu=document.getElementById('btnMenu').offsetLeft;
		var xForProdsEnd=0;
		var menuBot=0;
		yOffset = document.getElementById('mainDiv').offsetTop;
		var xOffset = document.getElementById('mainDiv').offsetLeft;
		
		btnBarBot = btnBarBot + yOffBtns; 
		xOffBtnRight = xOffBtnRight + 54;//add 54 to account for width
	
		if (!e) e = event;  // make sure we have a reference to the event
		//var input = document.getElementById('mousepos');
		var mp = getMousePosition(e);
		//input.value = 'x : ' + mp.x + ', y : ' + mp.y;
		if(mp.x > xOffBtns + xOffset && mp.x < xOffBtnRight + xOffset && mp.y > yOffBtns + yOffset && mp.y < btnBarBot + yOffset){
			//mouse is in the button area so do nothing 
		}else{			
			if(document.getElementById('btnMenu').style.display=='inline'){		
				xForProdsEnd = xOffset+xOffBtns+document.getElementById('pgWidth').offsetLeft+document.getElementById('btnMainBtns').offsetLeft + document.getElementById('btnLastDiv').offsetLeft;
				xForProdsStart=xOffset+xOffBtns+document.getElementById('pgWidth').offsetLeft+document.getElementById('btnMainBtns').offsetLeft + document.getElementById('btnSecLastDiv').offsetLeft;
				if (document.getElementById('menuBot')==null){
					menuBot = 211
				}else{
					menuBot = document.getElementById('menuBot').offsetTop  + 55;
				}			
				if(mp.x > xForProdsStart && mp.x < xForProdsEnd && mp.y > yOffBtns + yOffset && mp.y <  yOffBtns + menuBot + yOffset){
					//mouse is in the products flyout from the button area so do nothing 
				}else{
					hideBtn();				
				}
			}else{
				hideBtn();
			}
		}	
	}catch(er){}	
};

function init()
{
  document.onmousemove = showMousePos;
};
window.onload = init;

