 

function emailVerify(fieldId){
var valEntered = $(fieldId).value;
var newVal = valEntered.split(' ').join('');
newVal = newVal.replace(/[^a-zA-Z0-9-_.@]+/g,'');  
$(fieldId).value =newVal.toLowerCase();
if (newVal.length > 0 &&   ( newVal.indexOf('@')== -1 || newVal.indexOf('.')== -1  || newVal.length <=3)   ) { $(fieldId).className='inputs inputsErr'  }
}

 
function validateCallbackForm(){
msg='';
if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr' } 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg +='Your email address\n' ;  $('email').className='inputs inputsErr' } 
if ( $('email').value!='Your Email...' && ( $('email').value != $('emailRpt').value)  ){ msg +='The 2 email address fields match\n' ;  $('email').className='inputs inputsErr' ; $('emailRpt').className='inputs inputsErr' ; } 
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n';  $('telephone').className='inputs inputsErr' }

if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('callbackForm').submit();  return true;}
}//eofn


function validateEUForm(){
msg='';
if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr' ;} 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ;  $('email').className='inputs inputsErr' ; }  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr'  ;}
if ( $('country_moving_from').value.length < 2 || $('country_moving_from').value.indexOf('...') > 0 ){msg +='The country you are moving from.\n'; $('country_moving_from').className='inputsDD inputsErr'  ; }
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr' ;}
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The Postcode you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr'  ;}
if ( $('property_type').value=='' ){msg +='The type of property you are moving from.\n'; $('property_type').className='inputsDD inputsErr' ;}
if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
}  



function validateOSForm(){
msg='';
if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr' ;} 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ; $('email').className='inputs inputsErr' ;}  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr' ;}

if ( $('country_moving_from').value.length < 2 || $('country_moving_from').value.indexOf('...') > 0 ){msg +='The country you are moving from.\n'; $('country_moving_from').className='inputsDD inputsErr' ;}
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr' ;}
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The Post/Zip code you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr' ;}
if ( $('property_type').value=='' ){msg +='The type of property you are moving from.\n'; $('property_type').className='inputsDD inputsErr' ;}

if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
}  



function validateStorageForm(){
msg='';
if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr'  ;} 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ; $('email').className='inputs inputsErr' ;}  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr'  ;}

//if ( $('country_moving_from').value.length < 2 || $('country_moving_from').value.indexOf('...') > 0 ){msg +='The country you are moving from.\n'; $('country_moving_from').className='inputsDD inputsErr'  ;}
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n';  $('telephone').className='inputs inputsErr'  ;}
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The postcode you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr'  ;}

 if ( $('property_type').value < 2   ){msg +='The property type.\n'; $('property_type').addClassName('inputsErr') ;}

if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
} 


function validateBizStorageForm(){
msg='';

if ( $('company_name').value.length<2 || $('company_name').value.indexOf('...') > 0 ){msg +='Company name.\n'; $('company_name').className='inputs inputsErr' ; } 
if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr' ;}
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ;$('email').className='inputs inputsErr' ;}  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr' ;}
//if ( $('country_moving_from').value.length < 2 || $('country_moving_from').value.indexOf('...') > 0 ){msg +='The country you are moving from.\n'; $('country_moving_from').className='inputs inputsErr' ; ;}
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr' ;}
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The Postcode you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr' ;}

if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} 
if ( msg =='' ){ $('sendForm').submit();  return true;}
} 



function validateUKmovingForm(){
msg='';

if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr' ;} 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ;$('email').className='inputs inputsErr' ;}  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr' ;}

if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr' ;}
//if ( $('city_moving_from').value.length < 2 || $('city_moving_from').value.indexOf('...') > 0 ){msg +='The city or town you are moving from.\n'; $('city_moving_from').className='inputsDD inputsErr' ; ;}
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The postcode you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr' ;}
if ( $('property_type').value=='' ){msg +='The type of property you are moving from.\n'; $('property_type').className='inputsDD inputsErr' ;}

if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
}  



function validateBaggageForm(){
msg='';

if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr'  ;} 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ;$('email').className='inputs inputsErr'  ;}  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr'  ;}
if ( $('country_moving_from').value.length < 2 || $('country_moving_from').value.indexOf('...') > 0 ){msg +='The country you are moving from.\n'; $('country_moving_from').className='inputsDD inputsErr' ; }
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr'  ;}
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The Post/Zip code you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr'  ;}
if ( $('description_of_the_items').value=='' ){msg +='A brief description of the items.\n'; $('description_of_the_items').className='inputs inputsErr' }

if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
}




function validateBizMovingForm(){
msg='';

if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n'; $('name').className='inputs inputsErr' } 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ;$('email').className='inputs inputsErr' }  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n'; $('telephone').className='inputs inputsErr' } 
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr' }
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The postcode you are moving from.\n'; $('postcode_moving_from').className='inputs inputsErr' }
if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
} 



function validateEmployeeForm(){
msg='';

if ( $('name').value.length<4 || $('name').value.indexOf('...') > 0 ){msg +='Contact name.\n';  $('name').className='inputs inputsErr' ;  } 
if ( $('email').value.indexOf('@')== -1 || $('email').value.indexOf('.')== -1 ){msg+='Your email address\n' ; $('email').className='inputs inputsErr' ;   }  
if ($('telephone').value.length<3 || $('telephone').value.indexOf('...') > 0  ){msg +='Your telephone number.\n';  $('telephone').className='inputs inputsErr' ; }
if ( $('country_moving_from').value.length < 2 || $('country_moving_from').value.indexOf('...') > 0 ){msg +='The country you are moving from.\n';  $('country_moving_from').className='inputs inputsErr' ; }
if ( $('address_moving_from').value.length < 2 || $('address_moving_from').value.indexOf('...') > 0 ){msg +='The address you are moving from.\n'; $('address_moving_from').className='inputs inputsErr' ;  }
if ( $('postcode_moving_from').value.length < 2 || $('postcode_moving_from').value.indexOf('...') > 0 ){msg +='The Post/Zip code you are moving from.\n';  $('postcode_moving_from').className='inputs inputsErr' ;  }
if ( $('property_type').value < 2   ){msg +='The property type.\n';  $('property_type').className='inputsDD inputsErr' ;  }
if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('sendForm').submit();  return true;}
} 



//// VOL CAL ///// 
var securityKey ='\server:port:\'';
var securityKey2 ='/sdfserw4rw$g4://$ecw4fsdfs0:/p/q=dolPhMov093845';
var undefined;
var runningTotal = 0;
function checkCR(evt) {
var evt  = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = checkCR;
function temp(form){
if ( isNaN (form.qty.value) ) { form.qty.value=0;  return false; }  // alert ('Please enter a number.');
var qty = form.qty.value;
var total = form.total.value;
var cubeFoot = form.cubeFoot.value;
runningTotal=runningTotal-total
total = qty*cubeFoot
runningTotal = runningTotal + total
form.total.value = total;
calculateTotal()
}

function calculate(form){
//form.calcTotal.value = runningTotal;
}

function calculateTotal(){
//form.calcTotal.value = runningTotal;
document.getElementById('total_volume').value  =  runningTotal
getvalues(); //calls function above
}

function getvalues(){
document.getElementById('volume_calculator_items').value='' //reset for passing
document.getElementById('output').innerHTML='<br/>' // output   <br><br><br><strong class=bigger>YOUR TOTALS...</strong>
no = document.forms.length;
i=0;
while (i < no ){
elements= document.forms[i].elements.length;  
if (elements && document.forms[i].name!="calcForm") { //ignore forms not related to the calculations 
articleName=document.forms[i].articleName.value  ;  // document.getElementById('debug2').innerHTML +=  articleName + ' > ' + i + ' <br>';
cubeFootAmount=document.forms[i].cubeFoot.value;
elementQty=document.forms[i].qty.value; 
elementTotal=document.forms[i].total.value; 

// form
if(elementQty=="room")  document.getElementById('volume_calculator_items').value += '<br/><br/><strong>'  + articleName + '</strong>' ;	  
if(elementQty>0 ) document.getElementById('volume_calculator_items').value += ' <br/><strong>' + articleName + '</strong><br/><em>' + elementQty + ' x '+ cubeFootAmount + ' CuFt  = ' + elementTotal + ' Cubic feet</em>';
//old
//if(elementQty>0 )       document.getElementById('volume_calculator_items').value += ' <br/>' + articleName+' @ ' + cubeFootAmount + ' CuFt x ' + elementQty + ' = ' + elementTotal + ' Cubic feet';

// OUTPUT 
if(elementQty=="room")  document.getElementById('output').innerHTML += ' <br/> <br/><strong class=bigger>'  + articleName+'</strong>' ;	  
if(elementQty>0 )       document.getElementById('output').innerHTML += ' <br/><strong>' + articleName + '</strong><br/><em>' + elementQty + ' x '+ cubeFootAmount + ' CuFt  = ' + elementTotal + ' Cubic feet</em>';
 
}  // eo if elements exist
i++;
} //eo loop

} //eo fn



//openers
var currentOpen='';
function openSub(openThis){ 

if (currentOpen=='')       { 
new Effect.BlindDown('section-' + openThis , {duration: 0.8 }); 
$('opener-' + openThis).addClassName('headerRow-active');
currentOpen=openThis;
return false;
} //eo first

if (currentOpen!=openThis) {
$('opener-' + currentOpen).removeClassName('headerRow-active');
$('opener-' + openThis).addClassName('headerRow-active');
new Effect.BlindUp('section-' + currentOpen ,{duration: 0.2 } ); 
new Effect.BlindDown('section-' + openThis , {duration: 0.8 }); 
currentOpen=openThis; 
return false;
} // eo new one
	
if (currentOpen==openThis) { 
$('opener-' + openThis).removeClassName('headerRow-active');
new Effect.BlindUp('section-' + openThis ,  {duration: 0.2 }); 
currentOpen=''; 
return false;
}// close same one  
}//eofn

//// eo VOL CAL ///// 




//final before sending
function volCalcForm(){
msg='';
//if ( $('total_volume').value <=0  ){msg +='Please complete the volument calculator.\n';  } 
//if ( $('moving_from_-_property_type').value==''  ){msg+='The type of property you are moving from \n' ;$('moving_from_-_property_type').addClassName('inputsErr') ;}  
//if ( msg !='' ){ alert('Please check the following fields:\n' + msg); return false;} // ;;
if ( msg =='' ){ $('calcForm').submit();  return true;}
} 





 
//main hovers over sub
Event.observe(window, 'load', function() {
 /// if (browser !="IE5/6") {
var allHovers = $$('.menuDD');
for (i=0; i < allHovers.length; i++) {
var theMainId =  allHovers[i].id; 

(function (theMainId) {  
$(theMainId + '_sub').observe('mouseover', function(event) {
Element.addClassName(theMainId, 'mainActive'); 
});
}) (theMainId) ;

(function (theMainId) {  
$(theMainId + '_sub').observe('mouseout', function(event) {
Element.removeClassName(theMainId, 'mainActive'); 
});
}) (theMainId) ;
} //eo loop	
 //  }//not 5/6

var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";


}




///forms stuff

$$('.inputs').each(function(theInput) {
theInput.observe("click", function() {
theInput.removeClassName('inputsErr')
});
});


$$('.inputsDD').each(function(theInput) {
theInput.observe("click", function() {
theInput.removeClassName('inputsErr')
});
});

$$('.inputs').each(function(theInput) {
theInput.observe("focus", function() {
currValue=theInput.value;  
theInput.addClassName='inputsOver' ; 
if (currValue.indexOf('...')>0) $(theInput).value='' 
});
}); 

$$('.inputs').each(function(theInput) {
theInput.observe("blur", function() {
if( theInput.value=='') $(theInput).value=currValue ;
});
}); 
// eo forms stuff

})// eo ready*/


