// JavaScript Document
function newImage(arg) {
	if (document.images) {
		var rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
	else return null;
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		var nav_home_over = newImage("images/nav-home-over.jpg");
		var nav0about_over = newImage("images/nav0about-over.jpg");
		var nav_offers_over = newImage("images/nav-offers-over.jpg");
		var nav_destinations_over = newImage("images/nav-destinations-over.jpg");
		var therapies_over = newImage("images/therapies-over.jpg");
		var whychoosethermalia_over = newImage("images/whychoosethermalia-over.jpg");
		var contactus_over = newImage("images/contactus-over.jpg");
		preloadFlag = true;
	}
}


var menu_status = new Array();

function showHide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}


//HYPERTECH FUNCTIONS
function  doMath() {
var one = eval(document.theForm.elements[0].value)
var two = eval(document.theForm.elements[1].value)
var prod = one  -   two
alert("The Land Only Price of your package is £"  +  prod  +  ".")
}

function plexRedirect(code, category, packageId) {
	//var url = 'http://thermalia.hypertechsolutions.com';
	//var url = 'http://ww2.thermalia.co.uk';
	var url = 'http://thermalia2.hypertechsolutions.com';
	var appNameAndRootDirectory = '/ipm';
	var plexRedirectPage = '/plexRedirect.jsp';
	var companyID = 'THER';
	var partnerID = 'THER';
	var userType = 'WU';

	var replaceUrl = url + appNameAndRootDirectory + plexRedirectPage + '?companyID=' + companyID + '&partnerID=' + partnerID +
													'&userType=' + userType;

	var argumentsLength = arguments.length;
	for (var argumentsCounter = 0; argumentsCounter < argumentsLength; argumentsCounter++) {
		replaceUrl += '&' + arguments[argumentsCounter];
	}

	window.location.replace(replaceUrl);
}