/* GENERAL SETTINGS */
//var ROOT_URL = 'http://www.rinhotels.dev/';
var ROOT_URL = 'http://www.rinhotels.ro/';
var AJAX_PHP_URL = ROOT_URL + '&resources/ajax/';

/* SHOWCASE SETTINGS */
var presentationSelected = 1;
var presentationLastSelected = 0;
var autoSwitch = 1;
var autoSwitchOff = 0;
var switchSpeed = 5000;
var showcaseTimeout = null;

function checkLightbox() {
	LightboxOptions.fileBottomNavCloseImage = '&resources/img/misc/lightbox/ro/closelabel.gif';
}

function hoverObject(obj) {

	if (obj.className.indexOf('hovered') == -1) obj.className += ' hovered';
	else obj.className = obj.className.replace("hovered", "");

}

function reloadWithoutTarget() {

	var loc = document.location.href.split("#");
	document.location.href = loc[0];

}

function reloadWithTarget() {
	var curUrl = document.location.href;
	document.location.href = curUrl;
}

function emptyInput(obj) {obj.value = '';}

function showcaseNavigation(imgObjId, mode, prefix, limit) {

	if (mode != 'previous' && mode != 'next' || parseInt(limit) == 0) return false;
	var imgObj = document.getElementById(imgObjId);
	var current_position = parseInt(imgObj.alt);
	if (mode == 'previous') {
		if (current_position == 1) var next_position = limit;
		else var next_position = current_position-1;
	}
	if (mode == 'next') {
		if (current_position == limit) var next_position = 1;
		else var next_position = current_position+1;
	}

	new Effect.Fade(imgObj, {
		duration: 1.0,
		//transition: Effect.Transitions.linear,
		afterFinish: function() {
			imgObj.alt = next_position;
			imgObj.src = imgObj.src.replace(prefix+current_position, prefix+next_position);
			imgObj.appear({ delay: 0, duration: 3});
		}
	});

}

function toggleFeature(triggerObj,effectDuration) {

	var parent = triggerObj.parentNode;
	var divs = parent.getElementsByTagName('div');
	var divs_no = divs.length;
	if (divs_no == 0) return false;
	var cdiv = -1;
	for (var i = 0; i < divs_no; i++) {
		if (divs[i].className.indexOf('container') != -1) var cdiv = divs[i];
	}
	if (cdiv == -1) return false;

	if (effectDuration == null) {
		effectDuration = 1.5;
	}

	if (parent.className.indexOf('closed') != -1) {
		new Effect.BlindDown(cdiv, {
			duration: effectDuration,
			scaleFrom: 0,
			scaleTo: 100,
			scaleX: false,
			beforeStart: function() {
				parent.className = parent.className.replace("closed", "open");
				cdiv.style.display = 'none';
			}
		});
	}
	else {
		cdiv.style.display = 'block';
		new Effect.BlindUp(cdiv, {
			duration: 1.5,
			scaleFrom: 100,
			scaleTo: 0,
			scaleX: false,
			afterFinish: function() { parent.className = parent.className.replace("open", "closed");}
		});
	}

}

function emulateSelectBehaviour(triggerObj, code) {

	var uls = triggerObj.parentNode.getElementsByTagName('ul');
	var uls_no = uls.length;
	if (uls_no == 0) return false;

	if (uls[0].style.display == 'none' || uls[0].style.display == '') uls[0].style.display = 'block';
	else uls[0].style.display = 'none';

}

function emulateOptionBehaviour(opt, code) {
	var selected_index = opt.id.replace(code, "");
	var triggerObj = document.getElementById(code+"Trigger");
	var hinput = document.getElementById(code+"Selected");
	var url = AJAX_PHP_URL+"controller.php";
	var pars = "action=getActionUrls&hid="+parseInt(selected_index);
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: pars,
			onSuccess: function(transport) {
				var tempResponse = transport.responseText.split("|||");
				var uls = opt.parentNode.parentNode.parentNode.getElementsByTagName('ul');
				var uls_no = uls.length;
				if (uls_no == 0) return false;
				for (var i = 0; i < uls_no; i++) {
					if (uls[i].className.indexOf('actions') != -1) {
						var lis = uls[i].getElementsByTagName('li');
						var lis_no = lis.length;
						if (lis_no == 0) return false;
						for (var j = 0; j < lis_no; j++) {
							if (lis[j].className.indexOf('details') != -1) {
								var as = lis[j].getElementsByTagName('a');
								var as_no = as.length;
								if (as_no == 0) return false;
								as[0].onclick = function() {};
								as[0].href = tempResponse[0];
							}
							if (lis[j].className.indexOf('reserve') != -1) {
								var as = lis[j].getElementsByTagName('a');
								var as_no = as.length;
								if (as_no == 0) return false;
								as[0].onclick = function() {};
								as[0].href = tempResponse[1];
							}
						}
					}
				}
				hinput.value = selected_index;
				triggerObj.innerHTML = opt.innerHTML;
				emulateSelectBehaviour(triggerObj, code);
			}
		}
	);

}

function emulateOptionBehaviourEn(opt, code) {
	var selected_index = opt.id.replace(code, "");
	var triggerObj = document.getElementById(code+"Trigger");
	var hinput = document.getElementById(code+"Selected");
	var url = AJAX_PHP_URL+"controller.php";
	var pars = "action=getActionUrlsEn&hid="+parseInt(selected_index);
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: pars,
			onSuccess: function(transport) {
				var tempResponse = transport.responseText.split("|||");
				var uls = opt.parentNode.parentNode.parentNode.getElementsByTagName('ul');
				var uls_no = uls.length;
				if (uls_no == 0) return false;
				for (var i = 0; i < uls_no; i++) {
					if (uls[i].className.indexOf('actions') != -1) {
						var lis = uls[i].getElementsByTagName('li');
						var lis_no = lis.length;
						if (lis_no == 0) return false;
						for (var j = 0; j < lis_no; j++) {
							if (lis[j].className.indexOf('details') != -1) {
								var as = lis[j].getElementsByTagName('a');
								var as_no = as.length;
								if (as_no == 0) return false;
								as[0].onclick = function() {};
								as[0].href = tempResponse[0];
							}
							if (lis[j].className.indexOf('reserve') != -1) {
								var as = lis[j].getElementsByTagName('a');
								var as_no = as.length;
								if (as_no == 0) return false;
								as[0].onclick = function() {};
								as[0].href = tempResponse[1];
							}
						}
					}
				}
				hinput.value = selected_index;
				triggerObj.innerHTML = opt.innerHTML;
				emulateSelectBehaviour(triggerObj, code);
			}
		}
	);

}

function checkHotelSelected() { alert('Selectaţi hotelul dorit.'); return false;}
function checkHotelSelectedEn() { alert('Selectaţi hotelul dorit.'); return false;}

function presentationSwitchFocus(limit, oldindex, newindex, context) {

	if (window.autoSwitchOff == 1) return false;

	if ((window.autoSwitch == 1 && context == 1) || (window.autoSwitch == 0 && context == 0)) {

		var lis = document.getElementById("sidebar").getElementsByTagName('li');
		var lis_no = lis.length;
		if (lis_no == 0) return false;
		for (var i = 0; i < lis_no; i++) {
			if (lis[i].parentNode.className == 'secondary navigation') lis[i].className = lis[i].className.replace("selected", "");
		}

		if (oldindex != 0) {
			var oldpresentation = document.getElementById("showcaseContainer"+oldindex);
			oldpresentation.style.display = 'none';
		}
		else {
			for (var i = 1; i <= limit; i++) document.getElementById('showcaseContainer'+i).style.display = 'none';
		}
		var newtrigger = document.getElementById("showcaseTrigger"+newindex);
		var newpresentation = document.getElementById("showcaseContainer"+newindex);

		window.presentationSelected = newindex;
		if (window.presentationSelected != limit) var nextidx = parseInt(parseInt(window.presentationSelected)+1);
		else var nextidx = 1;

		newtrigger.className += "selected";
		newpresentation.style.display = 'block';

		if (context == 1)
		{
			if(showcaseTimeout) window.clearTimeout(showcaseTimeout);
			showcaseTimeout = window.setTimeout("presentationSwitchFocus("+limit+", "+window.presentationSelected+", "+nextidx+", "+context+")", window.switchSpeed);
		}

	}

}

function autoSwitchValue(value, limit) {

	window.autoSwitch = parseInt(value);
	if (value == 1) switchPresentation(limit, 1, 0);

}

function selectThisPresentation(tObj, limit, mode) {

	if (window.autoSwitchOff == 1) return false;

	var curidx = parseInt(tObj.id.replace("showcaseTrigger", ""));

	if (mode == 0) {

		autoSwitchValue(1, 3);
		tObj.className = tObj.className.replace("selected", "");
		document.getElementById("showcaseContainer"+curidx).style.display = 'none';

		var check_displayed = 0;
		for (var i = 1; i <= limit; i++) {
			if (getStyle(document.getElementById('showcaseContainer'+i), 'display') == 'block') check_displayed++;
		}

		if (check_displayed == 0) {
			var thisTrigger = document.getElementById('showcaseTrigger'+curidx);
			selectThisPresentation(thisTrigger, limit, 1);
			//switchPresentation(limit, 1, 0);
		}

//		window.autoSwitchOff = 1;

		return true;

	}

	autoSwitchValue(0, 3);
	var curPresentation = document.getElementById("showcaseContainer"+curidx);
	var lis = document.getElementById("sidebar").getElementsByTagName('li');
	var lis_no = lis.length;
	if (lis_no == 0) return false;
	for (var i = 0; i < lis_no; i++) {
		if (lis[i].parentNode.className == 'secondary navigation') lis[i].className = lis[i].className.replace("selected", "");
	}

	for (var i = 1; i <= limit; i++) document.getElementById('showcaseContainer'+i).style.display = 'none';

	tObj.className += "selected";
	curPresentation.style.display = 'block';
	window.presentationSelected = curidx;

}

function switchPresentation(limit, context, tObj) {

	if (window.autoSwitchOff == 1) return false;

	var curTab = document.getElementById("showcaseTrigger"+window.presentationSelected);
	var curContentArea = document.getElementById("showcaseContainer"+window.presentationSelected);
	if (window.presentationSelected != limit) var nextidx = parseInt(parseInt(window.presentationSelected)+1);
	else var nextidx = 1;
	var previousidx = window.presentationSelected;
	if (tObj != 0) {
		autoSwitchValue(0);
		var nextidx = parseInt(tObj.id.replace("showcaseTrigger", ""));
		var previousidx = 0;
	}

	window.autoSwitch = context;
	if (window.autoSwitch == 1) {
		if(showcaseTimeout) window.clearTimeout(showcaseTimeout);
		showcaseTimeout = window.setTimeout("presentationSwitchFocus(" + limit + ", " + previousidx + ", " + nextidx + ", " + context + ")", window.switchSpeed);
	}
	else {
		presentationSwitchFocus(limit, window.presentationSelected, nextidx, 0);
	}

}

function openMailAddress(obj) {

	var url = AJAX_PHP_URL+"controller.php";
	var pars = "action=openMailAddress&addr="+obj.innerHTML;
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: pars,
			onSuccess: function(transport) {
				obj.href = 'mailto:'+transport.responseText;
				document.location.href = 'mailto:'+transport.responseText;
			}
		}
	);

}







function getStyle(x,styleProp) {

	if (x.currentStyle) var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;

}

function getPixelFontSize(dEl){

	if(typeof( dEl ) == 'string') dEl = document.getElementById(dEl);
	if(!dEl || !dEl.tagName) return null;
	var nPx , dCurStyle ;


    if (typeof document.defaultView != "undefined" && typeof document.defaultView.getComputedStyle != "undefined"){
		var dCurStyle = document.defaultView.getComputedStyle(dEl, "");
		nPx = parseInt(  dCurStyle.getPropertyValue("font-size") ,  10 );

	}else{

		//For IE

		dCurStyle  = dEl.currentStyle ;
		if( dCurStyle ){

			var sOldLeft = dEl.style.left;
			dEl.style.left = '10em';
			nPx = Math.round( dEl.style.pixelLeft / 10 );
			dEl.style.left = sOldLeft;
		}
	};

	return nPx;
}

function textResize(obj) {

	if (obj.className != 'plus' && obj.className != 'minus') return false;
	var bodyDiv = document.getElementById('body');
	var ps = bodyDiv.getElementsByTagName('p');
	var ps_no = ps.length;
	var lis = bodyDiv.getElementsByTagName('li');
	var lis_no = lis.length;
	if ((ps_no + lis_no) < 1) return false;

	if (obj.className == 'plus') {
		for (var i = 0; i < ps_no; i++) {
			var fontsize = getPixelFontSize(ps[i]);
			if (fontsize < 24) ps[i].style.fontSize = (parseInt(fontsize)+1)+"px";
		}

		for (var j = 0; j < lis_no; j++) {
			var fontsize = getPixelFontSize(lis[j]);
			if (fontsize < 24) lis[j].style.fontSize = (parseInt(fontsize)+1)+"px";
		}
	}
	else {
		for (var i = 0; i < ps_no; i++) {
			var fontsize = getPixelFontSize(ps[i]);
			if (fontsize > 11) ps[i].style.fontSize = (parseInt(fontsize)-1)+"px";
		}

		for (var j = 0; j < lis_no; j++) {
			var fontsize = getPixelFontSize(lis[j]);
			if (fontsize > 11) lis[j].style.fontSize = (parseInt(fontsize)-1)+"px";
		}
	}

}

function addToFavorites(urlAddress,pageName) {

	if (urlAddress == '') urlAddress = document.location.href;
	if (pageName == '') pageName = document.title;

	if (window.external) {
		window.external.AddFavorite(urlAddress,pageName)
	}

}





var currentCategory = null;
var currentPage = 0;
var currentHotel = null;

function switchCategory(generator, category)
{
	for(var x = 0; x < $$('.folders').length; x++)
	{
		var allCats = $$('.folders')[x].childElements();

		for(var i = 0; i < allCats.length; i++)
		{
			if (allCats[i] == generator || $$('.folders')[x == 0 ? 1 : 0].childElements()[i] == generator) {
				allCats[i].innerHTML = allCats[i].childElements()[0].innerHTML;
				currentCategory = allCats[i].innerHTML;
			}
			else {
				if (allCats[i].childElements().length > 0) {
					allCats[i].innerHTML = '<a href="#" onclick="switchCategory(this.parentNode, \'' + allCats[i].childElements()[0].innerHTML + '\'); return false;">' + allCats[i].childElements()[0].innerHTML + '</a>';
				}
				else {
					allCats[i].innerHTML = '<a href="#" onclick="switchCategory(this.parentNode, \'' + allCats[i].innerHTML + '\'); return false;">' + allCats[i].innerHTML + '</a>';
				}
			}
		}
	}

	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: { action: 'getGalleryPictures', sub: category, hotel: currentHotel},
		onLoading: function() {
			showPreloader();
		},
		onComplete: function(transport){
			$('mainGallery').innerHTML = transport.responseJSON.pictures;
			if(!transport.responseJSON.pictures) $$('.pagination')[0].innerHTML = transport.responseJSON.paging;
			if(!transport.responseJSON.pictures) $$('.pagination')[1].innerHTML = transport.responseJSON.paging;
			hidePreloader();
		}
	});
}

function switchCategoryEn(generator, category)
{
	for(var x = 0; x < $$('.folders').length; x++)
	{
		var allCats = $$('.folders')[x].childElements();

		for(var i = 0; i < allCats.length; i++)
		{
			if (allCats[i] == generator || $$('.folders')[x == 0 ? 1 : 0].childElements()[i] == generator) {
				allCats[i].innerHTML = allCats[i].childElements()[0].innerHTML;
				currentCategory = allCats[i].innerHTML;
			}
			else {
				if (allCats[i].childElements().length > 0) {
					allCats[i].innerHTML = '<a href="#" onclick="switchCategoryEn(this.parentNode, \'' + allCats[i].childElements()[0].innerHTML + '\'); return false;">' + allCats[i].childElements()[0].innerHTML + '</a>';
				}
				else {
					allCats[i].innerHTML = '<a href="#" onclick="switchCategoryEn(this.parentNode, \'' + allCats[i].innerHTML + '\'); return false;">' + allCats[i].innerHTML + '</a>';
				}
			}
		}
	}

    //alert(category);
    //alert(currentHotel);

	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: { action: 'getGalleryPicturesEn', sub: category, hotel: currentHotel},
		onLoading: function() {
			showPreloader();
		},
		onComplete: function(transport){
			$('mainGallery').innerHTML = transport.responseJSON.pictures;
			if(!transport.responseJSON.pictures) $$('.pagination')[0].innerHTML = transport.responseJSON.paging;
			if(!transport.responseJSON.pictures) $$('.pagination')[1].innerHTML = transport.responseJSON.paging;
			hidePreloader();
		}
	});
}


function galleryNextPage(){
	currentPage++;
	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: {
			action: 'getGalleryPictures',
			sub: currentCategory,
			page: currentPage,
			hotel: currentHotel
		},
		onLoading: function() {
			showPreloader();
		},
		onComplete: function(transport){
			$('mainGallery').innerHTML = transport.responseJSON.pictures;
			$$('.pagination')[0].innerHTML = transport.responseJSON.paging;
			$$('.pagination')[1].innerHTML = transport.responseJSON.paging;
			hidePreloader();
		}
	});
}

function galleryPreviousPage(){
	currentPage--;
	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: {
			action: 'getGalleryPictures',
			sub: currentCategory,
			page: currentPage,
			hotel: currentHotel
		},
		onLoading: function() {
			showPreloader();
		},
		onComplete: function(transport){
			$('mainGallery').innerHTML = transport.responseJSON.pictures;
			$$('.pagination')[0].innerHTML = transport.responseJSON.paging;
			$$('.pagination')[1].innerHTML = transport.responseJSON.paging;
			hidePreloader();
		}
	});
}

function galleryJumpToPage(page){
	currentPage = page;
	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: {
			action: 'getGalleryPictures',
			sub: currentCategory,
			page: currentPage,
			hotel: currentHotel
		},
		onLoading: function() {
			showPreloader();
		},
		onComplete: function(transport){
			$('mainGallery').innerHTML = transport.responseJSON.pictures;
			$$('.pagination')[0].innerHTML = transport.responseJSON.paging;
			$$('.pagination')[1].innerHTML = transport.responseJSON.paging;
			hidePreloader();
		}
	});
}

var pageSetup = function()
{
	var links = $$('a');

	for(var i = 0; i < links.length; i++)
	{
		if(links[i].rel)
		{
			if(links[i].rel == '_blank') links[i].target = '_blank';
			else if(links[i].rel == '_parent') links[i].target = '_parent';
		}
	}
}

var updateHomepageGallery = function(clickedElement, hotelName)
{
	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: { action: 'getGalleryPictures', homepage: true, perpage: 12, hotel: hotelName, nocat: true},
		onLoading: function() {
			showPreloader();
		},
		onComplete: function(transport){
			$('bodyPhotoGallery').innerHTML = transport.responseText;

			var allElems = $('sidebarPhotoGallery').childElements();

			for(var i = 0; i < allElems.length; i++)
			{
				if(allElems[i] == clickedElement)
				{
					allElems[i].addClassName('selected');
					allElems[i].childElements()[1].src = '&resources/img/bg/sidebar_minus_sign.gif';
				}
				else
				{
					if(allElems[i].hasClassName('selected')) allElems[i].removeClassName('selected');
					allElems[i].childElements()[1].src = '&resources/img/bg/sidebar_plus_sign.gif';
				}
			}

			hidePreloader();
		}
	});
}

var firstLoadGalleryInit = function()
{
	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: { action: 'getGalleryPictures', homepage: true, perpage: 12, hotel: 'rgh', nocat: true},
		onComplete: function(transport){
			$('bodyPhotoGallery').innerHTML = transport.responseText;
		}
	});
}

function getExternalPage(page) {
	new Ajax.Request(ROOT_URL + '&resources/ajax/controller.php', {
		method: 'post',
		parameters: { action: 'getExternalPage', hotel: page },
		onComplete: function(transport){
			$('reservationForm').innerHTML = transport.responseText;
		}
	});
}

var switchRoom = function(currSelection, id)
{
	var lis = $$('li.roomName');
	var rList = $$('li.roomList');

	for(var i = 0; i < lis.length; i++)
	{
		lis[i].removeClassName('selected');
	}

	for(var i = 0; i < rList.length; i++)
	{
		rList[i].style.display = 'none';
	}

	currSelection.parentNode.addClassName('selected');
	$(id).style.display = 'block';
}

var showPreloader = function()
{
	var preloaderContainer = document.createElement('div');
	preloaderContainer.id = 'preloaderContainer';

	var preloaderPositioner = document.createElement('div');
	preloaderPositioner.id = 'preloaderPositioner';
	preloaderPositioner.style.position = 'absolute';

	var realWindowWidth = 0;
	var realWindowHeight = 0;

	var isFirefox = false;

	if(window.innerHeight && window.innerWidth)
	{
		realWindowWidth = parseInt(window.innerWidth);
		realWindowHeight = parseInt(window.innerHeight);

		isFirefox = true;
	}
	else if((document.body.clientHeight && document.body.clientWidth) && (document.body.clientHeight > 0 && document.body.clientWidth > 0))
	{
		realWindowWidth = parseInt(document.body.clientWidth);
		realWindowHeight = parseInt(document.body.clientHeight);
	}
	else
	{
		realWindowWidth = parseInt(document.documentElement.clientWidth);
		realWindowHeight = parseInt(document.documentElement.clientHeight);
	}

	var preloader = document.createElement('div');
	preloader.id = 'preloader';
	preloader.innerHTML = '<p><img src="' + ROOT_URL + '&resources/img/misc/loading.gif" alt="Se incarca" /> Se incarca...</p>';

	preloaderPositioner.style.left = parseInt(Math.ceil((realWindowWidth - 200)/2)) + 'px';
	preloaderPositioner.style.top = parseInt(Math.ceil((realWindowHeight - 60)/2)) + 'px';

	preloaderPositioner.appendChild(preloader);
	preloaderContainer.appendChild(preloaderPositioner);

	document.body.style.position = 'relative';
	document.body.style.left = 0;
	document.body.style.top = 0;
	document.body.appendChild(preloaderContainer);
}

var hidePreloader = function()
{
	window.setTimeout('document.body.removeChild($(\'preloaderContainer\'));', 1000);
}

function switchOffer(offer,link) {

	$('link1').removeClassName('selected');
    $('link2').removeClassName('selected');
	$('link3').removeClassName('selected');
	$(link).addClassName('selected');


	var obj = document.getElementById(offer);
	document.getElementById('hct').style.display = 'none';
    document.getElementById('ccr').style.display = 'none';
	document.getElementById('rgh').style.display = 'none';
	obj.style.display = 'block';

}

function switchOffer2(offer,link) {

	$('link1').removeClassName('selected');
	$('link2').removeClassName('selected');
	$('link3').removeClassName('selected');
	$(link).addClassName('selected');


	var obj = document.getElementById(offer);
	document.getElementById('o1').style.display = 'none';
	document.getElementById('o2').style.display = 'none';
	document.getElementById('rev').style.display = 'none';
	obj.style.display = 'block';

}

function parseLinks()
{
	var allLinks = $$('a[rel="external"]');

	for(var i = 0; i < allLinks.length; i++) {
		allLinks[i].target = "_blank";
	}
}

function navigateToHall(selObj) {
	if (selObj.value != '-') document.location.href = selObj.value;
}

function formSwitchStep(dir) {
    var hallForm = document.getElementById('hallForm');
    var fieldsets = hallForm.getElementsByTagName('fieldset');
    if (dir == "next") {
        fieldsets[0].style.display = "block";
        fieldsets[1].style.display = "none";
    } else {
        fieldsets[0].style.display = "none";
        fieldsets[1].style.display = "block";
    }
}

function toggleOffersBox(currElem, hideElem, destID, nextID) {
    currElem.className = 'selected';
    document.getElementById(hideElem).className = '';
    document.getElementById(destID).style.display = 'block';
    document.getElementById(nextID).style.display = 'none';
}
