function getNews(newsType){
      jQuery("#marg_04").load("./ajax_news.html?type="+newsType);
      
      if(newsType == 1)
            jQuery.get('/ajax_news.html',{type: newsType}, onNewsAjax1);
      if(newsType == 2)
            jQuery.get('/ajax_news.html',{type: newsType}, onNewsAjax2);
      
}

function onNewsAjax2(data){
      jQuery("#marg_04").html(data);
      jQuery("#news_e").attr('class', "news_ed_noact");
      jQuery("#news_w").attr('class', "news_world_act");

}


function onNewsAjax1(data){
      jQuery("#marg_04").html(data);   
      jQuery("#news_e").attr('class', "news_ed_act");
      jQuery("#news_w").attr('class', "news_world_noact");    
}

var checkValue = (function() {
    //var re = /^(\s|\d)+$/;
    var re = /^(\d)+$/;
    return function(x) {
		if (x.length > 5 || x.length < 4 ) {
			return false;
		}
      return re.test(x);
    }
  })();


function getWeatherForecast(zip){
	if (!checkValue(zip)) {
		alert('Zip code incorrect');
		return false;
	}
	jQuery("#weather_text").load("./ajax_weather.html?zip="+zip);
}

function getWeatherForecastBox() {
   jQuery("#weather_text").load("/ajax_weather_box.html");	
}


function popitup(url) {
	newwindow=window.open(url,'name','height=550,width=680,scrollbars=yes,resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}





function formatTime() {
  now = new Date();
  hour = now.getHours();
  min = now.getMinutes();
  sec = now.getSeconds();
 

    if (min <= 9) {
      min = "0" + min;
    }
    if (sec <= 9) {
      sec = "0" + sec;
    }
    if (hour > 12) {
      hour = hour - 12;
      add = " pm";
    } else {
      hour = hour;
      add = " am";
    }
    if (hour == 12) {
      add = " pm";
    }
    if (hour == 00) {
      hour = "12";
    }

  jQuery("#time_clock").html(hour + ":" + min);
  jQuery("#time_apm").html(add); 
  setTimeout("formatTime()", 1000);
}



jQuery(document).ready(formatTime);
