// JavaScript Document

var logbook_expand_variable='', wishlist_expand_variable='', itinerary_expand_variable='', quotation_expand_variable='',message_expand_variable='';
var all_itinerary_expand_variable=[];
var all_quotation_expand_variable=[];
var all_message_expand_variable=[];


function logbook_update(){
	if(logbook_expand_variable==''){
		$('#loggedout_logbook').css('display','');
		$('#loggedin_logbook').css('display','none');
		$('#loggedin_logbook_tr').css('display','none');
		//$id('log_wishlist_content').innerHTML!='';
	}else{
		var total_items = parseInt(logbook_expand_variable['wishlist'])+parseInt(logbook_expand_variable['quotes'])+parseInt(logbook_expand_variable['message'])+parseInt(logbook_expand_variable['bookings']);
		
		$('#loggedout_logbook').css('display','none');
		$('#loggedin_logbook').css('display','');
		$('#loggedin_logbook_tr').css('display','');
		$('#total_items').html(total_items);
	}
	if($('#expand_link').css('display') == 'none'){
		var logbook_expanded=1;
	}
	try{
	if($('#log_wishlist_content').html()){
		var i=1;
	}}catch(e){alert(e.description)}
	try{
		if($('#log_itinerary_content').html()){
		var j=1;
	}}catch(e){alert(e.description)}
	
	$('#logbook_content').html('');
	if(logbook_expanded==1){
		logbook_expand_fun(logbook_expand_variable);
	}
	if(i==1)
		wishlist_expand_fun(wishlist_expand_variable);
	if(j==1)
		itinerary_expand_fun(itinerary_expand_variable);
}


function expand_logbook(){
	$.get(ROOT_PATH+'aj_request.php?aj=user.aj_expand_log','',expand_response);
}

function expand_response(response){
	if(response=='login'){
		show_error_login_div();
	}else{
		
		eval("var res = "+response);
		if(logbook_expand_variable!=''){
			logbook_expand_fun(res);
		}
		logbook_expand_variable=res;
		logbook_update();  
	}
}

function logbook_expand_fun(res){ 
	
	html='';
	html += "<table width='100%'>";
	
	html += "<tr><td colspan='2' width='100%' style='padding-left:11px' align='left'><a  href='javascript:void(0)' onclick=\"setLocation('message_expand');\" id='log_message_link2' >"+res['message']+" Message(s) ";
	
	if(res['new_message']>0)
		html+="<span id='log_new_message_span' >( <span id='log_new_message' >"+res['new_message']+'</span> new )</span>';
	
	html+="</a> </td></tr><tr><td colspan='2' id='log_message_content' ></td></tr>";
	
	html += "<tr><td width='15%' align='right' ><a href='javascript:void(0)'  id='log_wishlist_link' onclick='wishlist_expand()'>[<span id='wishlist_sign'>+</span>]</a></td><td width='85%' align='left'><a  href='javascript:void(0)' id='log_wishlist_link2' onclick='wishlist_expand()'>"+res['wishlist']+" Wishlist(s) </a> &nbsp;-&nbsp;"+res['wishlist_items']+"&nbsp;Item(s)</td></tr><tr><td colspan='2' id= 'log_wishlist_content' ></td></tr>";

	html += "<tr><td width='15%' align='right' ><a href='javascript:void(0)' onclick=\"setLocation('quotation_expand');\"  id='log_quotation_link'>[<span id='quotation_sign'>+</span>]</a></td><td width='85%' align='left'><a  href='javascript:void(0)' onclick=\" setLocation('quotation_expand'); \" id='log_quotation_link2' >"+res['quotes']+" Request(s) ";
	
	html+="</a> </td></tr><tr><td colspan='2' id= 'log_quotation_content' ></td></tr>";
	
	html += "<tr><td width='15%' align='right' ><a href='javascript:void(0)' onclick=\"setLocation('booking_expand');\"  id='log_booking_link'>[<span id='booking_sign'>+</span>]</a></td><td width='85%' align='left'><a  href='javascript:void(0)' onclick=\"setLocation('booking_expand');\" id='log_booking_link2' >"+res['bookings']+" Booking(s)";
	
	html+="</a> </td></tr><tr><td colspan='2' id= 'log_booking_content' ></td></tr>";
	
	html += "</table>";
	
	$('#logbook_content').html(html);
	$('#expand_link').css('display','none');
	$('#collapse_link').css('display','');
}


function collapse_logbook(){
	$('#expand_link').css('display','');
	$('#collapse_link').css('display','none');
	$('#logbook_content').html('');
}

function quotation_expand(){
	var title="My Requests";
	
	setTitle("<span>My Requests</span>");
	storeInHistory();
	$.get(ROOT_PATH+'aj_request.php?aj=user.aj_expand_quotation','',quotation_expand_response);
}

function quotation_expand_response(response){
if(response=='login'){
 show_error_login_div();
}else{
	html='';
	
	eval("var res_arr = "+response);
	quotation_expand_fun(res_arr);
	quotation_expand_variable = res_arr;
	}
}

function quotation_expand_fun(res_arr){
	html='';
	html += "<table width='100%'>";
	$(res_arr).each(function(i,res){      
		html += "<tr><td width='15%'>&nbsp;</td><td width='85%'><table cellspacing='0' cellpadind='0'><tr><td> <a class='place-explorer'  id='quotation_link_"+res['itinerary_id']+"' href='javascript:void(0)' onclick=\"setLocation('getPage','user.quote_details','req_id="+res['itinerary_id']+"');\" >";
		
		html+=res['request_name']+"</a></td></tr><tr><td></td><td id='quotation_content_"+res['itinerary_id']+"'></td></tr></table></td></tr>";
	 });
	html +="</table>";
	
	$('#log_quotation_content').html(html);
	$('#log_quotation_link2').click(function(){setLocation('quotation_collapse');});
	$('#log_quotation_link').click(function(){setLocation('quotation_collapse');});
	$('#quotation_sign').html('<b>-</b>');
	
	getPage('user.show_requests','','');
}

function quotation_collapse(){
	$('#log_quotation_link2').click(function(){setLocation('quotation_expand');});
	$('#log_quotation_link').click(function(){setLocation('quotation_expand');});
	$('#log_quotation_content').html('');
	$('#quotation_sign').html('+');
}	


function this_quotation_expand(itinerary_id, request_name){
	setTitle("Quotation :"+request_name);
	viewQuote(itinerary_id);
}

function this_quotation_collapse(itinerary_id, request_name){
	$('#quotation_link_'+itinerary_id).click(function(){setLocation('this_quotation_expand',escape(itinerary_id),escape(request_name)); });
	$('#quotation_link2_'+itinerary_id).click(function(){setLocation('this_quotation_expand',escape(itinerary_id),escape(request_name)); });
	$('#quotation_content_'+itinerary_id).html('');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////

function booking_expand(){
	storeInHistory();
	setTitle("<span  >My Bookings:</span>");
	$.get(ROOT_PATH+'aj_request.php?aj=user.aj_expand_booking','',booking_expand_response);
}

function booking_expand_response(response){
	if(response=='login'){
	 show_error_login_div();
	}else{
		html='';
		eval("var res_arr = "+response);
		booking_expand_fun(res_arr);
		booking_expand_variable = res_arr;
	}
}


function booking_expand_fun(res_arr){
	html='';
	html += "<table width='100%'>";
	$(res_arr).each(function(i,res){      
		html += "<tr><td width='15%'>&nbsp;</td><td width='85%'><table cellspacing='0' cellpadding='0'><tr><td> <a class='place-explorer' id='booking_link_"+res['booking_id']+"' href='javascript:void(0);' onclick=\"setLocation('getPage','user.agent_messages','booking_id="+res['booking_id']+"');\" >";
		html+=res['request_name']+"&nbsp;("+res['tsp_alias']+")</a></td></tr><tr><td></td><td id='booking_content_"+res['booking_id']+"'></td></tr></table></td></tr>";
	 });
	html +="</table>";
	
	$('#log_booking_content').html(html);
	
	$id('log_booking_link2').onclick ='';
	$id('log_booking_link').onclick ='';
	
	$id('log_booking_link2').onclick = function(){booking_collapse();};
	$id('log_booking_link').onclick = function(){booking_collapse();};
	$('#booking_sign').html('<b>-</b>');
	
	getPage('user.show_bookings','','');
}

function booking_collapse(){
	$id('log_booking_link2').onclick ='';
	$id('log_booking_link').onclick ='';
	
	$id('log_booking_link2').onclick = function(){setLocation('booking_expand');};
	$id('log_booking_link').onclick = function(){setLocation('booking_expand');};
	$('#log_booking_content').html('');
	$('#booking_sign').html('+');
}	

function this_booking_expand(itinerary_id, request_name){
	setTitle("booking :"+request_name);
	viewQuote(itinerary_id);
}

function this_booking_collapse(itinerary_id, request_name){
	$('#booking_link_'+itinerary_id).click(function(){setLocation('this_booking_expand',escape(itinerary_id),escape(request_name)); });
	$('#booking_link2_'+itinerary_id).click(function(){setLocation('this_booking_expand',escape(itinerary_id),escape(request_name)); });
	$('#booking_content_'+itinerary_id).html('');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////

function itinerary_expand(){
	setTitle("<span  >My Travel Plans:</span>");
	storeInHistory();
	$.get(ROOT_PATH+'aj_request.php?aj=user.aj_expand_itinerary','',itinerary_expand_response);
	$.get(ROOT_PATH+'aj_request.php?aj=user.select_itinerary','',function(r){ $('#main_div').html(r)});
}

function itinerary_expand_response(response){

if(response=='login'){
 show_error_login_div();
}else{
	html='';
	
 	eval("var res_arr = "+response);
	itinerary_expand_fun(res_arr);
	itinerary_expand_variable= res_arr;
	}
}

function itinerary_expand_fun(res_arr){
	html='';
	html += "<table width='100%'>";
	for(i=0; i<res_arr.length; i++){
		res=res_arr[i];
		html += "<tr><td width='15%'>&nbsp;</td><td width='85%'><table cellspacing='0' cellpadind='0'><tr><td>&nbsp;</td><td> <a class='place-explorer'  id='itinerary_link_"+res['itineraryID']+"' href='javascript:void(0)' onclick=\"setLocation('#this_itinerary_expand&1="+escape(res['itineraryID'])+"&2="+escape(res['itinerary_name'])+"');\" >"+res['itinerary_name']+'-'+res['cnt']+"</a></td></tr><tr><td></td><td id='itinerary_content_"+res['itineraryID']+"'></td></tr></table></td></tr>";
	}
	html +="</table>";
	$('#log_itinerary_content').html(html);
	$('#log_itinerary_link').click(function(){setLocation('itinerary_collapse')});
	$('#log_itinerary_link2').click(function(){setLocation('itinerary_collapse')});
	$('#itinerary_sign').html('<b>-</b>');
}

function itinerary_collapse(){
	$('#log_itinerary_link').click(function(){setLocation('itinerary_expand')});
	$('#log_itinerary_link2').click(function(){setLocation('itinerary_expand')});
	$id('log_itinerary_content').innerHTML='';
	$id('itinerary_sign').innerHTML='+';
//$id('ajaxnav').src='#';
	
}	

function this_itinerary_expand(itineraryID, itinerary_name){
	var title="Travel Plan:"+itinerary_name;
	setTitle("<span  >Travel Plan:</span>"+itinerary_name);
	storeInHistory();
	itineraryId=itineraryID;
	$.get(ROOT_PATH+'aj_request.php?aj=user.control_pannel&id='+itineraryID,'', function(resp){
		$('#main_div').html(resp);
	});
}


function wishlist_expand(){
	$.get(ROOT_PATH+'aj_request.php?aj=user.aj_expand_wishlist','', function wishlist_expand_response(response){
																		if(response=='login'){
																		 show_error_login_div();
																		}else{
																			html='';
																			
																			eval("var res_arr = "+response);
																			wishlist_expand_fun(res_arr);
																			wishlist_expand_variable= res_arr;
																		}
																	});
}


function wishlist_expand_fun(res_arr)
{
	html='';
	html += "<table width='100%'>";
	for(i=0; i<res_arr.length; i++)	{
		res=res_arr[i];
		html += "<tr><td width='15%'>&nbsp;</td><td width='85%'>&nbsp;<a class='place-explorer' href='javascript:void(0)' onclick=\"setLocation('log_wishlist_disp',"+escape(res['wishlistID'])+",'"+escape(res['wishlist_name'])+"'); \">"+res['wishlist_name']+"</a> - "+res['num_items']+" Items </td></tr>";
	}
	html +="</table>";
	$('#log_wishlist_content').html(html);
	$id('log_wishlist_link2').onclick=wishlist_collapse;
	var x =$id('log_wishlist_link');
	x.onclick = wishlist_collapse;
	$id('wishlist_sign').innerHTML='<b>-</b>';
}
	
	
function wishlist_collapse(){
	$id('log_wishlist_link').onclick=wishlist_expand;
	$id('log_wishlist_link2').onclick=wishlist_expand;
	$id('log_wishlist_content').innerHTML='';
	$id('wishlist_sign').innerHTML='+';
}	


function log_wishlist_disp(wishlistId, wishlist_name){
	setTitle("<span  >Wishlist: </span>"+wishlist_name);
	storeInHistory();
	
	$.post(ROOT_PATH+'aj_request.php?aj=user.aj_log_wishlist_disp&id='+wishlistId,'',wishlist_disp_response);
}


function wishlist_disp_response(response){
	if(response=='login') {
		 show_error_login_div();
	}else{
		html='';
		eval("var res_arr = "+response);
		var wishlist_name = res_arr['wishlist_name'];
		html+= '<span class="hdtxt">'+toUpper(wishlist_name)+'</span><br/>';
		var top_gmapcs = res_arr['top_gmapcs'];
		var top_zoom_level = top_gmapcs['place_gmz'];
		showByPoint(top_gmapcs['place_gmc1'],top_gmapcs['place_gmc2'],top_zoom_level, '','place');
	//return;
		var monum_exist = 0;
		var places=res_arr['places'];
		html += "<br><table width='100%'>";
		//window.frames.maps_frame.map.clearOverlays();
		if(places.length!=0){
			/*html += "<tr><th colspan='2' >PLACES:</th></tr><tr><td><span > There are NO Places In Your Wishlist</span></td></tr>";*/
		
			html += "<tr><th colspan='3' >PLACES:</th></tr>";
			for(var i=0; i < places.length; i++){
				if(monum_exist == 0 && places[i]['monument'])
					monum_exist = 1;
	
				if(places[i]['monument'] == 0){
				html += "<tr ><td class='content' id='log_element"+places[i]['placeID']+"' ><a class='links2' href='javascript:void(0)' onclick=\"setLocation('expPlaceExpand','"+escape(places[i]['placeID'])+"','place','"+escape(places[i]['place_gmc1'])+"','"+escape(places[i]['place_gmc2'])+"','"+escape(places[i]['place_gmz'])+"','"+escape(places[i]['placename1'])+"'); \"  >"+places[i]['placename1']+"</a>";
					html+="&nbsp;,&nbsp;&nbsp;<span class='label'>"+places[i]['place_uplevel_name']+"</span>";
					html+="</td><td class='content'>"+''+"</td><td align='right' id='log_del_element"+places[i]['placeID']+"'><a href='javascript:void(0)' onclick=\"deleteElement('"+res_arr['wishlistId']+"', '"+places[i]['placeID']+"', 'place')\">Delete</a></td></tr>";
					window.frames.maps_frame.showWishlistElement(places[i]['place_gmc1'],places[i]['place_gmc2'],top_zoom_level,'place',places[i]['placename1']);
				}
			}
			html += "</table>";
		}
		
		html += "<br><table width='100%'>";
		if(monum_exist){	
		
			html += "<tr><th colspan='3' >MONUMENTS:</th></tr>";
			for(var i=0; i < places.length; i++){
				if(places[i]['monument'] == 1){
				html += "<tr ><td class='content' id='log_element"+places[i]['placeID']+"' ><a class='links2' href='javascript:void(0)' onclick=\" setLocation('expPlaceExpand','"+escape(places[i]['placeID'])+"','place','"+escape(places[i]['place_gmc1'])+"','"+escape(places[i]['place_gmc2'])+"','"+escape(places[i]['place_gmz'])+"','"+escape(places[i]['placename1'])+"'); \" >"+places[i]['placename1']+"</a>";
				
				html+="&nbsp;,&nbsp;&nbsp;"+places[i]['place_uplevel_name'];
				
				html+="</td><td class='content'>"+''+"</td><td align='right' id='log_del_element"+places[i]['placeID']+"'><a href='javascript:void(0)' class='place-explorer' onclick=\"deleteElement('"+res_arr['wishlistId']+"', '"+places[i]['placeID']+"', 'place')\">Delete</a></td></tr>";
				}
				window.frames.maps_frame.showWishlistElement(places[i]['place_gmc1'],places[i]['place_gmc2'],top_zoom_level,'place',places[i]['placename1']);
			}
			html += "</table>";
		}
		
		var hotel = res_arr['hotel'];
		html += "<br><table width='100%'>"
		if(hotel.length!=0){
			/*html += "<tr><th colspan='2' >Hotels:</th></tr><tr><td><span > There are NO Hotels In Your Wishlist</span></td></tr>";*/
		
			html += "<tr><th colspan='2' >HOTELS:</th></tr>";
			for(var i=0; i < hotel.length; i++){
			//alert(places[i]['placename1']+' '+res_arr['wishlistId']+' '+places[i]['placeID']);
				html += "<tr ><td id='log_element"+hotel[i]['HotelID']+"' class='content'><a  class='links2' href='javascript:void(0)' onclick=\"setLocation('expPlaceExpand','"+escape(hotel[i]['Hotel_place'])+"','hotel','"+escape(hotel[i]['place_gmc1'])+"','"+escape(hotel[i]['place_gmc2'])+"','"+escape(hotel[i]['place_gmz'])+"','"+escape(hotel[i]['hotel_name1'])+"','"+escape(hotel[i]['HotelID'])+"','"+escape(hotel[i]['hotel_placename'])+"'); \">"+hotel[i]['Hotel_name1']+','+hotel[i]['hotel_placename']+"</a></td><td align='right' id='log_del_element"+hotel[i]['HotelID']+"'><a href='javascript:void(0)' class='place-explorer' onclick=\"deleteElement('"+res_arr['wishlistId']+"', '"+hotel[i]['HotelID']+"', 'hotel')\">Delete</a></td></tr>";
			
				window.frames.maps_frame.showWishlistElement(hotel[i]['place_gmc1'],hotel[i]['place_gmc2'],top_zoom_level,'hotel',hotel[i]['Hotel_name1']+', '+hotel[i]['hotel_placename']);
			//alert(html)
			}
			html += "</table>";
		}
			
		var journies = res_arr['journies'];
		html += "<br><table width='100%'>"
		if(journies.length!=0){
		/*	html += "<tr><th colspan='2' >JOURNEYS:</th></tr><tr><td><span > There are NO Journeys In Your Wishlist</span></td></tr>";*/
		
			html += "<tr><th colspan='2' >JOURNEYS:</th></tr>";
			for(var i=0; i < journies.length; i++){
				html += "<tr ><td class='content' id='log_element"+journies[i]['journeyID']+"'><a  class='links2' href='javascript:void(0)' onclick=\"setLocation('showJourney','"+escape(journies[i]['journey_from'])+"','"+escape(journies[i]['journeyID'])+"','"+escape(journies[i]['from_gmc1'])+"','"+escape(journies[i]['from_gmc2'])+"','"+escape(journies[i]['place_gmc1'])+"','"+escape(journies[i]['place_gmc2'])+"','"+escape(journies[i]['journey_title'])+"'); \">"+journies[i]['journey_title']+"</a></td><td align='right' id='log_del_element"+journies[i]['journeyID']+"'><a href='javascript:void(0)' class='place-explorer' onclick=\"deleteElement('"+res_arr['wishlistId']+"', '"+journies[i]['journeyID']+"','journey')\">Delete</a></td></tr>";
				window.frames.maps_frame.drawJourneyLine(journies[i]['from_gmc1'],journies[i]['from_gmc2'],journies[i]['place_gmc1'],journies[i]['place_gmc2'],journies[i]['journey_title'])
			}
			html += "</table><br>";
		}
		
		var itinerary = res_arr['itinerary'];
		html += "<br><table width='100%'>"
		if(itinerary.length!=0){
		/*	html += "<tr><th colspan='2' >JOURNEYS:</th></tr><tr><td><span > There are NO Journeys In Your Wishlist</span></td></tr>";*/
		
			html += "<tr><th colspan='2' >ITINERARY:</th></tr>";
			for(var i=0; i < itinerary.length; i++){
				html += "<tr ><td class='content' id='log_element"+itinerary[i]['itinerary_id']+"'><a  class='links2' href='javascript:void(0)' onclick=\" setLocation('getPage','itinerary.itinerary_details','itinerary_id="+itinerary[i]['itinerary_id']+"',''); \">"+itinerary[i]['itinerary_name']+"</a></td><td align='right' id='log_del_element"+itinerary[i]['itinerary_id']+"'><a href='javascript:void(0)' class='place-explorer' onclick=\"deleteElement('"+res_arr['wishlistId']+"','"+itinerary[i]['itinerary_id']+"', 'itinerary')\">Delete</a></td></tr>";
				
			}
			html += "</table><br>";
		}
		
		$('#main_div').html(html);
	}
}

function deleteElement(wishlistId, elementID, elementType){
	$.get(ROOT_PATH+'aj_request.php?aj=user.aj_log_wishlist_delete&wishlistid='+wishlistId+'&elementid='+elementID+'&type='+elementType,'',log_wishlist_del);
	
}
	
	
function log_wishlist_del(response)
{
	if(response=='login'){
		show_error_login_div();	
	}else{
		
		eval("var res = "+response);
		if(res['success']){
//alert('log_element'+res['elementId']);
			$id('log_element'+res['elementId']).innerHTML = "";
			$id('log_del_element'+res['elementId']).innerHTML = "";
			if(res['number']==0){
				switch(res['type']){
					case 'journey': var element = 'Journies';break;
					case 'place': var element = 'Places'; break;
					case 'hotel': var element = 'Hotels';break;
					case 'itinerary': var element = 'Itineraries';break;
				}
		$id('log_element'+res['elementId']).innerHTML = "<span > There are NO "+element+" In This Wishlist!</span>";
			}
			logbook_expand_variable['wishlist_items']--;
			for(var i=0;i<wishlist_expand_variable.length; i++){
				if(wishlist_expand_variable[i]['wishlistID']==res['wishlistId'] ){		
					wishlist_expand_variable[i]['num_items']--;
				}
			}
			logbook_update();
		}
	}
}



//messagees in log book

function message_expand(num){
	var url="user.inbox";
	if(num)
		url += "&pg_no="+num;
	showPage(url,'','My Messages');
}

function pg_inbox(url) {
	//alert(url);	
	var args = url.split('&');
	var func = 'setLocation(\'getPage\',';
	for(var i in args) {
		if(i > 0)
			func+=',';
		func+='\''+(args[i])+'\'';
	}
	func+=');';
	//alert(func);
	eval(func);
	
}

function inbox(filter, num){
	var url="user.inbox";
	if(filter)	
		url += "&filter="+filter;
	if(num)
		url += "&pg_no="+num;

	showPage(url,'','My Messages');
}

function viewMessage(tid, pg_no, filter){
	var url="user.view_message";
	var data="&tId="+tid+"&pg_no="+pg_no;
	if(filter)
		data += '&filter='+filter;
	
	showPage(url,data,'My Messages');
}
function replyMessage(rid){
	var url="user.reply_message&rid="+rid;
	showPage(url,'','My Messages');
}

function viewQuote(itinerary_id,from){
	var url='';
	var data='';
	if(from && from=='inbox') {
		url='user.view_quote';
		data='transId='+itinerary_id;
	}
	else {
		url='user.view_quote';
		data='itinerary_id='+itinerary_id;
	}
	showPage(url,data,'Quotation');
}



function postReply(rid){
	var ofckeditor=FCKeditorAPI.GetInstance('message1');
	var message1=ofckeditor.GetHTML();
	if(message1.trim()==''){
		alert('Please Enter the message ');
		ofckeditor.Focus();
		return;
	}
	
	$.post(ROOT_PATH+'aj_request.php?aj=user.reply_message','rid='+rid+"&message="+Url.encode(message1)+'&posted=1', function(resp){
		$('#main_div').html(resp); 
	});
}


function requestDQuote(rid){
	$.post(ROOT_PATH+'aj_request.php?aj=user.request_detailed_quote','rid='+rid, function(resp){
																		if(resp=='login')
																			show_error_login_div();
																		else{
																			eval('var a='+resp);	
																			if(a[0]=='1')
																				$('#btn_reqDQuote').attr('disabled','disabled');
																			//alert(a[1]);
																		}
																	 	});
}

function payPayPal(mileId){
	window.location.href='index.php?p=paypal.paypal_subscribe&mile='+mileId+'&action=process';
}
