function include_dom(script_type, script_language, script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', script_language);
    js.setAttribute('type', script_type);
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}

include_dom("text/javascript", "javascript", "/estore/js/ua.js");
include_dom("text/javascript", "javascript", "/estore/js/windowPop.js");

/* TOP NAV CONFIGURATION - http://cherne.net/brian/resources/jquery.hoverIntent.html */
var topNavHover = {
	sensitivity: 10, // number = sensitivity threshold (must be 1 or higher)
	interval: 75, // number = milliseconds for onMouseOver polling interval
	over: topNavDrop, // function = onMouseOver callback (required)
	timeout: 150, // number = milliseconds delay before onMouseOut
	out: topNavClear // function = onMouseOut callback (required)
};

var topNavCount = 0;

function topNavDrop(){ $("ul", this).fadeIn("fast"); }
function topNavClear(){ $("ul", this).fadeOut("fast"); }

$(document).ready(function(){
	$(document).pngFix();
	
	$("#topNavigation ul.navLvl1").children('li:last').children('ul:first').addClass("lastNav");
	
	/* TOP NAV HOVER */
	$("#topNavigation li").hoverIntent( topNavHover );
	$("#topNavigation img").hover(
		function(){
			var imgSrc = $(this).attr('src');
			if(imgSrc.indexOf('_off') != -1){
				newImgOn = imgSrc.replace('_off','_on');
				$(this).attr('src',newImgOn);
				topNavCount = 1;
			}else{
				topNavCount = 0;
			}
		},
		function(){
			if(topNavCount != 0){
				var imgSrc = $(this).attr('src');
				if(imgSrc.indexOf('_on')){
					newImgOff = imgSrc.replace('_on','_off');
					$(this).attr('src',newImgOff);
					topNavCount = 0;
				}
			}	
		}
	
	);


});


// CODE FOR PRINT ISSUE IE BROWSER
function printCheckIE(){
	if(navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') {return true;} else {return false;}
 }
function printFrame(){
	if(printCheckIE() == true){
		document.popoverFrame.focus();
		document.popoverFrame.print();
	}else{
		window.frames['popoverFrame'].focus();
		window.frames['popoverFrame'].print();
	}
 }

// CODE FOR LIMITING TEXT LENGTH IN TEXTAREA
function ismaxlength(obj){
	var mlength = obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if(obj.getAttribute && obj.value.lenth > mlength)
		obj.value = obj.value.substring(0,mlength)
}
function textCounter(){
	return true;
}