

// ---------------------------------------------------------------------- 
// this is a code to scroll top rentals on the right 
// ---------------------------------------------------------------------- 



function show_div(id){
    divname = eval(id);
    if (divname.style.display == 'block') {
       divname.style.display = 'none';
    } else
       divname.style.display = 'block';
  }

function ShowFAQ(faq_name){

   if (document.getElementById(faq_name).style.display == 'block'){ 
      document.getElementById(faq_name).style.display = 'none';
   } else {  
      document.getElementById(faq_name).style.display = 'block';
   } 
  
}
 
 scroll_item = -1;
 
 function abs( mixed_number )  {    // Absolute value
    return ( ( isNaN ( mixed_number ) ) ? 0 : Math.abs ( mixed_number ) );
}
 
 function scroll_toprentals(){
 

    if (scroll_item >= 0){ 
 

      links = document.getElementsByName('toprental_link');   
      if (scroll_item >= links.length) scroll_item = links.length-1;  
      
      current_scroll_top =  document.getElementById('scrollbox').scrollTop;
      
      scroll_distance =  ( (toprental_link_height + toprental_link_spacing)*scroll_item + toprental_link_spacing /2  + 2) -current_scroll_top;
      

      if (abs(scroll_distance) > 3){ 
        document.getElementById('scrollbox').scrollTop  = current_scroll_top + scroll_distance/2;  
      } else {
        document.getElementById('scrollbox').scrollTop  = current_scroll_top + scroll_distance;
      }
  
      if (scroll_item == 0) { 
              document.getElementById('big_arrow_top').src='images/big_arrow_top_a.gif'; 
      } else { 
              document.getElementById('big_arrow_top').src='images/big_arrow_top.gif';
      } 
            
      if ( last_visible_link_number + scroll_item >= links.length ){ 
              document.getElementById('big_arrow_bot').src='images/big_arrow_bot_a.gif'; 
      } else { 
              document.getElementById('big_arrow_bot').src='images/big_arrow_bot.gif';
      } 
      
      if (document.getElementById('scrollbox').scrollTop != current_scroll_top){
         t_scroll = setTimeout('scroll_toprentals()', 10);  
      }
            
           
      
    } else {
      scroll_item = -1;
    }
    
    adjust_toprentals_height();
    
 }
 
 
 
function viewform2(m, w, h) {
   alter=(settings);
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
   w=760;
   h=600;

   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

   settings = 'height='+h+', width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
   settings = settings + ', resizable=yes, maximize=yes, status=no,toolbar=no,directories=no,menubar=no,location=no';

   if (document.inviteform) {
     if (document.inviteform.friend_email) m = m + "?friend_email="+document.inviteform.friend_email.value;
   }
   
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
}
 
 
// ---------------------------------------------------------------------- 
// end
// ---------------------------------------------------------------------- 

function checkUserInfoStep1() {

  step = arguments[0]; 

  if(!step || step == 1){

     if (!document.UserForm.get_pasw_1.value) {
         alert('Please enter a password!');         document.UserForm.get_pasw_1.focus();
        return false;
     }

     if (!document.UserForm.get_pasw_2.value) {
         alert('Please confirm your password!');         document.UserForm.get_pasw_2.focus();
        return false;
     }

     if (document.UserForm.get_pasw_1.value != document.UserForm.get_pasw_2.value) {
         alert('Password verification and the password does not match!');         document.UserForm.get_pasw_1.focus();
        return false;
     }

     if (document.UserForm.get_pasw_1.value.length < 6) {
         alert('The password must be more than 6 characters!');        document.UserForm.get_pasw_1.focus();
        return false;
     }
     if (!document.UserForm.get_email.value) {
         alert('Please enter the email address!');         document.UserForm.get_email.focus();
        return false;
     }

     adresse = document.UserForm.get_email.value;
     var place = adresse.indexOf("@",1);
     var point = adresse.indexOf(".",place+1);

     if ((place > -1)&&(adresse.length >2)&&(point > 1))
     {

     }
       else
     {
       alert('Please use an email address valid!');       document.UserForm.get_email.focus();
       return false;
     }

  }
  if(step == 1) return true;

  if(!step || step == 2){
     if (!document.UserForm.get_fname.value) {
         alert('Please enter your name!');         document.UserForm.get_fname.focus();
        return false;
     }

     if (!document.UserForm.get_lname.value) {
         alert('Please enter your surname!');         document.UserForm.get_lname.focus();
        return false;
     }
     
       if (!document.UserForm.get_document_number.value) {
         alert('Please enter your ID Number!');         document.UserForm.get_document_number.focus();
        return false;
     }
     
     
  }
  if(!step || step == 3){
     if (!document.UserForm.get_postal_code1.value) {
         alert('Please enter the Post code (Contact Information )!');         document.UserForm.get_postal_code1.focus();
        return false;
     }
     if (document.UserForm.get_postal_code2)
     if (!document.UserForm.get_postal_code2.value) {
         alert('Please enter the Post code (Contact Information )!');         document.UserForm.get_postal_code2.focus();
        return false;
     }
     if (!document.UserForm.get_address.value) {
         alert('Please enter the address (Contact Information )!');         document.UserForm.get_address.focus();
        return false;
     }
     if (!document.UserForm.get_ref_state.value) {
         alert('Please enter the State!');         document.UserForm.get_ref_state.focus();
        return false;
     }
     if (!document.UserForm.get_city.value) {
         alert('Please enter the city!');         document.UserForm.get_city.focus();
        return false;
     }
     if (!document.UserForm.get_phone_work.value) {
         alert('Please enter a work phone number!');         document.UserForm.get_phone_work.focus();
        return false;
     }

     if (!(document.UserForm.get_ref_day.value > 0)) {
         alert('Please enter correct date of birth!');         document.UserForm.get_ref_day.focus();
         return false;
     }
     if (!(document.UserForm.get_ref_month.value > 0)) {
         alert('Please enter correct date of birth!');         document.UserForm.get_ref_month.focus();
         return false;
     }
     if (!(document.UserForm.get_ref_year.value > 0)) {
         alert('Please enter correct date of birth!');         document.UserForm.get_ref_year.focus();
         return false;
     }
 }
 if(!step || step == 2){
    if (!document.UserForm.get_shipping_postal_code1.value) {
         alert('Please enter the Post code (Information for sending )!');         document.UserForm.get_shipping_postal_code1.focus();
        return false;
     }
     
     if (document.UserForm.get_shipping_postal_code2) 
     if (!document.UserForm.get_shipping_postal_code2.value) {
         alert('Please enter the Post code (Information for sending )!');         document.UserForm.get_shipping_postal_code2.focus();
        return false;
     }
    if (!document.UserForm.get_shipping_address.value) {
         alert('Please, enter the address (Information for sending )!');         document.UserForm.get_shipping_address.focus();
        return false;
    }
    if (!document.UserForm.get_shipping_ref_state.value) {
         alert('Please enter the State!');         document.UserForm.get_shipping_ref_state.focus();
        return false;
    }
    if (!document.UserForm.get_shipping_city.value) {
         alert('Please enter the city (Information for sending )!');         document.UserForm.get_shipping_city.focus();
        return false;
     }
     if (!document.UserForm.get_shipping_phone_work.value) {
         alert('Please enter a phone number!');         document.UserForm.get_shipping_phone_work.focus();
        return false;
     }
  }
  if(step == 2) return true;

  if(!step || step == 3){
    if(document.UserForm.trnCardNumber && !checkCCInfo('UserForm')) return false;
    if(!checkUserInfoStep2_()) return false;
  }

  return true;
}



function checkUserInfoStep2_() {
 var flag = false;


 if (!document.UserForm.get_tos.checked) {
     alert('You can open an account if you agree with our Terms of Use and mark the check box \'I have read and agree ...\'!');     document.UserForm.get_tos.focus();
     return false;
 }
 if (!document.UserForm.get_ref_question.value) {
     alert('Please choose an option in the \'Because you knew the movies4africa ?\'');     document.UserForm.get_ref_question.focus();
     return false;
 }

 return true;
}

  
function SelectAuto(act) {

         if ( document.UserForm.get_auto_fill_shipping.checked) {

              document.UserForm.get_shipping_address.value = document.UserForm.get_address.value;
              document.UserForm.get_shipping_address2.value = document.UserForm.get_address2.value;  
              document.UserForm.get_shipping_suburb.value =  document.UserForm.get_suburb.value; 
              document.UserForm.get_shipping_postal_code1.value = document.UserForm.get_postal_code1.value;
              document.UserForm.get_shipping_city.value =  document.UserForm.get_city.value;  
              document.UserForm.get_shipping_ref_state.value = document.UserForm.get_ref_state.value;                         
              document.UserForm.get_shipping_phone1.value = document.UserForm.get_phone1.value;
              document.UserForm.get_shipping_phone2.value = document.UserForm.get_phone2.value;
              
              document.UserForm.get_shipping_phone_work1.value = document.UserForm.get_phone_work1.value;
              document.UserForm.get_shipping_phone_work2.value = document.UserForm.get_phone_work2.value;
              
              document.UserForm.get_shipping_phone_mobile1.value = document.UserForm.get_phone_mobile1.value;
              document.UserForm.get_shipping_phone_mobile2.value = document.UserForm.get_phone_mobile2.value;
              
              

         } else {
              
              document.UserForm.get_shipping_address.value = '';
              document.UserForm.get_shipping_address2.value = '';  
              document.UserForm.get_shipping_suburb.value =  ''; 
              document.UserForm.get_shipping_postal_code1.value = '';
              document.UserForm.get_shipping_city.value =  '';  
              document.UserForm.get_shipping_ref_state.value = '';
                                       
              document.UserForm.get_shipping_phone1.value = '';
              document.UserForm.get_shipping_phone2.value = '';
              
              document.UserForm.get_shipping_phone_work1.value = '';
              document.UserForm.get_shipping_phone_work2.value = '';
              
              document.UserForm.get_shipping_phone_mobile1.value = '';
              document.UserForm.get_shipping_phone_mobile2.value = '';
              
              
         }

}

function unselect_periods() {
   var m = document.getElementsByName("get_period");
   for (i = 0; i < m.length; i++){
    m[i].checked = false;   
   }
} 



      


