/* THIS PAGE SHOULD NOT BE ALTERED ON A PER-CLIENT BASIS	

CONTAINS: general window functions 
INCLUDE: <script language="JavaScript" src="../assets/js/windowFunctions.js"></script>  

*/
 

function frameBuster()	{
	 if (top!=self) top.location=self.location;
 } 


function maxWindow()	{
	window.moveTo(0,0);
	if (document.all)	{
	  top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById)	{
	  if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) {
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
}}}



var popblocked = false;
function launchWindow(mypage,myname,w,h,t,attribs) {		// myname cannot contain whitespace
	popblocked = false;
	win = this.window;
	if (myname == null) 	{ myname = 'newWindow';	}	
	if (w == null) 			{ w = 720;	}
	if (h == null) 			{ h = 500;	}
	if (t == null) 			{ t = 80;	}	
	if (attribs == null) 	{ attribs = 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes'	}	
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var wint = t;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+','+attribs
	win = eval(window.open(mypage, myname, winprops));
	if (win == null) {
		popblocked = true;
		alert('Please disable your popup blocking software');
	}
	else {		
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
	return false;
}

var pageWidth;
var pageHeight;

function getDimensions() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }
  pageWidth = myWidth;
  pageHeight = myHeight;
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function pagePrint() {
	window.print();
}

function pageBookmark() {
	var urlAddress = window.location.href;
	var pageName = "PAGE NAME";
	if (window.external) { 
		window.external.AddFavorite(urlAddress,pageName);
		
	} 
	else { 
		alert("Sorry! Your browser doesn't support this function. Press Control+D to Bookmark this page"); 
	}
} 

function pageEmail() {
		var emailPage = "../assets/scripts/emailPage.asp?cPage="
		
		var currentPage = encodeURIComponent(window.location.href);
		launchWindow(emailPage + currentPage, "Email", 500, 220, 100);
}
