CUR_DOMAIN = 'http://www.little-jasmine.com/';

function ajax_bus(MOD,FUNC,ID){
	//alert('Activated with '+MOD+' '+FUNC+' '+ID);
	url = CUR_DOMAIN+'ajax.php';
	pack = "mode=bus&mod="+MOD+"&func="+FUNC+"&id="+ID;
	/*JQUERY WAY*/

	$.ajax({
		type: "POST",
		url: url,
		data: pack,
		success: function(msg){
		temp = msg.split('@@');
		eval(temp[0]) (temp[1]);
		}
	});
}


function change_div(source){
	//alert(source);
	temp = source.split('||');
	//Fix the error
	target = temp[0];
	rest = '';
	for(i=1;i<temp.length;i++){
		if(i!=1) rest = rest+"||";
		rest = rest+temp[i];
	}

	$("#"+target).html(rest);
}

function replace_content2(source){
	temp = source.split('||');
	//Fix the error
	target = temp[0];
	rest = '';
	for(i=1;i<temp.length;i++){
		if(i!=1) rest = rest+"||";
		rest = rest+temp[i];
	}

	$("#"+target).html(rest);
	jQuery('#list1a').accordion();
}

function addVideoPOP(id){
	//Change the URL from short to full
	//http://youtu.be/6yuwzcfn-Bs
	//http://www.youtube.com/v/ID
	var oups = $("#"+id).attr("href").replace(new RegExp("http://youtu.be/", "i"), 'http://www.youtube.com/watch?v=');
	$("#"+id).attr("href",oups);
	$("#"+id).click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1',
				'type'			: 'swf',
				'swf'			: {
					'wmode'				: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});

		return false;
	});
	/*
	cont = $("#"+id).attr("href");
	alert(cont);
	$("#"+id).fancybox({
		'titleShow'     : false,
		'transitionIn'  : 'elastic',
		'transitionOut' : 'elastic',
		'href' 			: $(this).attr("href").replace(new RegExp("watch\\?v=", "i"), 'v/'),
		'type'      	: 'swf',
		'swf'       	: {'wmode':'transparent','allowfullscreen':'true'}
	});
	*/
}



function make_payment(id){
	document.location = CUR_DOMAIN+'payments.php?id='+id;
}

function multi_actions(actions){
	multi_temp = actions.split('^^');
	for(p=0;p<multi_temp.length;p++){
		vnew = multi_temp[p];
		t = vnew.split('++');
		eval(t[0]) (t[1]);
	}
	//alert("We found "+actions);
}


function selected_date(date){
	if((document.getElementById('service')) || (document.getElementById('voucher_num'))){
		$('#picked_date').val(date);
		dis_date = date.split("-");
		dis_date = dis_date[2]+"-"+dis_date[1]+"-"+dis_date[0];
		document.getElementById('display_date').innerHTML = "Selected Date: "+dis_date;
		check_for_times();
	}else{
		$('#mydate').val(date);
		document.booking.submit();
	}
}


function toggleBoxVis(id){
	$("#"+id).toggle("slow");
}
