
	/* HTM5 Elements */
	document.createElement('header');
	document.createElement('hgroup');
	document.createElement('nav');
	document.createElement('menu');
	document.createElement('section');
	document.createElement('article');
	document.createElement('aside');
	document.createElement('footer');
	
	var imageSrc         = [];
	var imageRes         = screen.width;
	var winWidth         = (window.innerWidth ? window.innerWidth : document.body.clientWidth);
	var resizeModPath    = baseDir+'modules/coremanager/modules/websupersizedpro/';
	var resizePath       = baseDir+'modules/coremanager/modules/websupersizedpro/assets/resized';
	
	function appendStyleSheets() {
		
		var resWidth = '';
		//alert(screen.width);
		switch(screen.width) {
			case 800 :
			case 960 :
			case 1024 :
			case 1280 :
				resWidth = '1280';
				break;
			case 1344 :
			case 1440 :
				resWidth = '1440';
				break;
			case 1600 :
				resWidth = '1600';
				break;
			default:
				resWidth = '';
				break;
		}
		var sitePath = 'http://coyotegrindlounge.com/';
		var styleSheetWhiteList = [
			sitePath+'themes/coyotegrindlounge/css/product.css',
			sitePath+'themes/coyotegrindlounge/css/style.css?v=2',
			sitePath+'themes/coyotegrindlounge/css/project.css?v=2',
			sitePath+'themes/coyotegrindlounge/css/contact-form.css',
			sitePath+'themes/coyotegrindlounge/css/cms.css',
			sitePath+'modules/pm_advancedtopmenu/css/pm_advancedtopmenu_base.css',
			sitePath+'modules/pm_advancedtopmenu/css/pm_advancedtopmenu_global.css',
			sitePath+'modules/pm_advancedtopmenu/css/pm_advancedtopmenu_advanced.css',
			sitePath+'modules/pm_advancedtopmenu/css/pm_advancedtopmenu.css',
			sitePath+'modules/coremanager/modules/splashpagewizardpro/assets/splashpagewizardpro.css',
			sitePath+'modules/coremanager/modules/filtersearch/assets/filtersearch_ui.css',
			sitePath+'modules/coremanager/modules/filtersearch/assets/filtersearch.css',
			sitePath+'themes/coyotegrindlounge/css/modules/manufacturercarousel/manufacturercarousel.css'
		];		

		jAPI.each(styleSheetWhiteList, function(key, href) {
			
			var hrefRes = '';
			//http://coyotegrindlounge.com/dev/themes/coyotegrindlounge/css/project.css?v=2
			if(utility.strstr(href, 'coyotegrindlounge/css/') && ! utility.strstr(href, 'css/modules/')) {
				hrefRes = href.replace('coyotegrindlounge/css/', 'coyotegrindlounge/css/'+resWidth+'/');
			} else if(utility.strstr(href, 'assets/')) {
				hrefRes = href.replace('assets/', 'assets/'+resWidth+'/');
			} else if(utility.strstr(href, 'manufacturercarousel')) {
				hrefRes = href.replace('manufacturercarousel.css', 'manufacturercarousel-'+resWidth+'.css');
			}

			if(screen.width != 1920 && hrefRes != '' && resWidth != '') {
				$('head').append('<link rel="stylesheet" media="all" href="'+hrefRes+'" type="text/css" />');
			}
		});
	}
	
	function getImagesSrc() {
		imageSrc[pageFlag] = [];
		jAPI('.headerWrap img, footer img, #productWrap header img, #productInfo img').not('#sectionNav img, .zoomdiv img').each(function(){
			if(jAPI(this).attr('src') != '')
				imageSrc.push(jAPI(this).attr('src'));
		});
		jAPI('nav img').each(function() {
			item = jAPI(this).closest('a').attr('class');
			if(jAPI(this).attr('src') != '')
				imageSrc.push(jAPI(this).attr('src').replace(item, item+'_hover'));
		});

		jAPI.post(resizeModPath+"setUserWindow.php", {"winWidth" : winWidth, "images" : imageSrc}, function(data){
			var screenWidth = '';
			
			switch(screen.width) {
				case 800 :
				case 960 :
				case 1024 :
				case 1280 :
					screenWidth = '1280';
					break;
				case 1344 :
				case 1440 :
					screenWidth = '1440';
					break;
				case 1600 :
					screenWidth = '1600';
					break;
				default:
					screenWidth = '1920';
					break;
			}
			
			jAPI('.headerWrap img, footer img, #productWrap header img, #productInfo img').not('#sectionNav img, .zoomdiv img').each(function(){
				if(jAPI(this).attr('src') != '') {
					imageSrc = jAPI(this).attr('src').replace(baseDir, '/').replace(baseUri, '').replace('//', '/');
					jAPI(this).attr('src', resizePath+'/'+screenWidth+'/'+imageSrc);
				}
			});
		});
	}
	
	function navigation() {
		var item;
		jAPI('nav img').hover(function() {
			item = jAPI(this).closest('a').attr('class');
			replace = jAPI(this).attr('src').replace(item, item+'_hover');
			jAPI(this).attr('src', replace);
		}, function(){
			replace = jAPI(this).attr('src').replace(item+'_hover', item);
			jAPI(this).attr('src', replace);
		});
	}
	
	jAPI(function() {
		appendStyleSheets();
		getImagesSrc();
	});
	









/*
	var menuLiHeight    = 95;
	var headingFontSize = 24;
	var itemLineHeight  = 0.5;
	var itemFontSize    = 16;
	var countFontSize   = 15;
	var itemPadding     = 8;
	var groupPadding    = 6;
	var winRatio        = winWidth/1920;
	
	menuLiHeight    *= winRatio;
	headingFontSize *= winRatio;
	itemLineHeight  *= winRatio;
	itemFontSize    *= winRatio;
	countFontSize   *= winRatio;
	itemPadding     *= winRatio;
	groupPadding    *= winRatio;
	
	if(jAPI.cookie("css")) {
		jAPI("link#projectCSS").attr("href", jAPI.cookie("css"));
	}
	if(screen.width >= 2560) {
		var href  = themeCSS+"project-2560.css?v=2";
	} else if(screen.width >= 1920 && screen.width < 2560) {
		var href  = themeCSS+"project-1920.css?v=2";
	//	headingFontSize = 24; 
	//	itemFontSize    = 16;
	//	countFontSize   = 15;
	} else if(screen.width >= 1600 && screen.width < 1920) {
		var href  = themeCSS+"project-1600.css?v=2";
	//	headingFontSize = 22; 
	//	itemFontSize    = 14;
	//	countFontSize   = 13;
	} else if(screen.width >= 1280 && screen.width < 1600) {
		var href  = themeCSS+"project-1280.css?v=2";
	//	headingFontSize = 17; 
	//	itemFontSize    = 12;
	//	countFontSize   = 11;
	} else if(screen.width >= 1024 && screen.width < 1280) {
		var href  = themeCSS+"project-1024.css?v=2";
	//	headingFontSize = 15; 
	//	itemFontSize    = 10;
	//	countFontSize   = 9;
	} else if(screen.width >= 800 && screen.width < 1024) {
		var href  = themeCSS+"project-800.css?v=2";
	//	headingFontSize = 11; 
	//	itemFontSize    = 9;
	//	countFontSize   = 8;
	} else {
		var href  = themeCSS+"project.css?v=2";
	//	headingFontSize = 24; 
	//	itemFontSize    = 16;
	//	countFontSize   = 15;
	}
		//alert("Switching CSS Style Sheet to ("+href+")");
		jAPI("link#projectCSS").attr("href", href);
		jAPI.cookie("css",href, {expires: 365, path: "/"});
		//jAPI("#siteLogo img").attr("src", logo);
		//jAPI("#intro").attr("src", intro);	
*/
	
	
	
	
	
	
	
	/*** Mobile Support ***/
	
	window.onload = function initialLoad(){
		updateOrientation();
	}
	
	function updateOrientation() {
		
		var contentType = "show_";
		switch(window.orientation){
			case 0:
				contentType += "normal";
				break;
			case -90:
				contentType += "right";
				break;
			case 90:
				contentType += "left";
				break;
			case 180:
				contentType += "flipped";
				break;
		}
		document.getElementById("page_wrapper").setAttribute("class", contentType);
	}
	
	if(window.addEventListener){
		window.addEventListener('load', function() { setTimeout(loaded, 100) }, false);
	} else if(window.attachEvent){
		window.attachEvent('onclick', function() { setTimeout(loaded, 100) });
	}
		
	function loaded() {
		document.getElementById("page_wrapper").style.visibility = "visible";
		window.scrollTo(0, 1); // pan to the bottom, hides the location bar
	}

	var metas = document.getElementsByTagName('meta'), i;
	if (navigator.userAgent.match(/iPhone/i)) {
		for (i=0; i<metas.length; i++) {
			if (metas[i].name == "viewport") {
				metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
			}
		}
		document.addEventListener("gesturestart", gestureStart, false);
	}
	
	function gestureStart() {
		for (i=0; i<metas.length; i++) {
			if (metas[i].name == "viewport") {
				metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
			}
		}
	}
