
// BEGIN Espanol OMNITURE FUNCTIONS
function get_omni_account_number(){
  var acct = "";
  // Override acct number if site is staging, demo or beta (even if it is at rl domain)
  if (location.host.indexOf("stage") != -1 || location.host.indexOf("demo") != -1 || location.host.indexOf("beta") != -1 || location.host.indexOf("sitewire") != -1){
    // Omniture Account Number (test)
	if (location.host.indexOf("sitewire") != -1)
	{
		acct = "drolivegardenespanolswtest";
	}
	else
	{
		acct = "drolivegardenespanoldemo";
	}
  }  
  else if (location.host.indexOf("olivegarden.com") != -1)
  {
	acct = "drolivegardenespanol";
  }
  else if (location.host.indexOf("olivegarden.ca") != -1)
  {
	acct = "drolivegardenespanol";
  }
  
  if (location.search == '?check_omni_acct') alert(acct);
  return acct;
}

if (window.location.protocol == "https:" &&
   (location.host == "olive-garden-dev.realbranding-test.com" || location.host == "www.olivegarden.com" || location.host == "stage.olivegarden.com" || location.host == "demo.olivegarden.com")){
  window.location = window.location.href.replace('https','http');
}

if (location.search.indexOf('server_path') != -1){
   js_server_path = new String(location.search);
   js_server_path.replace("server_path=","");
   var js_pathparts = js_server_path.split("/");
}
else{
   var js_server_path = location.pathname.replace('.asp','');
   var js_pathparts = js_server_path.split("/");
}

var root_path = '';
if (location.host != "olive-garden-dev.realbranding-test.com" && location.host != "www.olivegarden.com" && location.host != "stage.olivegarden.com" && location.host != "demo.olivegarden.com"){
//   root_path = "http://www.olivegarden.com";
   root_path = "http://www.olivegarden.com";
//  line below commented SK 20060124
//   root_path = "http://olive-garden-dev.realbranding-test.com";
}

if (location.search == '?force_root_path') root_path = "http://"+location.host;
if (root_path != '' && window.location.protocol == "https:") root_path = root_path.replace(/http:/, "https:");
if (root_path != '' && location.search == '?check_root_path') alert(root_path);

// BEGIN HITBOX VARIABLES
if (location.host == "www.olivegarden.com" || location.host == "olivegarden.com"){
   // Hitbox Account Number (live - Espanol!)
   //var hbx_account_number = "DM5609142KAS";
}
else{   
   // Hitbox Account Number (test)
   //var hbx_account_number = "DM540930PJDM";
}


function get_omni_content_cat(){
    var content_cat = "";
    if (location.host.indexOf('olivegarden.com') != -1 || location.host.indexOf('olivegarden.dev') != -1 || location.host == "olive-garden-dev.realbranding-test.com"){
       var content_categories = new Object;
       content_categories['culinary'] = "Nuestra Inspiracion Culinaria";
       content_categories['menus'] = "Nuestro Menu";
       content_categories['wines'] = "Nuestros Vinos";
       content_categories['recipes'] = "Recetas";
       //content_categories['marketplace'] = "Gift Cards";
       content_categories['company'] = "Empresa";
       content_categories['employment'] = "Empleo";
       content_categories['community'] = "Comunidad";
       content_categories['press'] = "Prensa";
       //content_categories['invite'] = "Invite Your Friends";
       var top_level_directory;
       top_level_directory = js_pathparts[2];
       if (content_categories[top_level_directory]){
          content_cat = content_categories[top_level_directory];
       }
       else if (js_pathparts[2].indexOf('Default') != -1 || js_pathparts[2].indexOf('default') != -1){
          content_cat = "Home Page";
       }
       else if (js_pathparts[2].indexOf('sitemap') != -1){
          content_cat = "Mapa Del Sitio";
       }
       else if (js_pathparts[3] == ""){
          content_cat = "Root";
       }
       else{
          content_cat = "Other";
       }
    }
    else{
       content_cat = "Other (third party)";
    }
    if (location.search == '?check_omni_cat') alert(content_cat);
    return content_cat;
}


if(document.images){

   // BEGIN LOCATOR TAB BG PRELOADS

   zip_tab_bg = new Image(191,49);
   zip_tab_bg.src = root_path+"/images/find_tabs/zip_tab_form_bg.gif";

   info_tab_bg = new Image(191,226);
   info_tab_bg.src = root_path+"/images/find_tabs/info_tab_bg.gif";

   // END LOCATOR TAB BG PRELOADS

   // BEGIN MAIN NAVIGATION PRELOADS

   culinary = new Image(189,34);
   culinary.src = root_path+"/images/nav_main/culinary_sp.gif";
   
   culinary_on = new Image(189,34);
   culinary_on.src = root_path+"/images/nav_main/culinary_on_sp.gif";
   
   culinary_over = new Image(189,34);
   culinary_over.src = root_path+"/images/nav_main/culinary_over_sp.gif";

   menus = new Image(99,34);
   menus.src = root_path+"/images/nav_main/menus_sp.gif";
   
   menus_on = new Image(99,34);
   menus_on.src = root_path+"/images/nav_main/menus_on_sp.gif";
   
   menus_over = new Image(99,34);
   menus_over.src = root_path+"/images/nav_main/menus_over_sp.gif";

   wines = new Image(76,34);
   wines.src = root_path+"/images/nav_main/wines_sp.gif";
   
   wines_on = new Image(76,34);
   wines_on.src = root_path+"/images/nav_main/wines_on_sp.gif";
   
   wines_over = new Image(76,34);
   wines_over.src = root_path+"/images/nav_main/wines_over_sp.gif";
   
   recipes = new Image(58,34);
   recipes.src = root_path+"/images/nav_main/recipes_sp.gif";
   
   recipes_on = new Image(58,34);
   recipes_on.src = root_path+"/images/nav_main/recipes_on_sp.gif";
   
   recipes_over = new Image(58,34);
   recipes_over.src = root_path+"/images/nav_main/recipes_over_sp.gif";
   
   gift_card = new Image(74,34);
   gift_card.src = root_path+"/images/nav_main/gift_card_sp.gif";
   
//   gift_card_on = new Image(74,34);
//   gift_card_on.src = root_path+"/images/nav_main/gift_card_on_sp.gif";
   
   gift_card_over = new Image(74,34);
   gift_card_over.src = root_path+"/images/nav_main/gift_card_over_sp.gif";
   
   // END MAIN NAVIGATION PRELOADS

   // BEGIN SUB-NAVIGATION PRELOADS

   if (js_pathparts[2] == "culinary"){
      // CULINARY INSPIRATION SUB-NAVIGATION PRELOADS

      inspired_entrees = new Image(140,13);
      inspired_entrees.src = root_path+"/images/nav_sub/inspired_entrees_sp.gif";
      
      inspired_entrees_over = new Image(140,13);
      inspired_entrees_over.src = root_path+"/images/nav_sub/inspired_entrees_over_sp.gif";

      cit = new Image(140,22);
      cit.src = root_path+"/images/nav_sub/cit_sp.gif";
      
      cit_over = new Image(140,22);
      cit_over.src = root_path+"/images/nav_sub/cit_over_sp.gif";

      italian_essentials = new Image(140,11);
      italian_essentials.src = root_path+"/images/nav_sub/italian_essentials_sp.gif";
      
      italian_essentials_over = new Image(140,11);
      italian_essentials_over.src = root_path+"/images/nav_sub/italian_essentials_over_sp.gif";
      
   }
   if (js_pathparts[2] == "menus"){

      // OUR MENU SUB-NAVIGATION PRELOADS
      specials = new Image(140,11);
      specials.src = root_path+"/images/nav_sub/specials_sp.gif";
      
      specials_over = new Image(140,11);
      specials_over.src = root_path+"/images/nav_sub/specials_over_sp.gif";
      
      lunch = new Image(140,11);
      lunch.src = root_path+"/images/nav_sub/lunch_sp.gif";
      
      lunch_over = new Image(140,11);
      lunch_over.src = root_path+"/images/nav_sub/lunch_over_sp.gif";
      
      dinner = new Image(140,11);
      dinner.src = root_path+"/images/nav_sub/dinner_sp.gif";
      
      dinner_over = new Image(140,11);
      dinner_over.src = root_path+"/images/nav_sub/dinner_over_sp.gif";
      
      beverage = new Image(140,11);
      beverage.src = root_path+"/images/nav_sub/beverage_sp.gif";
      
      beverage_over = new Image(140,11);
      beverage_over.src = root_path+"/images/nav_sub/beverage_over_sp.gif";
      
      to_go = new Image(140,11);
      to_go.src = root_path+"/images/nav_sub/to_go_sp.gif";
      
      to_go_over = new Image(140,11);
      to_go_over.src = root_path+"/images/nav_sub/to_go_over_sp.gif";
      
      dessert = new Image(140,11);
      dessert.src = root_path+"/images/nav_sub/dessert_sp.gif";
      
      dessert_over = new Image(140,11);
      dessert_over.src = root_path+"/images/nav_sub/dessert_over_sp.gif";
      
      garden_fare = new Image(140,11);
      garden_fare.src = root_path+"/images/nav_sub/garden_fare_sp.gif";
      
      garden_fare_over = new Image(140,11);
      garden_fare_over.src = root_path+"/images/nav_sub/garden_fare_over_sp.gif";
      
      kids = new Image(140,11);
      kids.src = root_path+"/images/nav_sub/kids_sp.gif";
      
      kids_over = new Image(140,11);
      kids_over.src = root_path+"/images/nav_sub/kids_over_sp.gif";
   }
   if (js_pathparts[2] == "wines"){
      // OUR WINES SUB-NAVIGATION PRELOADS

      wine_list = new Image(140,11);
      wine_list.src = root_path+"/images/nav_sub/wine_list_sp.gif";
      
      wine_list_over = new Image(140,11);
      wine_list_over.src = root_path+"/images/nav_sub/wine_list_over_sp.gif";
      
      food_wine = new Image(140,11);
      food_wine.src = root_path+"/images/nav_sub/food_wine_sp.gif";
      
      food_wine_over = new Image(140,11);
      food_wine_over.src = root_path+"/images/nav_sub/food_wine_over_sp.gif";
      
      wine_basics = new Image(140,11);
      wine_basics.src = root_path+"/images/nav_sub/wine_basics_sp.gif";
      
      wine_basics_over = new Image(140,11);
      wine_basics_over.src = root_path+"/images/nav_sub/wine_basics_over_sp.gif";
      
   }
   if (js_pathparts[2] == "recipes"){
      // RECIPES SUB-NAVIGATION PRELOADS

      featured_recipe = new Image(140,11);
      featured_recipe.src = root_path+"/images/nav_sub/featured_recipe_sp.gif";
      
      featured_recipe_over = new Image(140,11);
      featured_recipe_over.src = root_path+"/images/nav_sub/featured_recipe_over_sp.gif";
      
      recipe_search = new Image(140,11);
      recipe_search.src = root_path+"/images/nav_sub/recipe_search_sp.gif";
      
      recipe_search_over = new Image(140,11);
      recipe_search_over.src = root_path+"/images/nav_sub/recipe_search_over_sp.gif";
      
      demonstrations = new Image(140,11);
      demonstrations.src = root_path+"/images/nav_sub/demonstrations_sp.gif";
      
      demonstrations_over = new Image(140,11);
      demonstrations_over.src = root_path+"/images/nav_sub/demonstrations_over_sp.gif";


   }
   if (js_pathparts[2] == "company"){
      // COMPANY SUB-NAVIGATION PRELOADS

      our_story = new Image(140,11);
      our_story.src = root_path+"/images/nav_sub/our_story_sp.gif";

      our_story_over = new Image(140,11);
      our_story_over.src = root_path+"/images/nav_sub/our_story_over_sp.gif";

      principles_company = new Image(140,11);
      principles_company.src = root_path+"/images/nav_sub/principles_company_sp.gif";

      principles_company_over = new Image(140,11);
      principles_company_over.src = root_path+"/images/nav_sub/principles_company_over_sp.gif";

      diversity_company = new Image(140,11);
      diversity_company.src = root_path+"/images/nav_sub/diversity_company_sp.gif";
      
      diversity_company_over = new Image(140,11);
      diversity_company_over.src = root_path+"/images/nav_sub/diversity_company_over_sp.gif";

      employment = new Image(140,11);
      employment.src = root_path+"/images/nav_sub/employment_sp.gif";

      employment_over = new Image(140,11);
      employment_over.src = root_path+"/images/nav_sub/employment_over_sp.gif";

      community = new Image(140,11);
      community.src = root_path+"/images/nav_sub/community_sp.gif";

      community_over = new Image(140,11);
      community_over.src = root_path+"/images/nav_sub/community_over_sp.gif";

      press = new Image(140,11);
      press.src = root_path+"/images/nav_sub/press_sp.gif";

      press_over = new Image(140,11);
      press_over.src = root_path+"/images/nav_sub/press_over_sp.gif";

      investor_relations = new Image(140,11);
      investor_relations.src = root_path+"/images/nav_sub/investor_relations_sp.gif";

      investor_relations_over = new Image(140,11);
      investor_relations_over.src = root_path+"/images/nav_sub/investor_relations_over_sp.gif";

      contact_us = new Image(140,11);
      contact_us.src = root_path+"/images/nav_sub/contact_us_sp.gif";

      contact_us_over = new Image(140,11);
      contact_us_over.src = root_path+"/images/nav_sub/contact_us_over_sp.gif";
      
   }

   if (js_pathparts[2] == "employment"){
      // EMPLOYMENT SUB-NAVIGATION PRELOADS

      principles_employment = new Image(140,11);
      principles_employment.src = root_path+"/images/nav_sub/principles_employment_sp.gif";

      principles_employment_over = new Image(140,11);
      principles_employment_over.src = root_path+"/images/nav_sub/principles_employment_over_sp.gif";

      diversity_employment = new Image(140,11);
      diversity_employment.src = root_path+"/images/nav_sub/diversity_employment_sp.gif";

      diversity_employment_over = new Image(140,11);
      diversity_employment_over.src = root_path+"/images/nav_sub/diversity_employment_over_sp.gif";

      hourly = new Image(140,22);
      hourly.src = root_path+"/images/nav_sub/hourly_sp.gif";

      hourly_over = new Image(140,22);
      hourly_over.src = root_path+"/images/nav_sub/hourly_over_sp.gif";

      management = new Image(140,22);
      management.src = root_path+"/images/nav_sub/management_sp.gif";

      management_over = new Image(140,22);
      management_over.src = root_path+"/images/nav_sub/management_over_sp.gif";

      college = new Image(140,22);
      college.src = root_path+"/images/nav_sub/college_sp.gif";

      college_over = new Image(140,22);
      college_over.src = root_path+"/images/nav_sub/college_over_sp.gif";

      
   }


   if (js_pathparts[2] == "press"){
      // PRESS SUB-NAVIGATION PRELOADS

      news_releases = new Image(140,11);
      news_releases.src = root_path+"/images/nav_sub/news_releases_sp.gif";
      
      news_releases_over = new Image(140,11);
      news_releases_over.src = root_path+"/images/nav_sub/news_releases_over_sp.gif";
      
      espanol = new Image(140,11);
      espanol.src = root_path+"/images/nav_sub/espanol_sp.gif";
      
      espanol_over = new Image(140,11);
      espanol_over.src = root_path+"/images/nav_sub/espanol_over_sp.gif";
      
      fact_sheets = new Image(140,22);
      fact_sheets.src = root_path+"/images/nav_sub/fact_sheets_sp.gif";
      
      fact_sheets_over = new Image(140,22);
      fact_sheets_over.src = root_path+"/images/nav_sub/fact_sheets_over_sp.gif";

      awards = new Image(140,11);
      awards.src = root_path+"/images/nav_sub/awards_sp.gif";
      
      awards_over = new Image(140,11);
      awards_over.src = root_path+"/images/nav_sub/awards_over_sp.gif";

   }



   // END SUB-NAVIGATION PRELOADS

}




// Begin Rollover Highlight Function

function hiLite(imgDocID,imgObjName) {
   if( !document.images ) return;
   var sitenav_section = js_pathparts[2];
   if (sitenav_section == 'marketplace') sitenav_section = 'gift_card';
    if (sitenav_section == 'our_specials') sitenav_section = 'our_specials';
//      alert(imgDocID+","+imgObjName+","+js_pathparts[3]+","+imgObjName.indexOf('_on'));
   if ( (imgDocID == sitenav_section + '_button' || (imgDocID == js_pathparts[3] + '_button' && js_pathparts[3] != 'gift_card') )
        && imgObjName.indexOf('_on') == -1 && imgObjName.indexOf('_over') == -1) return;
   if (imgDocID == sitenav_section + '_button' && imgObjName.indexOf('_over') != -1) return;
   if (document.images[imgDocID]) document.images[imgDocID].src = eval(imgObjName + ".src")
}

// End Rollover Highlight Function



// Begin Navigation Initialization Functions (to highlight the page/section being viewed)

function initSiteNav() {
   var sitenav_section = js_pathparts[2];
   if (sitenav_section == 'marketplace') sitenav_section = 'gift_card';
   if (sitenav_section == 'our_specials') sitenav_section = 'our_specials';
   var section_button_name = sitenav_section+'_button';
   var section_button_on = sitenav_section+'_on';
   if (document.images[section_button_name] && section_button_name){
      hiLite(section_button_name,section_button_on);
   }
}

function initSubNav() {
   var subsection_button_name = js_pathparts[3]+'_button';
   var subsection_button_over = js_pathparts[3]+'_over';
   if (document.images[subsection_button_name] && subsection_button_over){
//      alert(subsection_button_name+","+subsection_button_over);
      hiLite(subsection_button_name,subsection_button_over);
   }
   var subsection_nav_div = js_pathparts[2] + "_" + js_pathparts[3];
   if (document.getElementById(subsection_nav_div)){
      document.getElementById(subsection_nav_div).style.display='block';
   }
   var page_link_div = js_pathparts[3] + "_" + js_pathparts[4];
   if (document.getElementById(page_link_div)){
      document.getElementById(page_link_div).className='og_subnav_on';
   }
}

// End Navigation Initialization Functions




// Begin Simple Field-Clearing Function

var cleared = 0;
function clearField(field){
   if (cleared != 1){   
      field.value = "";
      cleared=1;
   }
   else{
      cleared = 0;
   } 
}

// End Simple Field-Clearing Function




// Begin Popup

function loadPopup(url, xw, xh, name, scroll){

   // SPECIFY THE POPUP WINDOW NAME
   var win_popup_name = name;

   // SPECIFY URL OF MAIN POPUP WINDOW
   var win_popup_url = url;

   // SPECIFY THE WINDOW HEIGHT AND WIDTH
   var win_width = xw;
   var win_height = xh;

   // SPECIFY THE LOCATION OF THE TOP-LEFT CORNER OF THE WINDOW
   var win_left = (screen.width - win_width) / 2;
   var win_top = (screen.height - win_height) / 2;
   var popup_window = window.open(win_popup_url,win_popup_name,'width=' + win_width + ',height=' + win_height + ',top=' + win_top + ',left=' + win_left + ',directories=no,location=no,menubar=no,scrollbars=' + scroll + ',status=no,toolbar=no,resizable=no')
   popup_window.focus();
}

// End Popup


// Begin New Window (for adjusting top, left)

function newWin(n,wn,w,h,t,l,s) { 
	new_window=window.open(n, wn, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+s+',resizable=1,width='+w+',height=' + h + ((t)?',screenX='+t+',top='+t:'') + ((l)?',screenY='+l+',left='+l:'')); if (new_window.opener==null) { new_window.opener=self; } if (window.focus) new_window.focus(); 
}

// End New Window

//begin link back to main window

function linkBack(url){
   window.opener.location = url;
//  window.opener.focus();
   window.close();
}

//end link back to main window


// Begin Locator Tab 

function openLocator(layer_id){
  // alert(layer_id);
   document.getElementById(layer_id).style.overflow = 'visible';
}

function closeLocator(layer_id){
  // alert(layer_id);
   document.getElementById(layer_id).style.overflow = 'hidden';
}

// End Locator Tab




// Begin Show and Hide Layers

var layer_ids = new Array();
layer_ids[0] = "email_page";
layer_ids[1] = "locator_2";
layer_ids[2] = "locator_3";

function showLayer (layer_id) {
var z = 0;

  for (z = 0; z < 3; z ++) {

    if (layer_id == layer_ids[z]) {
    document.getElementById(layer_ids[z]).style.display='block';
    }
    
    else {
    document.getElementById(layer_ids[z]).style.display='none';
    }
  }
}

function hideLayer (layer_id) {
var z = 0;

  for (z = 0; z < 3; z ++) {

    if (layer_id == layer_ids[z]) {
    document.getElementById(layer_ids[z]).style.display='none';
    }
    
  }
}

// End Show and Hide layers




// Begin basic function for writing cookies

function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

// End basic function for writing cookies




// Begin Function(s) for Email This Page

function emailpage(fobj){
   document.getElementById('mail_friend_status').innerHTML = "";
   document.getElementById('mail_friend_status').innerHTML = "Enviando...";
   var emailFilter=/^.+@.+\..{2,3}$/;
   if (!(emailFilter.test(fobj.to.value)) || !(emailFilter.test(fobj.fromEmail.value))){
      document.getElementById('mail_friend_status').innerHTML = "";
      document.getElementById('mail_friend_status').innerHTML = "¡Error! Necesita introducir su email y el email de su amigo.";
   }
   else{
      var query = "";
      query += "fromName="+escape(fobj.fromName.value);
      query += "&fromEmail="+escape(fobj.fromEmail.value);
      query += "&to="+escape(fobj.to.value);
      query += "&subject="+escape(fobj.subject.value); 
      query += "&emailBody="+escape(fobj.intro_text.value+"\r\n\r\n"+fobj.message.value); 
      query += "&returnPageURL="+escape("http://www.olivegarden.com/");
      var methd = "POST";
      var url = "/server_scripts/email_page.asp";
      document.getElementById('mail_friend_status').innerHTML = "";
      document.getElementById('mail_friend_status').innerHTML = "Enviando...";
      sndReq(url, query, methd);
      //track email submission
      var s=s_gi(get_omni_account_number()); 
      s.linkTrackVars='eVar37,events'; 
      s.linkTrackEvents='event32';  
      s.events='event32'; 
      s.eVar37=window.document.location.pathname; 
      s.tl(this,'o',window.document.location.pathname);
   }
}




// Begin Functions For AJAX

function createRequestObject() {
   var ro;
   var browser = navigator.appName;
   if(browser == "Microsoft Internet Explorer"){
      ro = new ActiveXObject("Microsoft.XMLHTTP");
   }else{
      ro = new XMLHttpRequest();
   }
   return ro;
}

if( http && http.readyState ){
   http.abort( );
   http = false;
}

var http = createRequestObject();

function sndReq(url, query, method) {
   switch(method){
      case "POST":
         http.open(method, url, true);
         http.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
         http.setRequestHeader( 'Content-length', query.length );
         http.send(query);
         break;
      case "GET":
         url = url + "?" + query;
         http.open(method, url, true);
         http.send(null);
         break;
   }
   http.onreadystatechange = handleResponse;
}

function handleResponse() {
   if(http.readyState == 4){
      if (http.status == 200){
         var response = http.responseText;
//         document.getElementById('response').innerHTML = response;
//         document.getElementById('mail_friend_status').innerHTML = "Status: success (readystate=" + http.readyState + ")";
         document.getElementById('mail_friend_status').innerHTML = "";
         document.getElementById('mail_friend_status').innerHTML = "Email enviado a " + document.email_page.to.value + "!";
         document.email_page.to.value = ""
         document.email_page.toName.value = ""
      }
      else{
//         document.getElementById('mail_friend_status').innerHTML = " failed (status="+http.status+", readystate=" + http.readyState + ", statustext=" + http.statusText + ")";
         document.getElementById('mail_friend_status').innerHTML = "";
         document.getElementById('mail_friend_status').innerHTML = "¡Error!";
      }
   }
}

// End Functions For AJAX

// Uses the ParseUri function to get the hierarchy from the url for Omniture
// For Recipes and Menus, the path is used to display hierarchy.
// i.e www.olivegarden.com/menus/lunch/appetizers.asp
// /menus/lunch/appetizers is shown as the hierarchy
function get_omni_hier() {
    var hier="" ;
    var cat = get_omni_content_cat();
	parseUri.options.strictMode = true;
	var items = parseUri(location);	
	hier = new String(items.path);
	
	if(cat=="Recetas") {if(location.search.indexOf("category") !="-1") {if(items.queryKey["category"]!=""){hier=items.directory + items.queryKey["category"];}}}
	if(cat=="Nuestro Menu") {if(location.search.indexOf("server_path") !="-1") {if(items.queryKey["server_path"].length>0){hier=items.queryKey["server_path"];}}}	
	hier = hier.replace(".asp","");
	if(hier.substring(hier.length-1,hier.length)=="/"){hier=hier + "default";}
	if(hier.substring(0,1)=="/"){hier=hier.substring(1,hier.length);}
	return hier;
}

function parseUri (str) {
	var	o   = parseUri.options,
		m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
		uri = {},
		i   = 14;

	while (i--) uri[o.key[i]] = m[i] || "";

	uri[o.q.name] = {};
	uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
		if ($1) uri[o.q.name][$1] = $2;
	});

	return uri;
};

parseUri.options = {
	strictMode: false,
	key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
	q:   {
		name:   "queryKey",
		parser: /(?:^|&)([^&=]*)=?([^&]*)/g
	},
	parser: {
		strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
		loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
	}
};
