function glowArrow(which)
{
document.getElementById(which).style.visibility = "visible";
}

function noArrow(which)
{
document.getElementById(which).style.visibility = "hidden";
}


var image = new Image;
image.src="images/submitGlow.gif";
var image2 = new Image;
image2.src="images/resetGlow.gif";
var image3 = new Image;
image3.src = "images/backgroundLinks2glow.jpg";
var image4 = new Image;
image4.src = "images/backgroundLinks2.jpg";


function glow(which)
{
document.getElementById(which).style.backgroundColor = "#C3B39E";
document.getElementById(which).style.cursor="pointer";
}

function noglow(which)
{
document.getElementById(which).style.backgroundColor = "#604631";
}

function glowMain(which)
{
document.getElementById(which).style.backgroundImage = "url(images/backgroundLinks2glow.jpg)"
document.getElementById(which).style.cursor="pointer";
}

function noglowMain(which)
{
document.getElementById(which).style.backgroundImage = "url(images/backgroundLinks2.jpg)";
}


// ONMOUSEOVER CHANGE BUTTON BOOKING FORM

function light(which, button)
{
document.getElementById(which).setAttribute("src", button);
}


// CHANGE LIABILITY VALUES ON BOOKING FORM

function doLiability(obj)
{
     for (i = 0; i < obj.length; i++)
        {
        if (obj[i].selected == true)
           {which = obj[i].value;}
        }
           
           
    switch(which)
    {
        case 'Group A':
            document.getElementById('A').firstChild.nodeValue='- N$150 000';
            document.getElementById('B').firstChild.nodeValue='- N$36 000';
            document.getElementById('C').firstChild.nodeValue='- N$12 000';
            document.getElementById('D').firstChild.nodeValue='- N$3 000';
            break;
        
        case 'Group B':
            document.getElementById('A').firstChild.nodeValue='- N$330 000';
            document.getElementById('B').firstChild.nodeValue='- N$36 000';
            document.getElementById('C').firstChild.nodeValue='- N$18 000';
            document.getElementById('D').firstChild.nodeValue='- N$5 000';
            break;
        
        
        case 'Group C':
            document.getElementById('A').firstChild.nodeValue='- N$330 000';
            document.getElementById('B').firstChild.nodeValue='- N$36 000';
            document.getElementById('C').firstChild.nodeValue='- N$18 000';
            document.getElementById('D').firstChild.nodeValue='- N$5 000';
            break;
        
        case 'Group D':
            document.getElementById('A').firstChild.nodeValue='- N$390 000';
            document.getElementById('B').firstChild.nodeValue='- N$36 000';
            document.getElementById('C').firstChild.nodeValue='- N$18 000';
            document.getElementById('D').firstChild.nodeValue='- N$5 000';
            break;
        
        case 'Group E':
            document.getElementById('A').firstChild.nodeValue='- N$480 000';
            document.getElementById('B').firstChild.nodeValue='- N$45 000';
            document.getElementById('C').firstChild.nodeValue='- N$22 000';
            document.getElementById('D').firstChild.nodeValue='- N$7 000';
            break;
          
         case 'Group F':
            document.getElementById('A').firstChild.nodeValue='- N$250 000';
            document.getElementById('B').firstChild.nodeValue='- N$36 000';
            document.getElementById('C').firstChild.nodeValue='- N$16 000';
            document.getElementById('D').firstChild.nodeValue='- N$4 000';
            break;
        
        case ' ':
            document.getElementById('A').firstChild.nodeValue='-';
            document.getElementById('B').firstChild.nodeValue='-';
            document.getElementById('C').firstChild.nodeValue='-';
            document.getElementById('D').firstChild.nodeValue='-';
            break;
        
        default:
            document.getElementById('A').firstChild.nodeValue='-';
            document.getElementById('B').firstChild.nodeValue='-';
            document.getElementById('C').firstChild.nodeValue='-';
            document.getElementById('D').firstChild.nodeValue='-';
            break;
    }
    
}



// ONMOUSEOVER CHANGE TEXT IN CAMPING BUTTON

function textGlow()
{
document.getElementById('text').style.color="#EB850A";
document.getElementById('camp').style.cursor="pointer";
}

function textUnglow()
{
document.getElementById('text').style.color="#FFFFFF";
}


// SELECT DROP DOWN URL FUNCTION

 function doSel(obj)
 {
     for (i = 1; i < obj.length; i++)
        if (obj[i].selected == true)
           eval(obj[i].value);
}


// FORM VALIDATION

function isEmpty(field)
{
str = field;
if(str == "")
  {
  return true;
  }
else
  {
  for(j=0; j<str.length; j++)
    {
    if(str.charAt(j) != " ")
      {
      return false;
      }
    }
  }
return true;
}

function containsNumbers(str)
{
for(j=0; j<str.length; j++)
  {
  c=str.charAt(j);
  if(c >= "0" && c <= "9")
    {
    return true;
    }
  }
return false;
}

function validNumber(str)
{
var notNumber = 0;
for(j=0; j<str.length; j++)
  {
  c=str.charAt(j);
  if((!(c >= 0) && !(c <= 9)) && c != '-' && c !='(' && c!=')' && c!= ' ' && c!= '+')
    {
    notNumber++; 
    }
  }
if (notNumber > 0)
  {
  return true;
  }
else
  {
  return false;
  }
}



function isEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}


function ltrim(argvalue) {

  while (1) {
    if (argvalue.substring(0, 1) != " ")
      break;
    argvalue = argvalue.substring(1, argvalue.length);
  }

  return argvalue;
}


function rtrim(argvalue) {

  while (1) {
    if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
      break;
    argvalue = argvalue.substring(0, argvalue.length - 1);
  }

  return argvalue;
}


function trim(argvalue) {
  var tmpstr = ltrim(argvalue);

  return rtrim(tmpstr);

}



