//button top, version: $Revision: 1.6 $
var version=1.0;
var IMG = "http://a449.g.akamai.net/7/449/1776/000/button.clickability.com/img/com/";
var saveThisLocation="http://www.savethis.com/st/";
var emailThisLocation="http://www.clickability.com/r/r?t=E&clickMap=";
var printThisLocation="http://www.printthis.clickability.com/pt/";
var layerLoaded = false;
var buttonLayer = new Array();
var dropLayer = new Array();
var two_hl = new Array();
var three_hl = new Array();
var four_hl = new Array();
var five_hl = new Array();
var six_hl = new Array();
var seven_hl = new Array();
var eight_hl = new Array();
var nine_hl = new Array();
var ten_hl = new Array();
var eleven_hl = new Array();
var agt=navigator.userAgent.toLowerCase();
/*****************************************************/
var isNS = document.layers;
var isPCIE = ((document.all) && (agt.indexOf("win")!=-1));
var isMACIE5 = ((agt.indexOf("mac")!=-1) && (agt.indexOf("msie 5") != -1));
var isMACIE4 = ((agt.indexOf("mac")!=-1) && (agt.indexOf("msie 4") != -1));


function stopError() {
  return true;
}
window.onerror = stopError;

var CA_adjustX = 0;
var CA_adjustY = 0;

if ((navigator.appVersion.indexOf("Windows") > 0 && navigator.appVersion.indexOf("MSIE") > 0) && (window == top)){
	CA_adjustX = -2;
	CA_adjustY = -2;
}

function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}
function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

// Get position of button on page dynamica
function getRealLeft(el) {
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}



// NS rollover code
function dropit_NS(whichone,horizontal,vertical,num,img){			
	if (window.themenu&&themenu.id!=eval(whichone).id) {
		themenu.visibility="hide";
	}
	themenu=eval(whichone)
	if (themenu.visibility=="hide"){
		themenu.visibility="show";
	} 
	themenu.left= document.images[img+num].x + horizontal;
	themenu.top= document.images[img+num].y + vertical;
	return false;
}

// IE rollover code
function dropit_IE(whichone,horizontal,vertical,num,img){
	if (window.themenu&&themenu.id!=whichone.id){
		themenu.style.visibility = "hidden";
	}
	themenu=whichone
	// Add some sniffing code here to adjust for platform
	if (agt.indexOf("mac")!=-1) { 
		if (agt.indexOf("msie 5") != -1) {
			themenu.style.left = (event.clientX - event.offsetX)+horizontal;
			themenu.style.top = (event.clientY - event.offsetY)+vertical;
		}else{	
			themenu.style.left  = getRealLeft(document.images[img+num]) + (event.clientX - event.offsetX) + horizontal;
			themenu.style.top = getRealTop(document.images[img+num]) + (event.clientY - event.offsetY) + vertical;
		}
	}else {
		themenu.style.left = (document.body.scrollLeft + event.clientX - event.offsetX + CA_adjustX) + horizontal;
		themenu.style.top = (document.body.scrollTop + event.clientY - event.offsetY + CA_adjustY) + vertical;
	}
	themenu.style.visibility="visible";		
}

// Browser specific code for closing the layer
function hidemenu_IE(whichone){
	if (window.themenu) {
		themenu.style.visibility="hidden";
	}
}

function hidemenu_NS(whichone){
	themenu=eval(whichone);
	themenu.visibility="hide";
	return false;
}


//Timeout function
var timerID;

function timeout(mouse,num) {
	var agt=navigator.userAgent.toLowerCase()
	if (document.images) {
		if (!mouse) {
			clearTimeout(timerID);
	    	}
	    	else {
			if (mouse == 1) {
	    			clearTimeout(timerID);
				if (document.layers)
					timerID = setTimeout("hidemenu_NS('document.saveLayer"+num+"');", 1000);
				if (document.all)
					timerID = setTimeout("hidemenu_IE('saveLayer"+num+"');", 1000);
			}
			if (mouse == 2) {
				clearTimeout(timerID);
				if (document.layers)
					timerID = setTimeout("hidemenu_NS('document.emailLayer"+num+"');", 1000);
				if (document.all)
					timerID = setTimeout("hidemenu_IE('emailLayer"+num+"');", 1000);
			}
			if (mouse == 3) {
				clearTimeout(timerID);
				if (document.layers)
					timerID = setTimeout("hidemenu_NS('document.printLayer"+num+"');", 1000);
				if (document.all)
					timerID = setTimeout("hidemenu_IE('printLayer"+num+"');", 1000);
			}
				
			
		}				
	}
}

function getClickURL() {
	if (self.clickURL) return clickURL;
	return self.top.location.href;
}

function getClickTitle() {
	if (self.clickTitle) return clickTitle; 
	return document.title;
}

