$(document).ready(function(){

$("div.scrollable").scrollable({ 
        size: 1, 
        items: '#thumbs',   
        hoverClass: 'hover',
		next: '.next', 
		prev: '.prev' 
});     

$('a[rel*=facebox]').facebox()
$("a[rel^='prettyPhoto']").prettyPhoto();
$('.show-hide .staff_photos img').click(function(){
	$('.show-hide .staff_photos div').hide();
	$('.show-hide .staff_photos').addClass('hidden');
	$(this).parent('div').removeClass('hidden').addClass('visible');
	$(this).siblings('div').fadeIn('slow');
	$('.show-hide .staff_photos img').show();
});
$('.staff_close').click(function(){
	$('.show-hide .staff_photos div').fadeOut('slow');
	$('.show-hide .staff_photos').removeClass('hidden').removeClass('visible');
	return false;
});



});


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

/* var Accordion = new Class({
	initialize: function(stretcher, tab) {
		var stretchers = document.getElementsByClassName(stretcher);
		var toggles = document.getElementsByClassName(tab);
		var myAccordion = new fx.Accordion(toggles, stretchers);
	}
});
function startAccordion(){
		var acc = new Accordion('stretcher', 'tab');
}
*/
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
 //Sort Functionality
function SetDivPosition()
{
    /*
    //var intY = document.getElementById("grdWithScroll").scrollTop;
    var scrOfX = 0, scrOfY = 0;

    if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }
    //return [ scrOfX, scrOfY ];
    //alert(scrOfY);
    //var intY = document.body.scrollTop;
    //document.title = scrOfY;
    document.cookie = "yPos=!~" + scrOfY + "~!";
    */
}


		var date_arr = new Array;
        date_arr[1]=new Option("January");
        date_arr[2]=new Option("February");
        date_arr[3]=new Option("March");
        date_arr[4]=new Option("April");
        date_arr[5]=new Option("May");
        date_arr[6]=new Option("June");
        date_arr[7]=new Option("July");
        date_arr[8]=new Option("August");
        date_arr[9]=new Option("September");
        date_arr[10]=new Option("October");
        date_arr[11]=new Option("November");
        date_arr[12]=new Option("December");

//Search Submit Function
function fnRedirect()
       {
            //alert("All Travel");
            //alert(document.aspnetForm.pulldown.value);
            var querySearch = document.aspnetForm.pulldown.value;
            var queryDate = document.aspnetForm.search_date.value;
            //var queryMonth = document.aspnetForm.months.value;
            //var queryYear = document.aspnetForm.years.value;
            
            var queryActivity = 'all'; //document.aspnetForm.ctl00$TopLeftAd$SearchSignature$activity.value;
            
            //alert(document.aspnetForm.activity);
            if (typeof document.aspnetForm.activity != "undefined")
            {
				queryActivity = document.aspnetForm.activity.value;
            }
            
            //queryDate = queryYear + "-" + queryMonth;
            //location.href='/showdestinationresults?dest_name=' + querySearch + "&search_date=" + queryDate + "&activity_search=" + queryActivity;
            location.href='/showdestinationresults?dest_name=' + querySearch + "&search_date=" + queryDate + "&activity_search=" + queryActivity;
        }  

//positioning for pagin of results
function startGridscroll() {
	/*
    if(document.getElementById("grdWithScroll")) {
        var strCook = document.cookie;
        if(strCook.indexOf("!~")!=0){
            var intS = strCook.indexOf("!~");
            var intE = strCook.indexOf("~!");
            var strPos = strCook.substring(intS+2,intE);
            document.getElementById("grdWithScroll").scrollTop = strPos;
        }
        //alert(strPos);
        window.scrollTo(0,strPos);
    }
    */
}


window.onload = function() {

if (!document.getElementsByTagName) {
		return false; 
	} 
	// create an array of objects of each link in the document 
	var popuplinks = document.getElementsByTagName("a");
	// loop through each of these links (anchor tags) 	
	for (var i=0; i < popuplinks.length; i++) {	
		// if the link has a class of "popup"...	
		if (popuplinks[i].getAttribute("class") == "pop800") {	
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			pop800(this.getAttribute("href"));	
			return false; 	
			} 	
		} else if (popuplinks[i].getAttribute("class") == "pop700") {	
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			pop700(this.getAttribute("href"));	
			return false; 	
			} 	
		} else
		if (popuplinks[i].getAttribute("class") == "pop600") {	
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			pop600(this.getAttribute("href"));	
			return false; 	
			} 	
		} else 
		if (popuplinks[i].getAttribute("class") == "pop500") {	
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			pop500(this.getAttribute("href"));	
			return false; 	
			} 	
		}
	} 
} 

function pop800(linkURL) {
window.open(linkURL,'popup','width=820,height=750,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=no')
}
function pop700(linkURL) {
window.open(linkURL,'popup','width=700,height=700,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=no')
}
function pop600(linkURL) {
window.open(linkURL,'popup','width=600,height=500,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=no')
}
function pop500(linkURL) {
window.open(linkURL,'popup','width=500,height=500,left=0,right=0,toolbar=no,scrollbars=no,location=0,resizable=no')
}



function openWin(url, name) {
popupWin = window.open(url, name, "width=425,height=500,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=no");
}
function openWin1(url, name) {
popupWin = window.open(url, name, "width=725,height=750,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=yes");
}
function openWin2(url, name) {
popupWin = window.open(url, name, "width=285,height=450,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=no");
}
function openWin3(url, name) {
popupWin = window.open(url, name, "width=700,height=650,left=0,right=0,toolbar=no,scrollbars=yes,location=0,resizable=yes");
}
function openWinCal(url, name) {
popupWin = window.open(url, name, "width=210,height=185,left=20,right=20,toolbar=no,scrollbars=no,location=0,resizable=no");
}
function openVideo1(url, name) {
popupWin = window.open(url, name, "width=530,height=700,left=20,right=20,toolbar=no,scrollbars=yes,location=0,resizable=yes");
}


//////////////////////////////////////////////////////////////
///<summary>
/// Function to load the slideshow on the front end.
///</summary>
///<param name="sDN">The DN of the page we are opening as a slide show</param>
function openSlide(sDN)
{
	var sScript = "/SlideShow.aspx"
	
	window.open(sScript+"?DN="+sDN,"_blank","menubar=0,toolbar=0,location=0,directories=0,status=no,scrollbars=1,resizable=0,width=660px,height=600px,center=1")
	
} //openSlide	

///<summary>
/// Function to set the class on a tr based on even or odd
///</summary>
///<param name="trId">The id of the tr we are setting the class on</param>
var iCounter = 0;
function trClassSet(trId)
{
    iCounter++;
    document.getElementById(trId).className += iCounter % 2 == 0 ? "even" : "odd";
} //trClassSet


// VRX Initialize 

	function launchMexico() {
		var w = screen.width;
		var winwidth;
		var winurl;
		if (w >= 1000) {
				winwidth=880
				winurl = 'http://delivery.vrxstudios.com/destinations/vrxfullviewer.asp?ident=AA2027-546';
			}
		else 		{
				winwidth=546
				winurl = 'http://delivery.vrxstudios.com/destinations/vrxmap.asp?ident=AA2027-546';
			}
		var win = window.open(winurl,'vrxmap','width=' + winwidth + ',height=610,top=5,left=5,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
		win.focus();
		}


	function launchHawaii() {
		var w = screen.width;
		var winwidth;
		var winurl;
		if (w >= 1000) {
				winwidth=880
				winurl = 'http://delivery.vrxstudios.com/destinations/vrxfullviewer.asp?ident=AA2027-383';
			}
		else 		{
				winwidth=546
				winurl = 'http://delivery.vrxstudios.com/destinations/vrxmap.asp?ident=AA2027-383';
			}
		var win = window.open(winurl,'vrxmap','width=' + winwidth + ',height=610,top=5,left=5,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
		win.focus();
		}


	function launchCaribbean() {
		var w = screen.width;
		var winwidth;
		var winurl;
		if (w >= 1000) {
				winwidth=880
				winurl = 'http://delivery.vrxstudios.com/destinations/vrxfullviewer.asp?ident=AA2027-459';
			}
		else 		{
				winwidth=546
				winurl = 'http://delivery.vrxstudios.com/destinations/vrxmap.asp?ident=AA2027-459';
			}
		var win = window.open(winurl,'vrxmap','width=' + winwidth + ',height=610,top=5,left=5,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
		win.focus();
		}


/*function myLoads() {
  startAccordion();
  //startGridscroll();
}
addLoadEvent(myLoads);*/