//hide & show the flourish graphics
function flourish() {
	//show or hide the flourish depending on minimum width and height requirements.
	var bWidth = document.body.offsetWidth;
	if( $('flourish') ){
		var fHeight = $('flourish').offsetHeight;
		if(bWidth > 1200 && fHeight > 665) { $('flourish').className="flourish_on" }
		if(bWidth < 1200) { $('flourish').className="x" }
	}
}

function xxx(eve){
    var evt = eve?eve:event;
    alert(evt.srcElement.id);
}
//olivia google search functionality

//use searchType variable to determine search parameter
var searchType = 1
function searchSwitch(type,path,inputHiddenID,searchCategoryID) {
	if(type == 1) {
		$('searchRadio1').src=path + "photo/radio_on.gif"; 
		$('searchRadio2').src=path + "photo/radio_off.gif";
		$(searchCategoryID).disabled=false; 
    $(inputHiddenID).value = "1";
    searchType = 1;
	} else {
		$('searchRadio1').src=path + "photo/radio_off.gif";
		$('searchRadio2').src=path + "photo/radio_on.gif";	
		$(searchCategoryID).disabled=true;
    $(inputHiddenID).value = "2";
    searchType = 2;
	}

}

//swap column 1 group & blog content
var oldGroup = 1;
var oldGroupNum = 1;
var oldBlog = 1;
var oldBlogNum = 1;
var oldSlide = 1;
var oldSlideNum = 1;

function changeNo(type,num) {
	if(type == "groups") {
	    if(num != oldGroup){
		    //show content
		    Element.show("col1_featured_group"+num);
		    Element.hide("col1_featured_group"+oldGroup);
		    //change #
		    $('groupNumber'+num).className = 'col1_numbers_selected';
		    $('groupNumber'+oldGroup).className = '';
		    oldGroup = num
		}
	}
	if(type == "blogs" || type == "voices") {
	    if(num != oldBlog){
		    //show content
		    Element.show("ctl00_ctl00_bcr_HomeFeaturedVoices___col1_featured_blog"+num);
		    Element.hide("ctl00_ctl00_bcr_HomeFeaturedVoices___col1_featured_blog"+oldBlog);
		    //change #
		    $('blogNumber'+num).className = 'col1_numbers_selected';
		    $('blogNumber'+oldBlog).className = '';
		    oldBlog = num
		}
	}
	if(type == "slides") {
	    if(num != oldSlide){
		    //show content
		    Element.show("col2_slide"+num);
		    Element.hide("col2_slide"+oldSlide);
		    //change #
		    $('slideNumber'+num).className = 'col2_numbers_selected';
		    $('slideNumber'+oldSlide).className = '';
		    oldSlide = num
		}
	}	
}

//meet new members functionality
var _memberNo = "";
function showMember(memberNo,showInfo) {
    $("fMemberDetails").style.display = "block";
	_memberNo = memberNo;
		var a, b
	a = $('fMemberDetailsImg'+memberNo)
	b = $('fMemberDetails')
	b.style.top = findPosY(a)+ a.height-20 +"px"
	b.style.left = findPosX(a)-10 +"px"
	var div = $('fMemberDetailsBox').getElementsByTagName('span');
	var info = new Array();
	info = showInfo.split("|");	
	$(div[0].id).innerHTML = info[0];
	$(div[1].id).innerHTML = info[1];
	$(div[2].id).innerHTML = info[2];	
	if(info.length >= 4)	
	    $(div[3].id).innerHTML = info[3];
	if(info.length >= 5)	    
	    $(div[4].id).innerHTML = info[4];
}
function hideMember(memberNo) {
	 $("fMemberDetails").style.display = "none";
}
function holdme(){
	var a, b
	a = $('fMemberDetailsImg'+_memberNo)
	b = $('fMemberDetails')
	b.style.top = findPosY(a)+a.height-20 +"px"
	b.style.left = findPosX(a)-10 +"px"
	b.style.display = "block";
}
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x){
		curleft += obj.x;
	}
	return curleft;
}
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}else if (obj.y){
		curtop += obj.y;
	}
		
	return curtop;
}
function OnMouseOver(self)
{
  self.className="avatar_image_on";
}
function OnMouseOut(self)
{
  self.className="avatar_image_off";
}

//switch tabs in column 2 advice/poll
function adviceSwitch(tab) {
	if(tab == 1) {
		$('tabPoll').src= 'photo/tab_dailypoll.gif'; $('tabAdvice').src='photo/tab_advice_off.gif'
		Element.show('col2_poll'); 
		Element.hide('col2_advice'); 
		}
	if(tab == 2) {
		$('tabPoll').src= 'photo/tab_dailypoll_off.gif'; $('tabAdvice').src='photo/tab_advice.gif'
		Element.hide('col2_poll'); 
		Element.show('col2_advice'); 
		}
}

//hide & show profile content
function profileHideShow(profileBox) {
	Element.toggle('profileContainer'+profileBox);
	if($('profileContainer'+profileBox).style.display == "none") { 
		$('profileBtn'+profileBox).src="img/modules/btn_plus.gif"
		} else { 
		$('profileBtn'+profileBox).src="img/modules/btn_minus.gif"
	}
}

//add by yelin 20061230 begin
function switchTab(Tabpage,Tabid){
	var oItem = document.getElementById(Tabpage);  
		 
	for(var i=0;i<oItem.childNodes.length;i++){
		var x = oItem.childNodes[i];	
		x.className = "";
//		var y = x.getElementsByTagName('a');
	}	
	document.getElementById(Tabid).className = "Selected";
	
	var cnt = document.getElementById("cnt");
	for (var j=0;j<cnt.childNodes.length;j++)
	{
		var t = cnt.childNodes[j];
		if(t.id){
			if(t.id==('d'+Tabid))
				t.style.display = 'block';
			else
				t.style.display = 'none';
		}
	}
}

// Trip Map Functions
var currentWindow = 0;
var currentDot = 0;
var currentType = 0;

function tmShowDot (win,type){
	cDot = "tmDest"+win;
	cType  = 'url(../themes/travel/img/modules/points_off_'+type+'.gif)';
	$(cDot).style.backgroundImage = 'url(../themes/travel/img/modules/points_on_'+type+'.gif)';
	currentDot = cDot;
	currentType = cType;
}
function tmHideDot (){
	$(currentDot).style.backgroundImage = currentType;
	currentDot = 0;
	currentType = 0;
}

function tmShowWindow(win,type) { 
	cWin = "tmWin"+win;
	if(currentWindow != cWin) {
		if(currentWindow != 0) { 
			new Effect.Fade(currentWindow, { duration: 1.0 });
		}
		new Effect.Appear(cWin, { duration: 1.0 });
		currentWindow = cWin;
 	}
}
	
function tmCloseWindow() { 
	new Effect.Fade(currentWindow, { duration: 1.0 });
	currentWindow = 0;
}

//trip calendar
var currentTripStep = 1;

function showTrip(step,urlStr) {
	if(step != currentTripStep) {
		//change tab styles
		$('TripTab'+step).className = 'tc_container_selected';
		$('TripTab'+currentTripStep).className = '';
		//load iframe using urlStr variable
		$('tcIframe').src = urlStr;
		//set current tab #
		currentTripStep = step;
	}
}
//trip calendar
var currentTripStep2 = 1;
var currentDiv;

function showTrip2(step,divID) {

	if(step != currentTripStep2) {
		//change tab styles
		$('TripTab'+step).className = 'tc_container_selected';
		$('TripTab'+currentTripStep2).className = '';
		//load iframe using urlStr variable
		var cont=$(divID);
		if(currentDiv==null)
		  currentDiv=$("ULCruises");
		if(currentDiv!=null)
		{
		    currentDiv.style.display="none";
		    }
	    cont.style.display="block";
	    currentDiv=cont;
		//set current tab #
		currentTripStep2 = step;
	}
}

var currentItineraryStep2 = 1;
var currenttab=null;

function SwitchTripTab(currentElm) {
	if (!currenttab) {
		currenttab = document.getElementById('itineraryTab' + document.aspnetForm.FormData_TabSelected.value);
	}
	currenttab.className='';
	currenttab=currentElm.parentNode;
	currentElm.parentNode.className='multicolItineraryTab';
}

function showItinerary(step,urlStr) {
	if(step != currentItineraryStep2) {
	//debugger
		//change tab styles
		$('itineraryTab'+step).className = 'multicolItineraryTab';
		$('itineraryTab'+currentItineraryStep2).className = '';
		
		//load iframe using urlStr variable
		if(urlStr!=null){  // made second argument optional
		  window.frames['multicolItineraryIframe'].location.href=urlStr;
		}
		//set current tab #
		currentItineraryStep2 = step;
	}
}
