// JavaScript Document
  // When the document loads do everything inside here ...
     $(document).ready(function(){
	 //$('#main').load('boo.php');	//by default initally load text from boo.php
         $('.ajax').click(function() { //start function when any link is clicked
		 				//$("#main").fadeOut("slow");
						 var ajax_data = $(this).attr("title"); //retrieve title of link to pass as data
						 var url = $(this).attr("href");
							$.ajax({
							method: "get",url: url,
							beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
							complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
							success: function(html){ //so, if data is retrieved, store it in html
							$("#main").fadeIn("slow"); //animation
							$("#main").html(html); //show the html inside #main div
					 }
				 }); //close $.ajax(
		 }); //close click(
		 
	//init rollover
  	 myrollover.init();
	 
	 // init contact popup


		$(".contact-popup a").hover(function() {
		$(this).next("div").stop(true, true).animate({opacity: "show",height:"50px"}, "slow");
		}, function() {
		$(this).next("div").animate({opacity: "hide", height:"0"}, "fast");
		});




	 }); //close $(

  // initialisation function
     function init_ajax(){
         $('.ajax').click(function() { //start function when any link is clicked
		 				//$("#main").fadeOut("slow");
						 var ajax_data = $(this).attr("title"); //retrieve title of link to pass as data
							$.ajax({
							method: "get",url: "/shop/shop.php",data: ajax_data,
							beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
							complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
							success: function(html){ //so, if data is retrieved, store it in html
							$("#main").fadeIn("slow"); //animation
							$("#main").html(html); //show the html inside #main div
					 }
				 }); //close $.ajax(
         }); //close click(
		 
	 } //close function
	 
	          function do_ajax(ajax_action, ajax_data) { //start function when any link is clicked
		 				//$("#main").fadeOut("slow");
							$.cookie('lastAjax',ajax_data);
							$.ajax({
							type: "POST",url: "/shop/"+ajax_action+".php",data: ajax_data,
							beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
							complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
							success: function(html){ //so, if data is retrieved, store it in html
							$("#main").fadeIn("slow"); //animation
							$("#main").html(html); //show the html inside #main div
					 }
				 }); //close $.ajax(
         }; //close function(
	         
		function ajax_action(ajax_action, ajax_data, ajax_target) { //start function when any link is clicked
				$("#main").fadeOut("slow");
					$.ajax({
					type: "POST",url: ajax_action ,data: ajax_data,
					beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
					complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
					success: function(html){ //so, if data is retrieved, store it in html
					$(ajax_target).fadeIn("slow"); //animation
					$(ajax_target).html(html); //show the html inside target div
						}
					}); //close $.ajax(
		}; //close function(

		function ajax_confirm() { //function to update Confirm after login
					$.ajax({
					type: "POST",url: "/shop/testshop.php" ,data : "do=confirm",
					success: function(html){ //so, if data is retrieved, store it in html
					window.parent.$("#main").html(html); //show the html inside target div
						}
					}); //close $.ajax(
		}; //close function(
		
		
		function ajax_login(confirm) { //start function when any link is clicked
					$.ajax({
					type: "POST",url: "/php/manageHeader.php" ,
					success: function(html){ //so, if data is retrieved, store it in html
					window.parent.$("#editheader").html(html); //show the html inside target div
						
						
						
						}
					}); //close $.ajax(
					
					if (confirm) {
						//ajax_confirm();} //update Confirm
						$.ajax({
						type: "POST",url: "/shop/shop.php" ,data : "do=confirm",
						success: function(html){ //so, if data is retrieved, store it in html
						window.parent.$("#main").html(html); //show the html inside target div
							}
					}); //close $.ajax(
					}
					
					
		}; //close function(
		 
		 function init_frm_product()
		 {
		 	var options = {target :'#shop'};
			
			// bind form using 'ajaxForm' 
			$('#frm_product').submit(function() { 
			// inside event callbacks 'this' is the DOM element so we first 
			// wrap it in a jQuery object and then invoke ajaxSubmit 
				$(this).ajaxSubmit(options); 
 
			// !!! Important !!! 
			// always return false to prevent standard browser submit and page navigation 
				return false; 
			});
			
		 }; //close int_frm_product
		 


