var FULL_PATH = "http://www.cameosurgery.com";
var current_ul;
function showPages(page_id){
	if(current_ul != page_id){
		$("#"+page_id).slideDown(0,function(){$("#"+current_ul).slideUp()});
		current_ul = page_id;
	}
	else{
		$("#"+page_id).slideDown();
		current_ul = page_id;		
	}
}

function postTestimonial(){
	var name 	= $('#name').val();
	var email 	= $('#email').val();
	var title 	= $('#title').val();
	var content = $('#testimonial').val();
	$.ajax({
			type: "POST",
			url: FULL_PATH+"/ajax/post_testimonial",
			data: "name="+name+"&email="+email+"&title="+title+"&content="+content,
			async:true,			
			success: function(response){				
				$("#response").fadeOut(200,function(){$(this).html(response).fadeIn();});	
			}			
		});
	return false;
}
/*function postTestimonial(){
	var name 	= $('#name').val();
	var email 	= $('#title').val();
	var title 	= $('#title').val();
	var content = $('#content').val();
	$.ajax({
			type: "POST",
			url: FULL_PATH+"/ajax/post_testimonial",
			data: "name="+name+"&email="+email+"&title="+title+"&content="+content,
			async:true,
			beforeSend:function(){				
				$("#loader").css('visibility','visible');				
			},
			success: function(response){				
				$("#user_results").fadeOut(200,function(){$(this).html(response).fadeIn();});	
			},
			complete: function(response){
				$("#loader").css('visibility','hidden');				
			}
		});
}*/

function updateBannerStatus(t,banner){
	var status = 'N';
	if(t.checked)
		status = 'Y'
	$.ajax({type: "POST",url: FULL_PATH+"/ajax/updatebannerstatus",data: "status="+status+"&banner="+banner,async:true});	
}
function updateBannerSequence(t,banner){
	var sequence = t.value;	
	$.ajax({type: "POST",url: FULL_PATH+"/ajax/updatebannersequence",data: "sequence="+sequence+"&banner="+banner,async:true});	
}

function updateVideoStatus(t,video){
	var status = 'N';
	if(t.checked)
		status = 'Y'
	$.ajax({type: "POST",url: FULL_PATH+"/ajax/updatevideostatus",data: "status="+status+"&video="+video,async:true});	
}
function updateVideoSequence(t,video){
	var sequence = t.value;	
	$.ajax({type: "POST",url: FULL_PATH+"/ajax/updatevideosequence",data: "sequence="+sequence+"&video="+video,async:true});	
}

function contactUsMail(){
	var queryString = $('#facebox #commentform').serialize();	
	$.ajax({
			type: "POST",
			url: FULL_PATH+"/ajax/contactUsMail",
			data: queryString,
			async:true,			
			success: function(response){
				if(response){					
					$("#facebox #response").fadeOut(200,function(){$("#facebox #response").html(response).fadeIn();});	
				}
			}			
		});
	return false;	
}

function updateAlbumOrder(sequence,album){	
	$.ajax({
			type: "POST",
			url: FULL_PATH+"/ajax/updateAlbumOrder",
			data: {sequence:sequence,album:album},
			async:true						
		});
	return false;	
}

function updatePhotoOrder(sequence,photo){	
	$.ajax({
			type: "POST",
			url: FULL_PATH+"/ajax/updatePhotoOrder",
			data: {sequence:sequence,photo:photo},
			async:true						
		});
	return false;	
}
function fetchAlbum(id,e){		
	var width;
	var height;
	width = e.clientX + 10;
	height = e.clientY;
	$.ajax({
			type: "POST",
			url: FULL_PATH+"/ajax/fetchAlbum",
			data: {album:id},
			async:true,
			beforeSend:function(){	
				document.getElementById('output').style.display = "";
				document.getElementById('output').style.left = width+"px";
				document.getElementById('output').style.top = height+"px";
				$("#output").html("<img src='"+FULL_PATH+"/public/images/ajax_loader.gif' style='margin-left:80px;margin-top:63px'>");				
			},
			success: function(response){				
				$("#output").html(response);		
			}			
		});	
}
