jQuery.noConflict();

// Local
//var site_url = "http://localhost/seemasonline/";
// Online
var site_url = "http://seemasonline.com/";

jQuery(document).ready(function(){
  jQuery("#image_container").hide();
  			jQuery("a.zoom").fancybox();
			jQuery("a.zoom1").fancybox({
				'overlayOpacity'	:	0.7,
				'overlayColor'		:	'#FFF',
				'hideOnContentClick': false
			});

			jQuery("a.zoom2").fancybox({
				'zoomSpeedIn'		:	500,
				'zoomSpeedOut'		:	500
			});
			jQuery("a.group").fancybox({ 'zoomSpeedIn': 200, 'zoomSpeedOut': 200, 'overlayShow': false }); 
			
			jQuery('.slideshow').cycle({
				fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				speed:    8000
    			//timeout:  2000
			});
			
});

function load_image(img1){
	img1 = img1.replace("thumbnails", "photos");
	jQuery("#image_container").show('slow');
	jQuery("#image_slide").attr("src", img1);
}

function check_contact_form(){
	if(jQuery('#name').val() == ""){
		jQuery('#eeer').html("Name should not be blank");
		jQuery('#name').focus();
		return false;
	}else if(jQuery('#phone_number').val() == ""){
		jQuery('#eeer').html("Phone number should not be blank");
		jQuery('#phone_number').focus();
		return false;
	}else if(jQuery('#email_id').val() == ""){
		jQuery('#eeer').html("Email address should not be blank");
		jQuery('#email_id').focus();
		return false;
	}else if(!check_email_address(jQuery("#email_id").val())){
		jQuery('#eeer').html("Invalid Email Address!");
		jQuery('#email_id').focus();
		return false;
	}else if(jQuery('#subject').val() == ""){
		jQuery('#eeer').html("Subject should not be blank");
		jQuery('#subject').focus();
		return false;
	}else if(jQuery('#matter').val() == ""){
		jQuery('#eeer').html("Cantent should not be blank");
		jQuery('#matter').focus();
		return false;
	}else {
		return true;
	}
}


function check_email_address($email) {
  var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  str = $email;
  if(str.match(emailRegEx)){
		return true;
  }else{
	return false;
  }
  
}

function update_status_order(id, order_id){
	if(confirm("Do you want to updated status of this order?\nClick Ok to update status")){
		jQuery.post(site_url + "admin/orders/update_status", { status : jQuery('#' + id).val(), order : order_id},
		   function(data){
		     if(data == 1){
		     	alert("Status updated");
		     }else{
		     	alert("Failed to update status\nError:" + data);
		     }
		 });
	}else{
		return false;
	}
}
function update_status_discount(id, discount_id){
	if(confirm("Do you want to updated status of this Discount?\nClick Ok to update status")){
		jQuery.post(site_url + "admin/discounts/update_status", { status : jQuery('#' + id).val(), discount : discount_id},
		   function(data){
		     if(data == 1){
		     	alert("Status updated");
		     }else{
		     	alert("Failed to update status\nError:" + data);
		     }
		 });
	}else{
		return false;
	}
}

function update_status_reservation(id, reservation_id){
	if(confirm("Do you want to updated status of this Reservation?\nClick Ok to update status")){
		jQuery.post(site_url + "admin/reservations/update_status", { status : jQuery('#' + id).val(), reservation : reservation_id},
		   function(data){
		     if(data == 1){
		     	alert("Status updated");
		     }else{
		     	alert("Failed to update status\nError:" + data);
		     }
		 });
	}else{
		return false;
	}
}

function reload_image_list(){
	jQuery("#image_list").load(site_url + "alubms/get_random_photos");
}

function remove_selected_cart(){
	if(confirm("Do you want to remove selected Items from the list?\nClick ok to delete selected Items")){
		var ids   = "";
	    jQuery("input:checkbox:checked").each(function(){
	    	if(ids != ""){
	         	ids = ids + "|" + this.value;
	    	}else{
	    		ids = this.value;
	    	}
	    });
	    jQuery.post(site_url + "orders/deletecartitems", { id_list : ids},
		   function(data){
		     if(data == 1){
		     	alert("Status cart");
		     	location.href = site_url + "orders/viewcart";
		     }else{
		     	alert("Failed to update cart\nError:" + data);
		     }
		});
	}
  } 

  
 function show_men_list(id){
 	jQuery("#" + id).toggle('slow');
 }

//setInterval( "reload_image_list()", 10000 );
