var current = 1;
var hidden = 2;
var slideshow_image = 2;
$(document).ready
( function()
  {
    setTimeout('slideshow()', 2000);
		  $(".frame_box").corner("5px");
		  $(".rc_top ").corner("6px");
		  //$(".rc_footer").corner("top 6px").corner("bottom 3px");
    align_gallery_boxes();
		  $(".nav_hover").hover
				( function()
				  {
						  $(this).children().toggle();
						},
						function()
						{
						  $(this).children().toggle();
						}
				);
		  $('.hover_galleries').hover
				( function()
						{
						  var gallery_id = $(this).attr('id').slice(8);
								//$(this).children().children(":first").css('background-color', '#444444');
								$(this).children().children(":first").css('background-color', '#666666');
								//$('#gallery_name_background_' + gallery_id).css('background-color', '#000000'); 
								//$('#gallery_name_background_' + gallery_id).css('background-color', '#cccccc'); 
								$('#gallery_name_text_' + gallery_id).css('color', '#000000'); 
						},
						function()
						{
						  var gallery_id = $(this).attr('id').slice(8);
								$(this).children().children(":first").css('background-color', '#ffffff');
								$('#gallery_name_background_' + gallery_id).css('background-color', '#cccccc'); 
								$('#gallery_name_text_' + gallery_id).css('color', '#444444'); 
						}
				);
		}
);
function pavlaquinn_enquire(product_image_id)
{
  $.post
  ( "/toffsystems_clients_pavlaquinn_ajax.php",
	   { task: 'pavlaquinn_enquire',
	     name: $("#name_" + product_image_id).val(),
	     email: $("#email_" + product_image_id).val(),
	     phone: $("#phone_" + product_image_id).val(),
	     message: $("#message_" + product_image_id).val(),
						image_id: product_image_id
	 		},
	 		function(data)
	 		{
				  eval(data);
	   }
	 );
}
function align_gallery_boxes()
{
  var i = 1;
  $(".gallery_box").each
		( function()
		  {
		    if(i == 5)
				  {
				    $(this).css('margin-right','0px');
				  		i = 1;
				  }
				  else
				  {
						  if(i == 2 || i == 4)
								{
				     // $(this).css('margin-right','18px');
        }
				    ++i;
				  }
    }
		);
}
function slideshow()
{
  $("#image_slideshow_" + current).fadeOut
		( 2000,
		  function()
				{
      $("#image_slideshow_" + hidden).fadeIn
	     ( 3000,
		      function()
		      {
          setTimeout("slideshow()", 1000);
				    }
		    );
				  var url = slideshow_images[slideshow_image];
						var padding_left = slideshow_images_margin[slideshow_image];
				  $("#image_slideshow_" + current).attr('src', url);
				  //$("#image_slideshow_" + current).css('left', padding_left);
      current = hidden;
      hidden = current == 1 ? 2 : 1;
						++slideshow_image;
						slideshow_image = slideshow_image == 19 ?  0 : slideshow_image;
				}
		);
}
