//var img = new Image();
//img.src = '../images/pizza.jpg';

	


//for menus page
//when the special of the day is pressed then the description is displayed.
function displaySpecialDietail(evt) {
	
	
	currentIndex = $(this).parent().parent().parent().text();
	//alert($(this).siblings('.nightlyspecials_description').css('display'));
    	//	alert(currentIndex + " xxx")
	//alert($('.specials_title').length)
	//alert($(this).parent().parent().index());//this gives me the index for that nightlyspecials element.
	//alert($('.nightlyspecials_description').length)
	var selected_special_index = $(this).parents('#specials-display').children('h3').index();

	if($(this).siblings('.nightlyspecials_description').css('display') === 'block') {
		$(this).siblings('.nightlyspecials_description').slideToggle('slow', function() {
		// Animation complete
		}); 
		return;
	}
	var theId = (evt) ? evt.target : window.event.srcElement;
	
	
	 $('.nightlyspecials_description').each(function(index) {
   			//alert($(this).css('display'));
   			var yaya = $(this).css('display');
   			//alert(index + " " + yaya + " "+selected_special_index );
   			if((selected_special_index !== index) && ($(this).css('display') === 'block') ) {
   				
   			//	alert(index + " " + yaya + " "+selected_special_index );
   				$(this).slideToggle('slow', function() {
				// Animation complete
				});
			
   			}
   			
   			
  		});
    	
    
    	$(this).siblings('.nightlyspecials_description').slideToggle('slow', function() {
		// Animation complete
		}); 	
    	
		
      
  
}




//function checks to see if the main-content-scroll is scrollable and is viewed by a iphone or ipod//
function mainContentScrollIOS() {

	//var test1 = jQuery('#main-content').height();
	if(!document.getElementById('main-content-scroll')){
		return;
	}
	
	
	
	var jq_main_content_scroll = jQuery('#main-content-scroll')
	var outerHeight= jq_main_content_scroll.height();
	var innerHeight =  document.getElementById('main-content-scroll').scrollHeight;
	var padding = 11; //5 px top and 5 at the bottom padding that we need to take into account or we will always get  innerHeight lr then outerHeight
	
	
		if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) ) {
		if((outerHeight + padding) > innerHeight){
		return;
		}
		
		jq_main_content_scroll.css('overflow','visible');
		jq_main_content_scroll.css('height','auto');
		jq_main_content_scroll.css("background-color", "white");
		//var newDiv = document.createElement("div");
				
		//newDiv.setAttribute("id","2finger");
		//newDiv.style.position="absolute";
		//newDiv.style.top="200px";
		//newDiv.style.left="180px";
		
		//newDiv.style.zIndex="9999";
		
		
		//var newDiv = document.getElementById("printable_menus");
		//newDiv.innerHTML = '<img src="../images/2fingerswipe_8bit.png">';
		
		// add the newly created element and it's content into the DOM
		// var my_div = document.getElementById("printable_menus");
		// document.body.insertBefore(newDiv, my_div);
		
		
		//document.getElementById('main-content').appendChild(newDiv); 
		
		//jQuery('#2finger').animate({opacity: 0.0}, 5000, function() {documentElement.removeChild(newDiv);}); //The callback function cancels out teh slide toggle function
		//jQuery('#2finger').animate({opacity: 0.0}, 4000);
	}


}

function initmycarousel(){

 var jq_mycarousel = jQuery('#mycarousel');
	
	
	 jq_mycarousel.css('visibility','show');
	 jq_mycarousel.css('visibility','visible');
    	jq_mycarousel.jcarousel({
        vertical: true,
        scroll: 2
    });
  
}


function dosomething(obj){
	
	var img_dir = obj.getElementsByTagName("img")[0].getAttribute("src");
	var img_description = obj.getElementsByTagName("span")[0].innerHTML;
	//alert(img_description);
		//alert(obj.getElementsByTagName("img")[0].getAttribute("src"));
		var a = img_dir.split("/");
		var a_length = a.length-1;
		var aa = a[a_length];
		//var img_change = document.getElementById("cookie_select").getElementsByTagName("img")[0].getAttribute("src") ;
		var img_change = document.getElementById("cookie_select").getElementsByTagName("img")[0];
		
		var description_change = document.getElementById('cookie_select_title').innerHTML = img_description;
		
		var img_change_src = img_change.getAttribute("src");
		var b = img_change_src.split("/");
		var b_length = b.length-1;
		var bb = b[b_length];
		img_change.setAttribute("src","../images/cookies/images/"+aa);	
		
		
		
		//alert(img_change);
}




