$(document).ready(function() {

  //Content width
  checkSize();
  $(window).bind("resize", function(){ checkSize(); });

  //Form Popup results 
  $('form.popup').submit(function () {
	window.open('', 'poll', 'height=370,width=390,scrollbars=yes');
	this.target='poll';
	return true;
  });

  $('.popupSm p.close a').click(function () {
    if (window.name=='poll') {
	  window.close();
	  return false;
	}
  });

});

function checkSize() {
  if ($(window).width()<900) {
	$('body').addClass('window800');
  }
  else {
	$('body').removeClass('window800');
  }
}

$(document).ready(function() {
    // apply nify corners
    if ($.fn.nifty) {
        $('ul.rounded li').nifty('normal');
    }
});

/***********************************************************************
TJF r9 10/7/09 Added createJSLink()
This method is called by user controls to create an absolute path when referencing js files.
The problems is if a page url has dsd/welcome.aspx/sdsd/sdsd/sd The extra slashs after the .aspx
will throw off any ~/ for relative paths. This method can be called which will create the absolute path.
***********************************************************************/
function createJSLink(url) {
    var jsLink = 'http://' + window.location.host + url;
    var headID = document.getElementsByTagName("head")[0];
    var newScript = document.createElement('script');

    newScript.type = 'text/javascript';
    newScript.src = jsLink;

    headID.appendChild(newScript);
}
