function check_viewport(css) {

 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 
 if (css) {
 	if (viewportwidth<989 || viewportheight<756) {
	 	$('#footer .webby').addClass('webbystatic');
	 } else {
	 	$('#footer .webby').removeClass('webbystatic');
	 }
 } else {
	 if (viewportwidth<989 || viewportheight<756) {
	 	$('#footer').append('<div class="webby webbystatic"><div class="web_mouse" onmouseover="$(this).css(\'width\', \'158px\')" onmouseout="$(this).css(\'width\', \'14px\')"></div><div class="web_mouse_over"><a href="http://www.adysign.com/" title="adysign"><span>adysign</span></a><a href="mailto:skera76@gmail.com" title="arek-s" class="mail_link"><span>skera76@gmail.com</span></a></div></div>');
	 } else {
	 	$('#footer').append('<div class="webby"><div class="web_mouse" onmouseover="$(this).css(\'width\', \'158px\')" onmouseout="$(this).css(\'width\', \'14px\')"></div><div class="web_mouse_over"><a href="http://www.adysign.com/" title="adysign"><span>adysign</span></a><a href="mailto:skera76@gmail.com" title="arek-s" class="mail_link"><span>skera76@gmail.com</span></a></div></div>');
	 }
 }
 

}

$(window).resize(function() {
  check_viewport('css'); 
});


$(document).ready(function() {

	check_viewport(); 
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");
	
	$('#menu li.first').hover (function() {
		if (!$(this).children('a').hasClass('active_sub')) {
			
			//$('#mask_overlay').fadeToggle('fast');
			
			if($.browser.msie) {
				$('#mask_overlay').toggle();
			} else {
				$('#mask_overlay').fadeToggle('fast');
			}
			
			
			$(this).children('a').toggleClass('active');
			
			if($.browser.msie && $.browser.version=="6.0") {
				$(this).children('ul').fadeToggle('fast');
			} else {
				$(this).children('ul').slideToggle('fast');
			}
			
		}
		
	});
	
	$('#menu .sub li').hover (function() {
			
			
				$(this).children('ul').fadeToggle('fast');
			
		
	});
	

	
	$('.webby').hover (function() {
		$(this).children('.web_mouse_over').fadeToggle('slow');
	});
	
	$('#menu li.first a.active').next('ul').show();
	
	$('.ad-gallery').adGallery(); 
	
	
	
	
});	



	
	

