
$(document).ready(function(){
//$("body").css("overflow", "hidden");
/////////WEATHER SLIDER
	var open=false;

			L1_width=parseInt($("#Layer1").css('width').slice(0,-2));
			L1_height=parseInt($("#Layer1").css('height').slice(0,-2));
			L1_right=parseInt($("#Layer1").css('right').slice(0,-2));
			L1_top=parseInt($("#Layer1").css('top').slice(0,-2));
	$('#expand_arr').css({'right':L1_width+L1_right-20+'px','top':L1_height+L1_top-20+'px','background-image':'url("i/expand.png")','display':'none'});

	$('#expand_arr').click(function(){
	
		if(open==false){
			$('#Layer1').animate({right:'+=100'},100, function (){
				$('#day,#night,#hourly').css({'display':'block'});
				
				L1_width=parseInt($("#Layer1").css('width').slice(0,-2));
				L1_height=parseInt($("#Layer1").css('height').slice(0,-2));
				L1_right=parseInt($("#Layer1").css('right').slice(0,-2));
				L1_top=parseInt($("#Layer1").css('top').slice(0,-2));
				
				$('#expand_arr').css({'right':L1_width+L1_right-20+'px','top':L1_height+L1_top-20+'px','background-image':'url("i/shrink.png")'});
			});
			$("#maintbl").css({'border':'1px solid #CCCCCC',
								'-moz-box-shadow':'3px 3px 10px #CCCCCC',
							   '-webkit-box-shadow': '3px 3px 10px #CCCCCC',
							   'box-shadow': '3px 3px 10px #CCCCCC',	
							   '-ms-filter': 'progid:DXImageTransform.Microsoft.Shadow(Strength=10, Direction=135, Color=\'#CCCCCC\')',	
							   'filter': 'progid:DXImageTransform.Microsoft.Shadow(Strength=10, Direction=135, Color=\'#CCCCCC\')'});
			
			
			
			open=true;
		}else{
			
			$('#Layer1').animate({right:'-=100'},100, function (){
				$('#day,#night,#hourly').css({'display':'none'});
				
				L1_width=parseInt($("#Layer1").css('width').slice(0,-2));
				L1_height=parseInt($("#Layer1").css('height').slice(0,-2));
				L1_right=parseInt($("#Layer1").css('right').slice(0,-2));
				L1_top=parseInt($("#Layer1").css('top').slice(0,-2));
			
				$('#expand_arr').css({'right':L1_width+L1_right-20+'px','top':L1_height+L1_top-20+'px','background-image':'url("i/expand.png")'});
			});
			
			$("#maintbl").css({'border':'none','-moz-box-shadow':'none','-webkit-box-shadow':'none','box-shadow':'none','-ms-filter':'none','filter': 'none'});
			open=false;
		}
	});
	

	$('#Layer1').hover(
	function(){
			$('#expand_arr').css({'display':'block'});
			}
	,
	function(){
			if(open==false)$('#expand_arr').css({'display':'none'});
	}
		
	);
	$('#expand_arr').hover(
	function(){
			$('#expand_arr').css({'display':'block'});
			}
	,
	function(){
			if(open==false)$('#expand_arr').css({'display':'none'});
	}
		
	);

/////////WEATHER SLIDER	

$('#s_button').click(function(){

	if($('#s_').val().length>1)
		{
			$('#s').val(escape($('#s_').val()));
			$('#searchForm').submit();
		} else $('#s_').focus();
		
});

$('#searchForm').keypress(function (event) {
	if (event.keyCode == 13) {
    
		if($('#s_').val().length>1)
		{
			$('#s').val(escape($('#s_').val()));
			$('#searchForm').submit();
		} else {
		
			$('#s_').focus();
			return false;
		}
	}
});

///////////WEATHER SLIDER
   /*
  var id='#morelink';
  
    $(document).mousemove(function(e){
	x1top=$(id).offset().top;
	x1left=$(id).offset().left;
	
	xwidth=$(id).width();
	xheight=$(id).height();
	
	x2top=x1top+xheight;
	x2left=x1left+xwidth;
    
		if(e.pageX>=x1left&&e.pageX<=x2left&&e.pageY>=x1top&&e.pageY<=x2top)
			$("body").css("cursor","pointer");
		else $("body").css("cursor","auto");
	
	}).click(function(e){
		if(e.pageX>=x1left&&e.pageX<=x2left&&e.pageY>=x1top&&e.pageY<=x2top)
		window.location.href=$(id).attr('href');
	  
	});
	*/
//////////////WEATHER SLIDER



var arrow = $('<span>',{className:'arrow'}).appendTo('ul.icons');
	$('<input type="hidden" name="w" id="w"/>').appendTo('form');
	
$('ul.icons li').click(function(){
		
		el = $(this);
		
		if(el.hasClass('active')){
			return false;
		}
		
		el.siblings().removeClass('active');
		el.addClass('active');

		arrow.stop().animate({
			left		: el.position().left,
			marginLeft	: (el.width()/2)-5
		});


		$('#w').val(el.attr("class")[0]);
		
		
	});
	
	$('li.w').click();
	
	$('#s_').focus();
	
	$(window).resize(function() {
		if(this.resizeTO) clearTimeout(this.resizeTO);
		this.resizeTO = setTimeout(function() {
			$(this).trigger('resizeEnd');
		}, 500);
	});
	
	$(window).bind('resizeEnd', function() {
		
		
		if(el.hasClass('active')){
			arrow.stop().animate({
				left		: el.position().left,
				marginLeft	: (el.width()/2)-5
			});
		}

    });


	
});

