/*
 * 
 * Part of article How to detect screen size and apply a CSS style
 * http://www.ilovecolors.com.ar/detect-screen-size-css-style/
 *
 */

$(document).ready(function() {
						   
	function detect(){					   
	var x = $(window).width();//alert(x);
	var y = $(window).height();
	
	if ((x>=1024) && (y>=600))
	{
		
		$("link[rel=stylesheet]:not(:first)").attr({href : "largeScreen.css"});
		//alert('large');
	}
	else if (((x<1024) || (y<600))&&((x>=640) && (y>=400)))
	{
		//alert('medium');
		$("link[rel=stylesheet]:not(:first)").attr({href : "mediumScreen.css"});
	}
	else
	{
		//alert('small');
		$("link[rel=stylesheet]:not(:first)").attr({href : "smallScreen.css"});
	}
	}//end detect function
	
	 detect();
	 
	
	var resizeTimer = null;

	$(window).bind('resize', function() {
	if (resizeTimer) clearTimeout(resizeTimer);
	resizeTimer = setTimeout(detect, 100);
	});


	
});


