function popup(){
	window.open(this.href, '_blank');
	return false;
}

function setPopups(){ 
	for (i= document.links.length; i-->0;)
	    if (document.links[i].className == 'popup' || document.links[i].className ==  'additionalMediaImagePopup') 
	      document.links[i].onclick= popup;
}


function moneyFormat(amount) {
    +amount;
    amount = Math.round(amount * 100) / 100;
	if(amount == Math.floor(amount)) return amount + '.00';
	if(amount * 10 == Math.floor(amount * 10)) return amount + '0';
	return amount;
}


function _addEventListener(attachTo, eventType, callbackFunction, useCapture){
	if(attachTo.addEventListener){

		/**
		 * Standard
		 */
		attachTo.addEventListener(eventType, callbackFunction, useCapture);

	}else if (attachTo.attachEvent){

		/**
		 * IE
		 */
		if(attachTo.attachEvent('on' + eventType, callbackFunction, useCapture));

	}
}


function _getEventsElement(theEvent){
	/**
	 * Get the form that the element is part of.
	 * Standard
	 */
	if(theEvent.target) 
		return theEvent.target;

	/**
	 * Get the form that the element is part of.
	 * IE
	 */
	if(theEvent.srcElement) 
		return theEvent.srcElement;

	return null;
}



function URLencode(toEncode) {
	return escape(toEncode).replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
}


function show(elementId){
	toShow = document.getElementById(elementId);
	toShow.style.visibility = "visible";
	toShow.style.display = "block";
}

function hide(elementId){
	toShow = document.getElementById(elementId);
	toShow.style.visibility = "hidden";
	toShow.style.display = "none";
}
