
document.observe('dom:loaded', applyPNGHacks);

function applyPNGHacks () {

  $$('h1.accordion_toggle').invoke('pngHack');
  $$('h1.accordion_toggle_active').invoke('pngHack');
  
  $$('.MainMenuLevel_1').invoke('pngHack');
  $$('.MainMenuLevel_1_Active').invoke('pngHack');
  
  //alert($$('h1.accordion_toggle'));
  
}
function chooseCountry(){
	Dialog.info($('chooseYourCountry_Window').innerHTML, {
		className: "alphacube",
		width: 917
	});	
}

function flashExpCamp(){
	Dialog.info($('Experiencia_Campero').innerHTML, {
		className: "alphacube",
		width: 673,
		height: 499
	});	
}

function showNutritionFacts(){
	Dialog.info($('showNutritinFactsWindowContainer').innerHTML, {
		className: "alphacube",
		width: 917
	});	
}
function showElement(element, tab){
	switch(element){
		case 'familias':
			$('showFam').removeClassName('showCase_nu');
			$('showFam').addClassName('showcaseActive');
			
			$('showProd').removeClassName('showcaseActive');
			$('showProd').addClassName('showCase_nu');
			
			$('showFamilies').style.display = 'block';
			$('showProducts_Nut_Calc').style.display = 'none';
			$('displayResponse').style.display = 'none';
			$('iFrame_displayResponse').src = '';
		break;
		case 'products':
			
			$('showFam').removeClassName('showcaseActive');
			$('showFam').addClassName('showCase_nu');
			
			$('showProd').removeClassName('showCase_nu');
			$('showProd').addClassName('showcaseActive');
			
			$('showFamilies').style.display = 'none';
			$('displayResponse').style.display = 'none';
			$('showProducts_Nut_Calc').style.display = 'block';
			$('iFrame_displayResponse').src = '';
		break;
	}
}
function callResponse(id, element){
	switch(element){
		case 'combos':
			$('iFrame_displayResponse').src = '';			
			$('showProducts_Nut_Calc').style.display = 'none';
			$('showFamilies').style.display = 'none';			
			$('displayResponse').style.display = 'block';
			$('iFrame_displayResponse').src = './lib/php/NutritionFactsResponse.php?action=combos&id_cat='+id;			
		break;
		
		case 'products_in_combo':		
			$('iFrame_displayResponse').src = '';			
			$('showProducts_Nut_Calc').style.display = 'none';
			$('showFamilies').style.display = 'none';			
			$('displayResponse').style.display = 'block';
			$('iFrame_displayResponse').src = './lib/php/NutritionFactsResponse.php?action=products_in_combo&id_combo='+id;			
		break;
	}
}
function addMoreProducts(action, id_combo){
	$('showFam').removeClassName('showcaseActive');
	$('showFam').addClassName('showCase_nu');
	
	$('showProd').removeClassName('showCase_nu');
	$('showProd').addClassName('showcaseActive');
	
	$('iFrame_displayResponse').src = './lib/php/showProducts.php?action='+action+'&id_combo='+id_combo;
}
function chooseFranchises(){
	Dialog.info($('chooseYourFranchises_Window').innerHTML, {
		className: "alphacube",
		width: 917
	});	
}
function chooseRestaurants(){
	Dialog.info($('chooseYourRestaurants_Window').innerHTML, {
		className: "alphacube",
		width: 917
	});	
}
function chooseContactPage(){
	Dialog.info($('chooseYourContact_Window').innerHTML, {
		className: "alphacube",
		width: 917
	});	
}
function goToFranchise(v,m){
	//(!v)?alert(m):window.location=v;
	var aryCountry = v.split('|');
	var url = aryCountry[0];
	var country = aryCountry[1];
	var cached = aryCountry[2];
	(!url)?alert(m):window.location=url+'&country='+country+'&cached='+cached;
}
function goToRestaurant(v,m){
	var aryCountry = v.split('|');
	var url = aryCountry[0];
	var country = aryCountry[1];
	var cached = aryCountry[2];
	(!url)?alert(m):window.location=url+'&country='+country+'&cached='+cached;	
}
function closeAllModalWindows() {
	Windows.closeAllModalWindows();
	return true;
}
function closeWindows(){
	Windows.closeAll();
}
function goToCountry(url){
	window.location = url;
}
