/***
Part of coffee.
&copy; Joseph Hallahan 2008
*/


/*
Generic popup script
@param 	target:String 		the url
@param 	name:String 		name of popup
@param 	w:Number 			width
@parap	h:Number			height
@param  useScroll:Boolean	scrollbars
*/
function popUp(target, name, w, h, useScroll) {

	if( window.open(target, name, 'resizable=no, location=no, width='+w+', height='+h+', menubar=no, status=no, scrollbars=yes, menubar=no')){
		return true;
	}else{
		alert ('Trying to access \n' + window.location.href + target + '\n\nIt appears your browser has stopped a popup window from opening. Please disable your popup-blocker to access this page.');
		return false;
	}
}


/*
Generic cross browser function to return the height of the browser window.
@return int - width of browser
*/
function getWindowHeight () {
    var windowHeight = 0
    if( typeof( window.innerHeight ) == 'number' ) {
        windowHeight = window.innerHeight;//Non-IE
    }else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        windowHeight = document.documentElement.clientHeight; //IE 6+ in 'standards compliant mode'
    }else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        windowHeight = document.body.clientHeight;//IE 4 compatible
    }
    return windowHeight;
}



/*
Generic cross browser function to return the width of the browser window.
@return int - height of browser
*/
function getWindowWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;//Non-IE
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;//IE 6+ in 'standards compliant mode'
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth;//IE 4 compatible
  }
  return myWidth;
}
