function clearStatus() {
	window.status = '';	
	return true;
}

var popup = null;

function showRecipes(contentId) {
	var url = "/recipes.aspx";
	
	if(contentId != null) {
		url += "?contentId=" + contentId;	
	}
	
	popup = popupWin(popup, "recipes", true, url, 600, 400, false, false, false, false, true, true);
}

function popupWin(hwndPopup, windowName, closeFirst, sURL, Height, Width, toolbar, status, loc, menu, resize, scroll) {
	var	opts = "toolbar=" + (toolbar == false ? 0 : 1) + ",status=" + (status == false ? 0 : 1) + ",location=" + (loc == false ? 0 : 1) + ",menubar=" + (menu == false ? 0 : 1) + ",resizable=" + (resize == false ? 0 : 1) + ",";
	opts = opts + "height=" + Height + ",width=" + Width + ",scrollbars=" + (scroll == false ? 0 : 1);

	if (hwndPopup == null || hwndPopup.closed) {
		newPopup = window.open(sURL, windowName, opts);
		newPopup.focus();
		return newPopup;
	}

	if (closeFirst) {
		if (hwndPopup != null) { hwndPopup.close(); }
		newPopup = window.open(sURL, windowName, opts);
		newPopup.focus();
		return newPopup;
	}

	hwndPopup.location.href = sURL;
	hwndPopup.focus();
	return hwndPopup;			
}
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 }
}
function removeEvent(obj, evType, fn, useCapture){
  if (obj.removeEventListener){
    obj.removeEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}

/**
 * Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
 *
 * Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
 *
 * Gets the full width/height because it's different for most browsers.
 */
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 
	return window.undefined; 
}
function getViewportWidth() {
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
	return window.undefined; 
}
