$(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
    $('ul.rounded li').nifty('normal');
});

function popUpDialog(page, args, w, h, scroll, sizable) {

    var winl = (document.body.clientWidth - w) / 2;
    var wint = (document.body.clientHeight - h) / 2;

    if (navigator.appName.indexOf('Netscape') != -1 && parseInt(navigator.appVersion) > 4 && page.indexOf('https') != -1)
             page = 'http' + page.substring(5);

    var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',status=no,scrollbars='+scroll+',resizable='+ sizable +',titlebar=no,help=no';

    if(navigator.userAgent.indexOf('Gecko')!=-1)
             winprops += ',unadorned=no';
    window.open(page, args, winprops);
    
}
