
function popOffer(offer_link, offer_title){

	var win_height = window.screen.height/2;
	var win_width = (window.screen.width/4)*3;

	if ( !( win_height ) ) {
			win_height = 500;
	}
	
	if ( !( win_width ) ) {
			win_width = 500;
	}


  var popup_window =  window.open(
		offer_link,
		'popupWindow',	'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width='+win_width+',height='+win_height+',screenX=50,screenY=50,top=50,left=50'
);

//  popup_window.title = "OptimizeRx - " + offer_title;
  return false;
}

function setPopupOffers(){
	offer_links = getElementsByClass('offer_link',null,'a');
	for ( offer in offer_links ) {

		offer_links[offer].onclick = function () {
			popOffer(this.href,this.title);
			return false;
		}

	}
}


function popup(popup_link, popup_title){

	var win_height = 500;
	var win_width = 500;

  var popup_window =  window.open(
		popup_link,
		'popupWindow',	'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+win_width+',height='+win_height+',screenX=150,screenY=150,top=150,left=150'
);

  //popup_window.title = "OptimizeRx - " + popup_title;
  return false;
}

function setPopups(){
	popup_links = getElementsByClass('popup',null, 'a');
	for ( popups in popup_links ) {

		popup_links[popups].onclick = function () {
			popup(this.href,this.title);
			return false;
		}
		
	}

	popup_links = getElementsByClass('big_popup',null, 'a');
	for ( popups in popup_links ) {

		popup_links[popups].onclick = function () {
			popOffer(this.href,this.title);
			return false;
		}
		
	}
}
