/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
	
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

 
function bookmarksiteie(title,url){
if(document.all)// ie
	window.external.AddFavorite(url, title);
}	



// Prego JS

$(document).ready(function(){
	if($(".hoursEnlarge").length) {
		$('.colorbox').colorbox({
			transition: 'elastic'
		});	
	}
	
	if($(".menuPDFs").length) {
		$('.colorboxIframe').colorbox({
			transition: 'elastic',
			iframe: true,
			width: '336',
			height: '500'
		});	
		
		$('a.menuButton').tooltip({
			 track: true, 
			delay: 0, 
			showURL: false, 
			showBody: " - ", 
			fade: 250 
		});
	}
	
	
	$("a.bookmark").click(function(e) {
                if ($.browser.opera == false) {
                        e.preventDefault();
                        var url = this.href;  
                        var title = this.title;

                        if ($.browser.mozilla == true) {
                                window.sidebar.addPanel(title, url, '');
                                return false;
                        } else if($.browser.msie == true) {  
                                window.external.AddFavorite( url, title);
                                return false;
                        } else {
                                alert('Please use CTRL + D to bookmark this website.');
                        }


    }
});
	
	
});

// Array clone function.

$(document).ready(function(){
if($("#banner").length) {
	
$(function () {
	$('#banner-images').empty().append('<img src="' + gallery.shift() + '" /><img src="' + gallery.shift() + '" />') // adding the last, first and second element of the array to the slideshow div, then start the cycle plugin.
	.cycle({
		startingSlide: 0,
		speed:  2500, 
		timeout: 5000,
		// this is required (1 is the 2nd slide) as the first slide is the last element of the array. if you use manual next/prev button clicking on #prev will show the first element.
		before: onBefore // loads the next image at the beginning of each slide. (NOT all at once)
		//next: "#next",
		//prev: "#prev"
	});
	var totalSlideCount = 2 + gallery.length;
	function onBefore(curr, next, opts, fwd){
		//console.log(gallery);
		// at first addSlide is not defined, so we should return.
	if (!opts.addSlide) return;
	
	// if all the elements of the array are added no need to add them again!
		if (opts.slideCount == totalSlideCount) return;
	// shift or pop from slide array
		var nextSlideSrc = fwd ? gallery.shift() : gallery.pop();
	// add next slide
		opts.addSlide('<img src="' + nextSlideSrc + '" />', fwd == false);
	}
});

	}
});

/*
// Array clone function.
Array.prototype.clone = function () {
	var arr = new Array();
	for (var property in this) {
		arr[property] = typeof(this[property]) == 'object' ? this[property].clone() : this[property];
	}
	return arr;
}
var gal = null; // gal should be global as I'll use it inside onBefore function
$(function () {
	gal = gallery.clone(); // cloning the array is not mandatory, but doing so will keep the main array unchanged.
	$('#banner-images').empty().append('<img src="' + gal.pop() + '" /><img src="' + gal.shift() + '" /><img src="' + gal.shift() + '" />') // adding the last, first and second element of the array to the slideshow div, then start the cycle plugin.
	.cycle({
		startingSlide: 1,
		// this is required (1 is the 2nd slide) as the first slide is the last element of the array. if you use manual next/prev button clicking on #prev will show the first element.
		before: onBefore, // loads the next image at the beginning of each slide. (NOT all at once)
		//next: "#next",
		//prev: "#prev"
	});
	var totalSlideCount = 1 + gal.length;
	function onBefore(curr, next, opts, fwd){
		// at first addSlide is not defined, so we should return.
	if (!opts.addSlide) return;
	// if all the elements of the array are added no need to add them again!
		if (opts.slideCount == totalSlideCount) return;
	// shift or pop from slide array
		var nextSlideSrc = fwd ? gal.shift() : gal.pop();
	// add next slide
		opts.addSlide('<img src="' + nextSlideSrc + '" />', fwd == false);
	}
});*/

