$(document).ready(function () {
	/** based on different button IDs, submit form to different URLs**/
	
	
	//set button ID,  add hash symbol followed by the HTML id value
	var btnId1 = "#btn1";
	var btnId2 = "#btn2";	
	
	//set the form URLs
	var formAction1 = "https://erecharge.starcomms.com:8443/tellin/usr/eppc/lifetreeloginsuc.do";
	//var formAction1 = "https://erecharge.starcomms.com:8443/tellin/usr/eppc/lifetreeloginsuc.do";
	var formAction2 = "https://selfcare.starcomms.com/concierge/web/ip/login?p_p_id=IPLogin&p_p_action=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_IPLogin_struts_action=%2Fext%2Flogin%2Fhome";
	
	//set the form ID
	var formID 	=	"#stform";
	
	//handle button 1
	$(btnId1).click(function(){
		//replace form action
		$(formID).attr('action', formAction1);
		
		//replace username and password inputs
		$('#TextBox1').attr("name", "userLoginName");
		$('#TextBox2').attr("name", "userPassword");
		
		//then submit
		$(formID).submit();	
	})
	
	//handle button 
	$(btnId2).click(function(){
		$(formID).attr('action', formAction2);
		$(formID).submit();
	})
	
	//handle forgot password
	$("#forgotPassword").click(function(){	
		$("#hdnAction").attr('value', "forgotpassword");
		$(formID).attr('action', formAction2);
		$(formID).submit();
	})
	
	//call in qtip rollover
	$('#btn1').qtip({
	   content: 'Click the button to pay for Data service via Starcomms Recharge Cards',
	   show: 'mouseover',
	   hide: 'mouseout',
	   position: {
		      corner: {
		         target: 'top',
		         tooltip: 'bottomLeft'
		      }
		   }
	})
	
	$('#btn2').qtip({
	   content: 'Click the button to pay for data service via Debit Cards and to manage your account',
	   show: 'mouseover',
	   hide: 'mouseout',
	   position: {
		      corner: {
		         target: 'top',
		         tooltip: 'bottomLeft'
		      }
		   }
	})
});


