// the following line is for JSLint
/*global $, BC, document, dojo, console, jQuery, parent, top, window */

/*global pagetab, rePopulate, setHourRide */

// global namespace.
var BC = {
	
	global : {
		appPath :  'https://' + window.location.host + '/' + 
			window.location.pathname.substring(1).substring(0, window.location.pathname.substring(1).indexOf('/')) + 
			'/requestbroker',
		webPath : 'https://' + window.location.host + '/' + 
			window.location.pathname.substring(1).substring(0, window.location.pathname.substring(1).indexOf('/'))
	},
	
  // configuration object. 
  config : {
	
	externalNamespace : 'SVR', // all external JS calls will be made inside an object with this name
	
	
	
    stripDotHTML : false, // strip '.html' from all dialog box iframe calls. (for the JSP switch)
    
    pageNameOverrides : {
      // not needed anymore. it uses the current tab to figure out what to fire.
    },
    
    tabMap : {
        whenWhere : 0,
        vehicles  : 1,
        passengers: 2,
        payment   : 3,
        review    : 4
    },
    
    whenWhereTabMap : {
      'oneway'    : 0,
      'roundtrip' : 1,
      'openItin'  : 2
    }
    
}, // end of BC.config


  /**
    @usage BC.alert(message);
           BC.alert(message, width, height) default size is 560 x 175
  
    @param message - Each line is wrapped in <p> tag. Inline html is allowed, but currently block-level elements (H2,DIV,etc) are not.
  */
  alert : function(message, width, height){
    
    var thealert = '<div id="BC_alert"><p>' + message.split('\n').join('</p><p>') + '</p></div>';
    
    BC.util.dialog('Alert',$(thealert),
      { width:width || 560,
        height:height || 175,
        buttons: { 
          OK : BC.util.closedialogs
        }
      }
    );  
    
  },
  
  alertWithOKFunc : function (message, func, width, height) {
  
  	var thealert = '<div id="BC_alert"><p>' + message.split('\n').join('</p><p>') + '</p></div>';
    
    BC.util.dialog('Alert',$(thealert),
      { width:width || 560,
        height:height || 175,
        buttons: { 
          OK : func || BC.closedialogs
        }
      }
    );  
    
  }, 
  
  unimplemented : function() {
  	BC.alert("<strong>This feature is not yet implemented<strong>");
  	return false;
  },

  /* **************************************
        common functions
  ************************************** */

  common : function(){
    //alert("common called");
    // uses the label for the value
    $('#Home_login label').labelOver('over');

    //for text box "hints:"
    $('input[title!=""]').hint();

    $('textarea[maxlength]').maxlength();

    //login, logout, home
    $('#global_login').click(function(evt) {
    	BC.util.dialog('Login', BC.global.appPath + '/registrationpopup',{transfer:evt.target, height:520}); 
    	return false; 
    });
    
    $('#global_logout').click(function(evt) {  
    	BC.util.dialog('', BC.global.appPath + '/logout',{transfer:evt.target,width: 305, height: 200}); 
    	return false; 
    });
    
    $('#global_home').click(function(evt){	
	    var urlStr = BC.global.appPath + "/start";
		window.location=urlStr;
		return true;
    });
    
    // logout links straight to home.

	$('a[id=cancel]').click(function(evt){   
     // BC.util.dialog('', "confirmCancel.jsp",{transfer:evt.target, width: 300, height: 200});
      //BC.util.dialog('', 'http://'+window.location.host+'/'+applicationName+'/requestbroker/confirmCancel',{transfer:evt.target, width: 305, height: 200});
      BC.util.dialog('', BC.global.appPath + '/confirmCancel',{transfer:evt.target, width: 305, height: 200});   
      this.blur();
      return false;
  	});

      // make sure menu items with href=# have click methods that return false
      $('#navWrapper > #globalNav > li > a[href="#"]').click(function(){return false;});

  // set up new validation rules and defaults.
 
    BC.validation.setUpDefaults();

    // login validation
    $("#Home_login").validate({
      messages: {
			username: "Please enter a valid username to continue.",
    	login_pass: "Please enter a valid password to continue."
    }
    });
	
	//added by geeta for My links in control center
	  $('a[id=editLinks]').click(function(evt){ BC.util.dialog('',BC.global.appPath +'/manageLinks' ,{transfer:evt.target,width: 605, height: 450}); return false; });
	
	
    // navs and hovers.
    if ($.browser.msie && $.browser.version < 7){
      $('#globalNav li, div.feature_nav li, #rideMenu2, #rideMenu, #globalNav li').hover(function(){
        $(this).addClass('hover');
      },function(){
        $(this).removeClass('hover');
      });
    }
    $('#globalNav li ul li:first-child').addClass('first');
//0905 add
	$('#globalNav ul').bgiframe();


    $(document.body).keyup(function(e){
      if (e.keyCode == 27) { BC.util.closedialogs(); }   // Escape key.
    });
    

    // courtesy function to launch triptype tabs in BC"s non-ajax tab setup
    if ($('#book_a_ride ul.bookARideTabs').length){
      var theid = $('#book_a_ride ul.bookARideTabs li.ui-tabs-selected a').attr('id').match(/(.*?)-tab/)[1]; // read the ID and strip off -tab
      BC.util.fire(theid);
    }
    
    
    // courtesy function to launch triptype tabs in BC"s non-ajax tab setup - for when&where stuff.

	if ($('body#bookARide').length > 0) {
		BC.util.fire('openItin');
	}
    
  }, // end of BC.common()

  /* **************************************
       commontab - functionality that should run when a 'tab' is loaded.
  ************************************** */
  commontab : function(){
   // alert("common tab called");
    $('input')
      .filter('[type=text],[type=password]').addClass('typeText').end()
      .filter('[type=checkbox]').addClass('typeCheckbox').end()
      .filter('[type=radio]').addClass('typeRadio');  
    $('label')
      .filter(function(){ return $( '#'+$(this).attr('for') ).is(':radio'); }).addClass('typeRadio').end()
      .filter(function(){ return $( '#'+$(this).attr('for') ).is(':checkbox'); }).addClass('typeCheckbox').end()
      .filter(function(){ return $( '#'+$(this).attr('for') ).is(':text'); }).addClass('typeText').end()
      .filter(function(){ return $( '#'+$(this).attr('for') ).is('select'); }).addClass('typeSelect').end()
      .filter(function(){ return $( '#'+$(this).attr('for') ).is(':password'); }).addClass('typeText');
    
    
  	
  	
	
    $('img.qTooltip').tooltip({
    	delay: 0,
    	showURL: false,
    	showBody: " - ",
	    positionToElement: true,
    	extraClass : 'qTooltip',
    	fixPNG: true
    });
    
    
    // dialog hookups
    $("a.dialog").click(function(evt){
      var t = this.title || $(this).text();
      var opts = {};

      if ($(this).hasClass('small')) { opts = {width: 300, height: 250}; } // if the a tag has a class of small on it. the window will be small.
      if ($(this).hasClass('smallish')) { opts = {width: 300, height: 320}; } // if the a tag has a class of smalish on it. the window will be smallish.
      if ($(this).hasClass('smallLong')) { opts = {width: 475, height: 345}; } // if the a tag has a class of medium on it. the window will be medium.
      if ($(this).hasClass('medium')) { opts = {width: 475, height: 250}; } // if the a tag has a class of medium on it. the window will be medium.
      if ($(this).hasClass('mediumRequest')) { opts = {width: 475, height: 275}; } // if the a tag has a class of medium on it. the window will be medium.
      if ($(this).hasClass('mediumDelRequest')) { opts = {width: 475, height: 310}; } // if the a tag has a class of medium on it. the window will be medium.
      if ($(this).hasClass('large')) { opts = {width: 525, height: 418}; } // if the a tag has a class of large on it. the window will be large.
      if ($(this).hasClass('llarge')) { opts = {width: 525, height: 438}; } // if the a tag has a class of large on it. the window will be large.
      if ($(this).hasClass('xlarge')) { opts = {width: 575, height: 463}; } // if the a tag has a class of xlarge on it. the window will be extra large.
      if ($(this).hasClass('delegate')) { opts = {width: 700, height: 580}; } // if the a tag has a class of xlarge on it. the window will be extra large.
      if ($(this).hasClass('addstops')) { opts = {width: 575, height: 580}; } // taller window for add stops due to layout change... Brian

      // if no size class is added, the default size is 700 x 480
     //Add 13 to everything for bottom rounded corners
	    opts.transfer = evt.target; // ghosting effect.
      BC.util.dialog(t,this.href, opts);
      this.blur();
      return false;
    });

  }, // end of BC.commontab()


  /***************************************
        forgot password page
  ************************************** */
  forgotPassword : function (){
  
  
    $("#retrievePasswordForm").validate({
    	rules: {
  			username: {
  				required: true,
				maxlength: 60
  				//,remote : 'checkusername.jsp'  // the server will be checked via ajax to see if this is a valid username
  				                                 // documentation here: http://docs.jquery.com/Plugins/Validation/Methods/remote#url 
  			},
  			email: 
	  			{ 	required:true,
	  				maxlength: 60, 
	  				email:true 
	  			}	
    	},
    	messages :{
  			username: {
  			  required: "Please enter a valid username, and try again.",
			  maxlength: "Usernames must be less than 60 characters.",
      		remote: "You've entered an invalid username. Please try again."
    		},
    		emailAddress: "Please enter a valid email address to continue."
  	  },
      submitHandler: function(){
        $("#retrievePasswordForm").form().submit();
      }
    });
  
  },
  
   /***************************************
        password reset page
  ************************************** */
  pwdReset : function (){
  
  
    $("#pwdResetForm").validate({
    	rules: {
  			newPassword: {
  				required: true,
				minlength: 6
  				//,remote : 'checkusername.jsp'  // the server will be checked via ajax to see if this is a valid username
  				                                 // documentation here: http://docs.jquery.com/Plugins/Validation/Methods/remote#url 
  			},
  			verifyNewPassword: {
  				required: true,
				minlength: 6
  				//,remote : 'checkusername.jsp'  // the server will be checked via ajax to see if this is a valid username
  				                                 // documentation here: http://docs.jquery.com/Plugins/Validation/Methods/remote#url 
  			}
    	},
    	messages :{
  			newPassword: {
  			  required: "Please enter a valid password, and try again.",
			  minlength: "New password must be atleast 6 characters."
      		
    		},
    		verifyNewPassword: {
  			  required: "Please enter a valid password, and try again.",
			  minlength: "New password must be atleast 6 characters."
      		
    		}
  	  },
      submitHandler: function(){
        $("#pwdResetForm").form().submit();
      }
    });
  
  },

  /* **************************************
        logout popup
  ************************************** */
 
  logout : function(){

	$("#cancel").click(function(){
  	 	parent.parent.BC.util.closedialogs(); 
		
	});


  }, 



  /***************************************
        security question page
  ************************************** */
  securityQuestion : function (){
  
  
    $("#securityQuestionForm").validate({
    	rules: {
  			securityA: {
  				required: true,
				maxlength: 50
  				//,remote : 'checksecanswer.jsp'  // the server will be checked via ajax to see if this is a valid username
  				                                 // documentation here: http://docs.jquery.com/Plugins/Validation/Methods/remote#url 
  			}	
    	},
    	messages :{
  			securityA: {
  			  required: "Please enter your security answer, and try again.",
			  maxlength: "Security question answers must be under 50 characters.",
      		remote: "Your answer is incorrect. Please try again."
    		}
  	  },
      submitHandler: function(){
         $("#securityQuestionForm").form().submit();
      }
    });
  
  },




  /* **************************************
        home page
  ************************************** */

home : function(){

  //alert("home called");
  // this big block is the homepage slider guy.
  var lastBlock = $("div.slider");
  var maxWidth = 405;
  var minWidth = 170;	

  $("div.slider").hover( function () {
    $(lastBlock).animate({width: maxWidth+"px"}, {queue:false, duration:800 });
  	$("#slideMenu").show();
  }, function () {
  /*  0905
    $(lastBlock).animate({width: minWidth+"px"}, {queue:false, duration:800 });
    $("#getRide").css("background-image", "url(../images/off1.png)");
    $("#getQuote").css("background-image", "url(../images/off3.png)");
    */
    $("#rideMenu,#quoteMenu").fadeOut('normal');
    //0905 add
        $(lastBlock).animate({width: minWidth+"px"}, {queue:false, duration:800 });
    $(this).find('a.on').removeClass('on');
    
  });

  var maxWidth2 = 542;

  $("#getRide").click(function () {
    $(lastBlock).animate({width: maxWidth2+"px"}, {queue:false, duration:800 });
    $("#rideMenu").show();
    $("#quoteMenu").hide();
    /* 0905
    $("#getRide").css("background-image", "url(../images/on1.png)");
    $("#getQuote").css("background-image", "url(../images/off3.png)");
    */
     //0905 add
       $(this).siblings().find('.on').removeClass('on');
    $(this).children().addClass('on');
    
    return false;
  });


  $("#getQuote").click( function () {
    $(lastBlock).animate({width: maxWidth2+"px"}, {queue:false, duration:800 });
  	$("#quoteMenu").show();
  	$("#rideMenu").hide();
  	/* 0905
  	$("#getQuote").css("background-image", "url(../images/on3.png)");
  	$("#getRide").css("background-image", "url(../images/off1.png)");
  	*/
  	//0905 add
  	    $(this).siblings().find('.on').removeClass('on');
    $(this).children().addClass('on');
  	
  	return false;
  });

}, // end of BC.home()



confirmPage : function(){
	
},

/****************************************************
On session expiration, we can show the sessionExpired 
dialog.  These are the actions to take when interacting
with that dialog.
****************************************************/
sessionExpired : function() {
	$('#closeBtn').click(function(){	
      	window.top.document.location = BC.global.appPath + '/start';
      	return false;
 	});
},


    /* **************************************
        rideLogin page
  ************************************** */
rideLogin: function() {
	if($.browser.safari) {
		// Safari seems to take issue with opening a new dialog within the iframe of an 
		// existing dialog.  The following code works around this issue.
		$('#rideLogin a.register').addClass('dialog')
		                        .click(function(){top.BC.util.closedialogs(); return true;});
	}
},

// NOTE FROM a298562 (Mike Davis)
//	removed rideLogin function. DOJO calls are dealing with the 
//  required functionality. 

    /* **************************************
        oldProfile page
  ************************************** */
oldProfile : function () {

	if($.browser.safari) {
		// Safari seems to take issue with opening a new dialog within the iframe of an 
		// existing dialog.  The following code works around this issue.
		$('a').addClass('dialog')
		      .click(function(){top.BC.util.closedialogs(); return false;});
	}

	BC.oldProfile = 
	$("#oldUser").validate({
	  	rules:{
	  		prefix: 
	  			{
	  				required: true
	  			},
	  		firstname: 
	  			{
	  				required: true,
	  				maxlength:20,
	  				humanName:true
	  			},
	  		lastname:  
	  			{
	  				required: true,
	  				maxlength:30,
	  				humanName:true
	  			},
	  		newUsername: 
				{
					required: true,
					maxlength: 30,
					minlength: 6,
					alphaNumericeSymbolSetB_mod: true
				},
	  		createPassword:
	  			{
	  				required: true,
	  				minlength: 6,
	  				BCCPassword: true
	  			},
	  		confirmPassword:
	  			{
	  				required: true,
	  				equalTo: "#createPassword"
	  			},
	  		email: 
	  			{ 	required:true,
	  				maxlength: 60, 
	  				email:true 
	  			},
	  		emailConfirm: 
	  			{ 
	  				required:true,
	  				equalTo: "#email"
	  			},
	  		accountNumber: 
				{
					maxlength: 10,
					alphanum: true
				},
	  		ccNumber: 
	  			{
	  				required: true,
	  				creditcard: true
	  			},
	 			securityQ: {
	 				required: true,
	 				minlength:6,
	 				maxlength:150
	 			},
	 			securityA: {
	 				required: true,
	 				maxlength:50
	 			}
	  	},
	    messages :{
			prefix: "Please select a courtesy title.",
			firstname: {
					required: "Please enter your first name.",
					humanName: "Use only alphabetic characters, spaces, and the following special characters: ' . , -",
					maxlength: "Your first name cannot be longer than 20 characters."
				},
			lastname: {
					required: "Please enter your last name.",
					humanName: "Use only alphabetic characters, spaces, and the following special characters: ' . , -",
					maxlength: "Your last name cannot be longer than 30 characters."
				},
			newUsername: {
					required:"Please enter a valid username to continue.",
					minlength:"Your user name must be at least 6 characters.",
					maxlength:"Your user name must be less than 30 characters.",
					alphaNumericeSymbolSetB_mod:"Please use only letters, numbers, and the following special characters: .-:"
				},
			email: "Please enter a valid email address to continue.",
			createPassword: {
					required: "Please enter a valid password to continue.",
					minlength: "Your password must be at least 6 characters long.",
					BCCPassword: "Your password does not meet the minimum password requirements."
				},
			confirmPassword:  "The password you entered does not match. Please enter a valid password to continue.",
			emailConfirm:  "The email address you entered does not match. Please enter a valid email address to continue.",
			emailAddress: "Please enter a valid email address to continue.",
			accountNumber: "Please enter your corporate account number.",
			ccNumber: "Please enter a valid credit card number.",
			securityQ: {
					required: "Please enter your security question.",
					minlength: "Your security question must be at least 6 characters long.",
					maxlength: "You security question must be no more than 150 characters long."
				},
			securityA: {
					required: "Please enter the answer to your security question.",
					maxlength: "Your security answer must be no more than 50 characters long."
				}
		},
	    submitHandler: function(){
			var reqValues = {};
			reqValues["type"] = "matchProfile";
			reqValues["salutation"] = $('#prefix').val(); 
			reqValues["firstname"] = $('#firstname').val();
			reqValues["lastname"] = $('#lastname').val();
			reqValues["email"] = $('#email').val();
			reqValues["emailConfirm"] = $('#emailConfirm').val();
			reqValues["newUserName"] = $('#newUsername').val();
			reqValues["createPassword"] = $('#createPassword').val();
			reqValues["confirmPassword"] = $('#confirmPassword').val();
			reqValues["accountNumber"] = $('#accountNumber').val();
			reqValues["securityQ"] = $('#securityQ').val();
			reqValues["securityA"] = $('#securityA').val();
			reqValues["ccNumber"] = $('#ccNumber').val();
			       
			BC.handleRegistrationSubmit(reqValues);		         					
				
	      	return false;
	    }
	  });


	$('#submit').click(function(){	
		if (BC.oldProfile.form()) {
			$(this).parents('form').submit();
		}
		return false;
	});

},

handleRegistrationSubmit: function(reqValues) {
	var retVal = null;
	var urlStr = BC.global.appPath + '/register';
	dojo.xhrPost({url:urlStr, sync:true, content:reqValues,
         					load:function(raw) {retVal = raw;}});
         					
	if (retVal === " - Success") {
		BC.handleLoginAfterRegistration(reqValues['newUserName'], reqValues['createPassword']);
	} else {
		var errorMsg;
		var okFunc = top.BC.util.closetopdialog;
		
		if (retVal === null) {
			errorMsg = "An error occured. Please do not enter any invalid characters like + ' . - * etc.";
		} else if (retVal === " - Account Domain Mismatch.") {
			errorMsg = "The email address you have entered does not match those we \nhave on file for your company. Please enter your corporate email address \nor call 800-672-7676 for assistance.";
		} else if (retVal === " - No Profile Found.") {
			errorMsg = "We could not find your profile based on the information you entered.";
		} else if (retVal === " - Already Logged In.") {
			errorMsg = "You are already logged in to the system.";
			okFunc = top.BC.util.closedialogs;
		} else if (retVal === " - Password Policy Error.") {
			errorMsg = "The password you entered does not meet the password policy.";
		} else if (retVal === " - Profile Already Matched.") {
			errorMsg = "This account has already been registered. If you forgot your password, please click <a href='" + BC.global.appPath + "/forgotPwd'>here</a>.";
		} else if (retVal === " - Username Already In Use.") {
			errorMsg = "We're sorry. The username you have entered is already in use. Please enter a different username.";
		} else if (retVal === " - Password not strong.") {
			errorMsg = "Password should be a combination of uppercase,lowercase,numeric or special characters.";
		} else {
			errorMsg = "An unexpected error occurred trying to process your data.\nPlease try again later.";
			okFunc = top.BC.util.closedialogs;
		}

		
		//BC.alertWithOKFunc(errorMsg, okFunc);
		$('#dialogErrorMessagesWindow').show().find('ul li strong').html(errorMsg);
	}		 
	
	return false;        					
},

handleLoginAfterRegistration: function(user, pw) {
	var loginUrlStr = BC.global.appPath  + "/aloginpopup";
	var reqValues = {};
	reqValues["USERID"] = user;
	reqValues["password"] = pw;
	  
	var retVal = null;
	dojo.xhrPost({url:loginUrlStr,
	              sync:true,
	              content:reqValues,
	              load:function(raw) { retVal = raw; } });
	
	if(retVal === ' - Successful Login.') {
		// Legacy implementations used goPayment.  Given the 
		// obvious misnomer in most uses, new code should use
		// afterRegistrationPopup.  Each usage of the login popup
		// should implement it's own afterRegistrationPopup method.
		if (window.top.goPayment) {
			BC.util.closedialogs();
			window.top.goPayment();
			
		} else if (window.top.afterRegistrationPopup) {
			window.top.afterRegistrationPopup();
		}
	 } else {
	 	$('#dialogErrorMessagesWindow').show().find('ul li strong').html(retVal);
	}
	
	return false;

},
    /* **************************************
        newProfile page
  ************************************** */
newProfile : function (){

	if($.browser.safari) {
		// Safari seems to take issue with opening a new dialog within the iframe of an 
		// existing dialog.  The following code works around this issue.
		$('a').addClass('dialog')
		      .click(function(){top.BC.util.closedialogs(); return true;});
	}

  BC.newProfile = $("#newUser").validate({
	  	rules:{
	  		prefix: 
	  			{
	  				required: true
	  			},
	  		firstname: 
	  			{
	  				required: true,
	  				maxlength:20,
	  				humanName:true
	  			},
	  		lastname:  
	  			{
	  				required: true,
	  				maxlength:30,
	  				humanName:true
	  			},
	  		newUsername: 
				{
					required: true,
					maxlength: 30,
					minlength: 6,
					alphaNumericeSymbolSetB_mod: true
				},
	  		createPassword:
	  			{
	  				required: true,
	  				minlength: 6,
	  				BCCPassword: true
	  			},
	  		confirmPassword:
	  			{
	  				required: true,
	  				equalTo: "#createPassword"
	  			},
	  		email: 
	  			{ 	required:true,
	  				maxlength: 60, 
	  				email:true 
	  			},
	  		emailConfirm: 
	  			{ 
	  				required:true,
	  				equalTo: "#email"
	  			},
	 		securityQ: {
	 				required: true,
	 				minlength:6,
	 				maxlength:150
	 			},
	 		securityA: {
	 				required: true,
	 				minlength:1, 
	 				maxlength:50
	 			}
	  	},
    messages :{
		prefix: "Please select a courtesy title.",
		firstname: {
				required: "Please enter your first name.",
				humanName: "Use only alphabetic characters, spaces, and the following special characters: ' . , -",
				maxlength: "Your first name cannot be longer than 20 characters."
			},
		lastname: {
				required: "Please enter your last name.",
				humanName: "Use only alphabetic characters, spaces, and the following special characters: ' . , -",
				maxlength: "Your last name cannot be longer than 30 characters."
			},
		newUsername:  {
				required:"Please enter a valid username to continue.",
				minlength:"Your user name must be at least 6 characters.",
				maxlength:"Your user name must be less than 30 characters.",
					alphaNumericeSymbolSetB_mod:"Please use only letters, numbers, and the following special characters: .-:"
			},
		email: "Please enter a valid email address to continue.",
		createPassword: {
				required: "Please enter a valid password to continue.",
				minlength: "Your password must be at least 6 characters long.",
				BCCPassword: "Your password does not meet the minimum password requirements."
			},
		confirmPassword:  "The password you entered does not match. Please enter a valid password to continue.",
		emailConfirm:  "The email address you entered does not match. Please enter a valid email address to continue.",
		emailAddress: "Please enter a valid email address to continue.",
		securityQ: {
				required: "Please enter your security question.",
				minlength: "Your security question must be at least 6 characters long.",
				maxlength: "You security question must be no more than 150 characters long."
			},
		securityA: {
				required: "Please enter the answer to your security question.",
				maxlength: "Your security answer must be no more than 50 characters long."
			}
	},
	    submitHandler: function(){
			var reqValues = {};
			reqValues["type"] = "newProfile";
			reqValues["salutation"] = $('#prefix').val(); 
			reqValues["firstname"] = $('#firstname').val();
			reqValues["lastname"] = $('#lastname').val();
			reqValues["email"] = $('#email').val();
			reqValues["emailConfirm"] = $('#emailConfirm').val();
			reqValues["newUserName"] = $('#newUsername').val();
			reqValues["createPassword"] = $('#createPassword').val();
			reqValues["confirmPassword"] = $('#confirmPassword').val();
			reqValues["securityQ"] = $('#securityQ').val();
			reqValues["securityA"] = $('#securityA').val();
			       
			BC.handleRegistrationSubmit(reqValues);		         					
				
	      	return false;
	     }
  });
  
	$('#submit').click(function(){	
		if (BC.newProfile.form()) {
			$(this).parents('form').submit();
		}
		return false;
	});
  

},
    /* **************************************
        companyProfile page
  ************************************** */
companyProfile : function (){

	if($.browser.safari) {
		// Safari seems to take issue with opening a new dialog within the iframe of an 
		// existing dialog.  The following code works around this issue.
		$('a').addClass('dialog')
		      .click(function(){top.BC.util.closedialogs(); return true;});
	}

  BC.companyProfile = $("#companyUser").validate({
	  	rules:{
	  		prefix: 
	  			{
	  				required: true
	  			},
	  		firstname: 
	  			{
	  				required: true,
	  				maxlength:20,
	  				humanName:true
	  			},
	  		lastname:  
	  			{
	  				required: true,
	  				maxlength:30,
	  				humanName:true
	  			},
	  		newUsername: 
				{
					required: true,
					maxlength: 30,
					minlength: 6,
					alphaNumericeSymbolSetB_mod: true
				},
	  		createPassword:
	  			{
	  				required: true,
	  				minlength: 6,
	  				BCCPassword: true
	  			},
	  		confirmPassword:
	  			{
	  				required: true,
	  				equalTo: "#createPassword"
	  			},
	  		email: 
	  			{ 	required:true,
	  				maxlength: 60, 
	  				email:true 
	  			},
	  		emailConfirm: 
	  			{ 
	  				required:true,
	  				equalTo: "#email"
	  			},
	  		accountNumber: 
				{
					required: true,
					maxlength: 10,
					alphanum: true
				},
	  		corpEmail: 
	  			{
	  				required: true,
	  				maxlength: 60,
	  				email: true
	  			},
	 			securityQ: {
	 				required: true,
	 				minlength:6,
	 				maxlength:150
	 			},
	 			securityA: {
	 				required: true,
	 				minlength:1, 
	 				maxlength:50
	 			}
	  	},
    messages :{
		prefix: "Please select a courtesy title.",
		firstname: {
				required: "Please enter your first name.",
				humanName: "Use only alphabetic characters, spaces, and the following special characters: ' . , -",
				maxlength: "Your first name cannot be longer than 20 characters."
			},
		lastname: {
				required: "Please enter your last name.",
				humanName: "Use only alphabetic characters, spaces, and the following special characters: ' . , -",
				maxlength: "Your last name cannot be longer than 30 characters."
			},
		newUsername:  {
				required:"Please enter a valid username to continue.",
				minlength:"Your user name must be at least 6 characters.",
				maxlength:"Your user name must be less than 30 characters.",
					alphaNumericeSymbolSetB_mod:"Please use only letters, numbers, and the following special characters: .-:"
			},
		email: "Please enter a valid email address to continue.",
		createPassword: {
				required: "Please enter a valid password to continue.",
				minlength: "Your password must be at least 6 characters long.",
				BCCPassword: "Your password does not meet the minimum password requirements."
			},
		confirmPassword:  "The password you entered does not match. Please enter a valid password to continue.",
		emailConfirm:  "The email address you entered does not match. Please enter a valid email address to continue.",
		emailAddress: "Please enter a valid email address to continue.",
		accountNumber: "Please enter your corporate account number.",
		corpEmail: "Please enter your business email address.",
			securityQ: {
				required: "Please enter your security question.",
				minlength: "Your security question must be at least 6 characters long.",
				maxlength: "You security question must be no more than 150 characters long."
			},
			securityA: {
				required: "Please enter the answer to your security question.",
				maxlength: "Your security answer must be no more than 50 characters long."
			}
	},
	    submitHandler: function(){
			var reqValues = {};
			reqValues["type"] = "newCorpProfile";
			reqValues["salutation"] = $('#prefix').val(); 
			reqValues["firstname"] = $('#firstname').val();
			reqValues["lastname"] = $('#lastname').val();
			reqValues["email"] = $('#email').val();
			reqValues["emailConfirm"] = $('#emailConfirm').val();
			reqValues["newUserName"] = $('#newUsername').val();
			reqValues["createPassword"] = $('#createPassword').val();
			reqValues["confirmPassword"] = $('#confirmPassword').val();
			reqValues["accountNumber"] = $('#accountNumber').val();
			reqValues["securityQ"] = $('#securityQ').val();
			reqValues["securityA"] = $('#securityA').val();
			reqValues["corpEmail"] = $('#corpEmail').val();
			       
			       
			BC.handleRegistrationSubmit(reqValues);		         					
				
	      	return false;
	     }
  });

	$('#submit').click(function(){	
		if (BC.companyProfile.form()) {
			$(this).parents('form').submit();
		}
		return false;
	});

},

  
  emailConfirmation : function(){
    
    //emailConfirmation validation	
    BC.emailconfirmVal = $("#emailConfirm").validate({
    	rules: {
    	  username: { required : true, multemails: true }
    	},
    	submitHandler: function(form) {
    		BC.util.closedialogs();
    		
    	}
    });
    
  }, // end of BC.emailConfirmation()

  // validation object. BC.validation
  validation : {

    /* **************************************
    custom validation callback. 
    does the fancy tooltip stuff like anthropologie.
    see: https://www.anthropologie.com/anthro/arc/a/richcart.jsp
    ************************************** */

    customDisplay : function(errorMap, errorList,successList) {

      function generateTooltip(elem,msg){
        $(elem).attr('title',msg).tooltip({ 
            delay: 0, 
            showURL: false, 
            showBody: " - ", 
            positionToElement: true,
            extraClass: "validation", 
            fixPNG: true, 
            opacity: 0.95, 
            noClick : true,
            left: -15 
          }); 
      }

      function showFirstTooltip(){    // scroll the first error into view. (Doesnt actually show the tooltip.. yet)
        var errToTop = $('span.validationError').filter(function(){
                          if ($(this).parents(':hidden').length) { return false; }  // perf: this is sorta expensive. 
                          else { return true; }
                        }).eq(0).offset();
       if (errToTop && errToTop.top < $(window).scrollTop()) {
       		$('html,body').animate({scrollTop: errToTop.top - 50 + "px"},700);
       	}
      }
      

      // if we're on vehicle selection page. just do the normal thang:
      if ($(this.currentForm).is('#vehicleF') ) {
        this.defaultShowErrors();
        return;
      }
    
      // remove all validation error spans.
      $(successList).removeClass('error').unbind('mouseenter').unbind('mouseleave') // the unbind() call kills the associated tooltip.
                    .parent('.validationError').removeClass('validationError').unbind('mouseenter').unbind('mouseleave'); // this parent only applies to MSIE. (see conditional a few lines down)
       $('#tooltipVB, #tooltip, .validation').hide();
      
      // throw a red border around each error and make its tooltip.
      $.each(errorList,function(i,val){
        if ( $.browser.msie && $.browser.version < 8 && $(val.element).is('select') ){ // IE doesnt support border on a SELECT
          if (! $(val.element).parents('span.veErrorSpan').length ){  // check to see if its wrapped in this span anywhere..
            $(val.element).wrap('<span class="validationError veErrorSpan"/>');
          } else {
            $(val.element).parents('span.veErrorSpan').addClass('validationError');
        	}
        	 generateTooltip( $(val.element).parents('span.veErrorSpan') ,val.message);
        }
        else if ($(val.element).is('input:radio')){
          $(val.element).parent().addClass('validationError');
          generateTooltip( $(val.element).parent() ,val.message);
        }
        else {
          $(val.element).addClass('error');
          generateTooltip(val.element,val.message);
        }
      });
      
      if (errorList.length) { showFirstTooltip(); } // show the tooltip for the first one.


      //this.defaultShowErrors();  // this is the normal error display functionality.

    }, // end of BC.validation.customDisplay()


    /* **************************************
      contains custom validation rules.
    ************************************** */
    setUpDefaults : function(){
      
      /*  commented out by SL.
    
        // a new class rule to group all three methods
      $.validator.addClassRules({
      	requiredDateRange: {required:true, date:true, dateRange:true}
      });
      

      */
      
      // alphaNumericSetB without space or comma
      $.validator.addMethod("alphaNumericeSymbolSetB_mod", function(value, element) {
      			return this.optional(element) || /^[-a-zA-Z0-9.:]*$/.test(value);
      });
      
      // test for OPTIONAL email
      $.validator.addMethod("optional_email", function(value, element) {
      			return !jQuery.validator.methods.required.call(this, jQuery.trim(element.value), element) ||
      					jQuery.validator.methods.email.call(this, jQuery.trim(element.value), element);
      });
      
      // tests for alphanumeric data only
      // author: Michael Davis  (a2984562)
      // created: 10/29/2008
      $.validator.addMethod("humanName", function (value, element) {
      				return this.optional(element) || /^[\-a-zA-Z '.,]*$/.test(value);
      			}, "Please enter only alphabetic characters, spaces, and the following special characters: ' . , -"); 
      
      $.validator.addMethod("alphanum", 
      			function(value, element) {
      				return this.optional(element) || /^[0-9a-zA-Z]*$/.test(value);
      			},
      			"Please enter only letters and numbers.");
      
      // tests for valid password based on BCC requirements. Requirements are as 
      // follows:
      // at least 6 chars
      // at least 2 of 
      //	 1) upercase letters
      //	 2) lower case letters
      //	 3) digits
      //	 4) special characters (consisting of ????)
      // not contain significant portions of the user's account name or full name (or username???)
      // exclude characters from the "bad characters list"
      // author: Michael Davis (a298562)
      // created: 10/29/2008
      $.validator.addMethod("BCCPassword",
      			function(value, element) {
      				if (this.optional(element)) { return true; }
      				if (! /^[._=0-9A-Za-z]*$/.test(value)) { return false; }
      				
      				var charSetsUsed = 0;
      				
      				if (/[A-Z]/.test(value)) { ++charSetsUsed; }
      				if (/[a-z]/.test(value)) { ++charSetsUsed; }
      				if (/[0-9]/.test(value)) { ++charSetsUsed; }
      				if (/[._=]/.test(value)) { ++charSetsUsed; } 
      				
      				if(charSetsUsed < 2) { return false; }
      				
      				// no double dot
      				if(/\.\./.test(value)) { return false; }
      				
      				return true;
      			},
      			// TODO: We need a better password error message
      			"Invalid password");
      
      // a custom method for validating the date range
      $.validator.addMethod("isTodayOrFuture", function(value, element) {
      	return BC.validation.getToday() <= new Date( $(element).val() );
      }, "Please enter a present or future date.");
    
    
      // add validation method for 24 time
      jQuery.validator.addMethod('24time',function(value,element){
        return this.optional(element) || /^(([0-9])|([0-1][0-9]|[2][0-3])):([0-5][0-9])$/.test(value);
      },'Please enter a valid time');

      // add validation method for multiple email addresses. delimited by ; or ,
      jQuery.validator.addMethod('multemails',function(value,element){
        if (this.optional(element)) { return true; }
            	   
  	    var emails = element.value.split(';');
  	    for (var i =0; i<emails.length; i++){
  	      var trimmed = $.trim(emails[i]);  // kill whitespace
  	      if ($.validator.methods.email.call($.validator.prototype,null,{value: trimmed},element)) {
  	      		continue;  // this one is good.
  	      } else {
  	      		return false; // wasnt an email address..
  	      } 
  	    }
  	    return true; // we're okay.    	    
      },'Please enter one or more valid email addresses.');

    	jQuery.validator.addMethod('currentdt',function(value,element){
    		var dt = value.split("/");
			var now = new Date();
    		if ((dt[0] <= now.getMonth()+1)  && 
    			(dt[1] <= now.getDate()) && 
    			(dt[2] <= now.getFullYear())) {
    			return true;
    		}
    		
    	},"Please enter a date within todays date");
    	jQuery.validator.addMethod('12monthdt',function(value,element){
    		var dt = value.split("/");
    		var now = new Date();
    		if ((dt[0] >= now.getMonth()+1)  && 
    			(dt[1] >= now.getDate()) && 
    			(dt[2] >= now.getFullYear()-1)) {
    		 	return true;
    		 }
    		
    	},"Please enter a range within 12 months");
	
      // add validation method for phone numbers
      jQuery.validator.addMethod('phonenum',function(value,element){

        value = value.replace(/-|\(|\)|\.|\+| /g,'');  // strip out: ()-.+ <space>
        return this.optional(element) || 
        		    /* number validation from jquery.validate.js */
        		/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value) && value.length > 7;
      },'Please enter a valid phone number');


	//  validation method for expiration month
      jQuery.validator.addMethod('ccexpmonth',function(value,element){
                                                                  // ASSUMPTION: previous years will NOT be outputted into the markup.
        if ($('#exp_date_year')[0].selectedIndex != 1) { return true; }
       // if we're not looking at the current year, we'll be fine. 
        var now = new Date();
        if ( value < now.getMonth()+1 ) { 
        	return false;  // if the given value is earlier or this month, then fail.
        } else { 
        	return true; 
        }
      },'Please enter a future month');
      
      
      
      // add validation method for cc expiration month
      jQuery.validator.addMethod('ccexpmonth',function(value,element){
                                                                     // ASSUMPTION: previous years will NOT be outputted into the markup.
        if ($('#exp_date_year')[0].selectedIndex != 1) { return true; }  // if we're not looking at the current year, we'll be fine. 
        var now = new Date();
        if ( value < now.getMonth()+1 ) { return false; }      // if the given value is earlier or this month, then fail.
        
		return true;
      },'Please enter a future month');

      // new validation style!
      jQuery.validator.setDefaults({
        showErrors: BC.validation.customDisplay,
        rules : {
          date: { date : true, isTodayOrFuture: true },
          time: { '24time' : true }
        }
      });	

    }, // end of BC.validation.setUpDefaults()

    
// returns Today, without time info.
    getToday : function(){
      var today = new Date();
      today = new Date(today.getFullYear(),today.getMonth(),today.getDate());
      return today;
    } // end of BC.validation.getToday()
    
  }, // end of BC.validation obj


  util : {
    
    /* **************************************
      callback fired after a tab loads in.
    ************************************** */
    tabsload : function(evt,ui){
  
      BC.commontab();
  
      var theid = $(ui.tab).attr('id').match(/(.*?)-tab/)[1]; // read the ID and strip off -tab
      //alert("In tabs load the id " + theid);
      BC.util.fire(theid);
    }, // end of BC.util.tabsload()
  
  
    /* **************************************
      fire load events 
    ************************************** */
    fire : function(func,namespace, args){
      
      namespace = namespace || BC;
      //alert (" In fire name space = " + namespace);
      
      if (typeof namespace[func] == 'function'){
        namespace[func](args);
      } 
  
    }, // end of BC.util.fire()
    
    /* **************************************
      fire external events 
    ************************************** */
    fireExternal : function(func,args){
      //alert(" In fire external func = " + func );
      var namespace = BC.config.externalNamespace;
      BC.util.fire(func,namespace,args);
  
    }, // end of BC.util.fireExternal()
    
  
    
    // navigational helper function.
    goTo : function(where){
      //alert("In go to where = " + where);
      var tabMap = BC.config.tabMap;
			window.top.$('#book_a_ride > ul').tabs('enable', tabMap[where]).tabs('select', tabMap[where]);
  		
    }, // end of BC.util.goTo
    
    
    /* **************************************
      dialog loading helper
    ************************************** */
    dialog : function(title,destination,opts){
      title = title || '';
      var defaults = {
        width   : 700,
        height  : 495, 
        modal   : true,
        scroll  : false,
        overlay : { opacity: 0.75, backgroundColor: '#000',zIndex:150 },
        bgiframe: true,
        transfer: false  // probably being overridden
      };
    	opts = $.extend({}, defaults, opts); // let people override the defaults if they like.
    
    	opts.transfer = false; // no ghosting
    	title = '';            // no title on any modal window.
    	
    	// quit if theres already a modal open.
    	if ($('div.ui-dialog:visible').length) { 
    		console.log('already a modal open. aborting'); 
    		return; 
    	} 
    	
    	//0905add
      var $newdialog = null;

      var scrolling = opts.scroll ? 'auto' : 'no';
      
      if        (typeof destination === 'string'){   // URL = iframe
        if (BC.config.stripDotHTML)  { destination = destination.replace('.html',''); }
        
       //0905 $newdialog = $('<iframe/>').css('width',defaults.width-32 + 'px').attr('src',destination).attr('frameBorder', '0').attr('allowtransparency','true').attr('scrolling', scrolling ); 
        $newdialog = window.top.$('<iframe/>').css('width',defaults.width-32 + 'px').attr('src',destination).attr('frameBorder', '0').attr('allowtransparency','true').attr('scrolling', scrolling ); 

      } else if (typeof destination === 'object'){   // element on the page.
        $newdialog = window.top.$(destination); 
      }                         
      
     //0905 $newdialog.attr('title',title).hide().appendTo('body').dialog(opts).show();
     //0905add
           $newdialog.attr('title',title).hide().appendTo('window.top.document.body').dialog(opts).show()
       .load(function(){
  			// because safari loads in wrong modal sometimes.
  			var dialogIframe = $newdialog;
  			if (dialogIframe.length && $.browser.safari){ 
  			  var contents = dialogIframe.contents()[0].location.href.match(/.*\/(.*)$/)[1];
  			  var src = dialogIframe.attr('src').match(/.*\/(.*)$/)[1];
  
  			  if ( contents != src  ){  // i couldn't tell you why this happens.. but sometimes it does..
            dialogIframe.contents().find('body > *').css('visibility','hidden');   // make it invisible..
            dialogIframe.attr('src', dialogIframe.attr('src')); // hard refresh of iframe content.
  			  }
  			}
      });
 
      
  
    }, // end of BC.util.dialog()
    
    /***************************************
    * closetopdialog works like closedialogs, 
    * except it closes only the TOP (last)
    * dialog, rather than ALL dialogs.
    ***************************************/
    closetopdialog : function () {
      top.$('div.ui-dialog:visible:last').find('.ui-dialog-content').dialog('close');
    }, // end of BC.util.closetopdialog()
        
       
    /* **************************************
      dialog closing helper
    ************************************** */
    closedialogs : function(){
      top.$('div.ui-dialog').find('.ui-dialog-content').dialog('close');
    } // end of BC.util.closedialogs()
    
  } // end of BC.util object

}; // end of BC 
  // but it is extended more in profile.js, controlcenter.js, and bookaride.js.



$(document).ready(function(){
  BC.common(); 
  //alert(" firing " + document.body.id);
  BC.util.fire(document.body.id);  // technique is from http://paulirish.com/2008/automate-firing-of-onload-events/
  BC.commontab();                 // this stuff needs to fire regardless of if there's a id on the body
  if(document.getElementById('errorMessagesWindow') !== null) {
  	BC.alert( document.getElementById('errorMessagesWindow').innerHTML );
  }

	if(typeof(pagetab) !== "undefined") {
		//alert(pagetab);
		if (pagetab === 'whenWhere' ) {
			setHourRide();
		} else if (pagetab === 'payment' ) {
			rePopulate();
		}
	}

  //BC.util.fire(vehicleSelection); 
  
}); 




// plugins that need a home
(function () {
  // from: http://remysharp.com/2007/03/19/a-few-more-jquery-plugins-crop-labelover-and-pluck/#labelOver
  $.fn.labelOver = function(overClass) {
  	return this.each(function(){
  		var label = $(this);
  		var f = label.attr('for');
  		if (f) {
  			var input = $('#' + f);

  			this.hide = function() {
  			  label.css({ textIndent: -10000 });
  			};

  			this.show = function() {
  			  if (input.val() === '') { label.css({ textIndent: 0 }); }
  			};

  			// handlers
  			input.focus(this.hide);
  			input.blur(this.show);
  		  label.addClass(overClass).click(function(){ input.focus(); });

  			if (input.val() !== '') { this.hide(); } 
  		}
  	});
  };

  $.fn.inputGroupToggle = function () {
    var groups = {};
    return this.each(function () {
      var $input = $(this);
      if (typeof groups[this.name] === 'undefined') {
        groups[this.name] = $('input[name="' + this.name + '"]').map(function () {
          return $('#' + this.value).get(0);
        });
      }

      $input.change(function () {
        groups[this.name].hide();
        if ($input.is(':checked')) { // useful for check boxes
          groups[this.name].filter('#' + this.value).show();
        }
      }).click(function (){
        $input.triggerHandler('change');
      });

    // finally, trigger clicking the pre-selected/checked elements
    }).filter(':checked').click().end();
  };

  // there's some argument that I should just overload the change event handler
  // but I want to run it past a few 'jQueryians' first - IE does treat keyboard
  // navigation, i.e. selecting the radio element as a click...bizarre - but useful.
  $.fn.radioChange = function (fn) { 
    return this.each(function () {
      if (!$.browser.msie) {
        $(this).change(fn);
      } else {
        $(this).click(fn);
      }
    });
  };
  
  $.fn.deserialize = function (data) {
    function getQuery(s) {
        var query = {};

        s.replace(/\b([^&=]*)=([^&=]*)\b/g, function (m, a, d) {
            if (typeof query[a] != 'undefined') {
                query[a] += ',' + d;
            } else {
                query[a] = d;
            }
        });

        return query;
    }
    
    if (typeof data == 'string') {
      data = getQuery(data);
      // alert("deserialized data=" + data);
    }
    
    return this.each(function () {
      $(':input', this).each(function () {
      	if ( $(this).is('input[name=as_location]') ) { return true; } // skip the address/airport/POI radios. //Added by Paul Irish 18 Sept 2008
        var v = null;
        
        if ((this.type === 'checkbox' || this.type === 'radio') && typeof data[this.name] !== 'undefined') {
          // checkboxes and radios have to be found
          v = decodeURIComponent(data[this.name].replace(/\+/g, ' '));
          $('input[name="' + this.name + '"]').removeAttr('checked').filter('[value="' + v + '"]').attr('checked', 'checked');
        } else if (typeof data[this.name] !== 'undefined') {
          $(this).val(decodeURIComponent(data[this.name].replace(/\+/g, ' ')));
        }
       });
    });
  };

  $.fn.replaceWithAndReturn = function( value ) {
    $( value ).insertAfter(this).remove();
    $(this).remove();
    return $(value);
  };
  
  // a goodie for ie.
  $.fn.triggerHasLayout = function(){
    if (! $.browser.msie) { return; }
    return $(this).each(function(){
      $(this).css('zoom', ($(this).css('zoom') == 1) ? 0 : 1 );  
    });
  };

  $.fn.hoverClass = function(){
    return $(this).hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
  };

  $.easing.elasout = function(x, t, b, c, d) {
    var s = 1.70158;
    var p = 0;
    var a = c;
    if (t === 0)  { return b; } 
    if ((t/=d) === 1) { return b + c; }
    if (!p) { p = d * 0.3; }
    if (a < Math.abs(c)) { a = c; s = p/4; }
    else { s = p/(2*Math.PI) * Math.asin (c/a); }
    return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};
  
	
	$.fn.indexOf = function(selector){
	  // this = group of items
	  return $.inArray( $(this).filter(selector)[0], $.makeArray( this ));
	};
	
  // :visible doesn't take in to account the parent's visiblity - 'reallyvisible' does...daft name, but does the job.
  $.extend($.expr[ ":" ], { reallyvisible : "!(jQuery(a).is(':hidden') || jQuery(a).parents(':hidden').length)" });



})(jQuery);


if (typeof console == "undefined"){
 var console = { log : function(str){ }};
}

function getMultipleIDs(){

	var ids = {};
	$('*[id!=""]').each(function(){
		if (ids[this.id]) {
			ids[this.id]++;
		}
		ids[this.id] = 1;
	});
  return ids;

}

function getFunctionName(){  // for the lulz
  for (var x in this) { 
  	if (typeof this[x] === 'function') {
  		if (arguments.callee.toString() === this[x].toString()) { console.log(x); }
  	}
  }
}


 //0905 add
 
(function(){ 
	/*Use Object Detection to detect IE6*/ 
	var m = document.uniqueID /*IE*/ && document.compatMode /*>=IE6*/ && !window.XMLHttpRequest /*<=IE6*/ && document.execCommand ; 
	try { 
		if(!!m) { 
			m("BackgroundImageCache", false, true); /* = IE6 only */ 
		}
	} catch(oh){}
})();
  



var SVR = {
  
  
  whenWhere_oi : function(){
    
    
    
  },
  
  
  vehicle : function(){
    
    
    
  },
  
  passengers : function(){
    // alert(" In SVR firing passengers function ");
    $("#passenger").form().submit(); //Added submit here
  }
  
  };
