function RightslinkPopUp(title, date, author, contentID)
	{	
		var url = "https://s100.copyright.com/servlet/DispatchServlet"; 
		var location = url 
			+ "?PublisherName=" + escape("Putman Media, Inc.")
			+ "&Publication=" + escape("Pharmaceutical Manufacturing")
			+ "&Title=" + escape(title)
			+ "&PublicationDate=" + escape(date)
			+ "&Author=" + escape(author)
			+ "&Install=S"
			+ "&ContentID=" + escape(contentID);
		PopUp = window.open( location,  'Rightslink', 
			'location=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=550');
	}

function OpenBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

var displayed;
displayed = '';
function toggle(divid){
	if(displayed != '') {
	  document.getElementById(displayed).style.display = 'none';
	}	
	if(displayed != divid){
		if(document.getElementById(divid).style.display == 'none'){
			document.getElementById(divid).style.display = 'block';
		}else{
			document.getElementById(divid).style.display = 'none';
		}
	}	
	displayed = divid;
}

/* Deal with IE problems on hover for left nav*/


startList = function() {

	startListLeft();
	startListTop();
}

startListLeft = function() {

if (document.all&&document.getElementById) {
navRoot = document.getElementById("leftnav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

/* Deal with IE problems on hover for top nav*/
startListTop = function() {

if (document.all&&document.getElementById) {
navRoot = document.getElementById("topnav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

//window.onload=startList;



// set up axel and ord for DART
var axel = Math.random() + "";
var ord = axel * 1000000000000000000;

function refreshPopular() {
	(new Ajax()).doGet('/services/most_popular_processor.html');
}

function createCookie(name,value,days,host,path) {
	var expires = "";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	
	var domain = '';
	if (host) {
		domain = "; domain="+host;
	}

	var folder = '';
	if (path) {
		folder = "; path="+path;
	}
	document.cookie = name+"="+value+expires+domain+folder;
}

function handle_validate_data(data)
{
	switch(data['status']) {
	case('success'):
		createCookie(data['name'], data['value'], 23, data['cookie_domain']);
		location.replace('/member/manage_account.html?q=user/' + data['uid'] + '/edit');
		break;
	case('expired'):
		param = '/member/register.php?status=expired';
		break;
	case('used'):
		param = '/member/login.php?status=used';
		break;
	}
	modalwindow();
	$('#modal_wrap').jqmShow();
}

// Modal functions
var fade_close=function(hash){ hash.w.fadeOut('350',function(){ hash.o.remove(); }); };
var fade_open=function(hash) { hash.w.fadeIn('350'); };

function modalwindow()
{
	$('#modal_wrap').jqm({
		ajax: param,
		ajaxText: '<img id="ajax_loading" src="http://www.pharmamanufacturing.com/images/user/ajax_loading.gif" height="100" width="100">',
		closeClass: 'modal_close',
		onHide: fade_close,
		onShow: fade_open,
		overlay: 80,
		overlayClass: 'modal_overlay',
		toTop: true,
		trigger: '.modal_trigger'
	});
}

// Manage Account -- focus form fields

var field = '';
var lasthash = '';

var onshow = function(){
		doshow();
};

function doshow() {
		if(field != '') {
				var selector = 'input#' + field;
				if(field == 'edit-pass-pass1') {
						var selector = 'input#' + field + ', input#edit-pass-pass2'; 
				}
				$(selector).addClass('highlight');
		}
		var focusid = field;
		if(focusid != '') {
				document.getElementById(focusid).focus();
		}
}

// initialize the variable everywhere
var put_registered = false;
