/* Allows drop menu for IE 6 */

// CALLED FROM include_primary_nav.html

sfHover = function() {
	if($.browser.msie){
		var sfEls = document.getElementById("primary_nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				$('#middle').css("z-index","-1");
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				$('#middle').css("z-index","1");
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}// Drop menus inside menu headers

/***********************
	INCLUDE FUNCTIONS 
***********************/

function writePrimaryNav(){
	$.ajax({
		type: "GET",
		url: "../includes/include_primary_nav.html",
		success: function(html){
			$("#top").append(html);
			
		}
	});
}

function writeSecondaryNav(){
	loadAndWriteContent("include_secondary_nav.html","bottom");
}

function writeHeader(){
	$.ajax({
		type: "GET",
		url: "../includes/include_utility_nav.html",
		success: function(html){
			$("#top").append(html);
			writePrimaryNav();	
		}
	});
}

function writeFooter(){
	
	$.ajax({
		type: "GET",
		url: "../includes/include_secondary_nav.html",
		success: function(html){
			$("#bottom").append(html);
			completeFooter();	
		}
	});
	
}

function completeFooter(){
	
	$.ajax({
		type: "GET",
		url: "../includes/include_footer.html",
		success: function(html){
			$("#bottom").append(html);
		}
	});
	
}

function writeMenuOptionsNav(subcat_id, item_id){
	$.ajax({
		type: "GET",
		url: "../includes/include_menu_options_nav.html",
		success: function(html){
			
			$("#right").append(html);
			toggleMenuOptionsNav(subcat_id, item_id);
			
		}
	});
}

function toggleMenuOptionsNav(subcat_id, item_id){
	$('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 13});
			
	$('#menu_options > ul').each(function(i){
		$(this).hide();
	});
	
	if(subcat_id){
		$('#cat_'+subcat_id).attr("className","expanded");
		$('#subcat_'+subcat_id).show();
	}
	
	if(item_id){
		$('#subcat_' + subcat_id + '_item_' + item_id + " > a").attr("className","on");
	}
}
//
//function set_metadata(title, keywords, description){
////    alert($('meta[http-equiv="Content-Type"]').attr("content"));
//
//    $(document).ready(function() {
//
//        $(this).attr("title", 'Subway International | ' + title);
//    //    alert($('meta[name="keywords"]').attr("content"));
//        $('meta[name="keywords"]').attr("content", keywords);
//    //    alert($('meta[name="keywords"]').attr("content"));
//        $("meta[name='description']").attr("content", '' + description);
//
//    });
//
//}
