$(document).ready(function(){
	if($.fn.fancybox) {
		$(".fancylink").fancybox({
			type : 'iframe',
			width : 746,
			height: 550,
			titlePosition : 'inside',
			showNavArrows : false
// 			scrolling : 'no'
		});
	}
	
    $("#content").height(900);
    var slide=($(document).getUrlParam("layout"))? $(document).getUrlParam("layout") : 0;
    if(slide)
    {
    var name='';
         $(".proc div a").each(function(){
         switch(slide)
         {
             case '1':
             name='one';
              $("#content").height(580);
             break;

             case '2':
             name='two';
              $("#content").height(750);
             break;

             case '3':
             name='three';
              $("#content").height(580);
             break;
         }
     });

    $(".proc div a[rel='"+(slide)+"']").find("img").attr("src", "/img/"+name+".gif");
    $(".proc div").removeClass("select");
    $(".proc div:has(a[rel="+(slide)+"])").addClass("select");
    $("#plan").hide();
    $("#show_map").show();
    $("#layouts").show();
     }
    if(slide>0)
    {
        $("#layouts").cycle({
        fx:    'fade',
        startingSlide: slide-1,
        timeout: 0,
        sync:  false
        });
    }
    else
    {
        $("#layouts").cycle({
        fx:    'fade',
        timeout: 0,
        sync:  false
        });
        $("#layouts").hide();
    }


  $(".proc div a").click(function(){
     $(".proc div").removeClass("select");
     $(this).parents("div:first").addClass("select");
     $(".proc div a").each(function(){
         sl=parseInt($(this).attr("rel"));
         switch(sl)
         {
             case 1:
             $(this).find("img").attr("src", "/img/one2.gif");
             break;

             case 2:
             $(this).find("img").attr("src", "/img/two2.gif");
             break;

             case 3:
             $(this).find("img").attr("src", "/img/three2.gif");
             break;
         }
     });
     var slide=$(this).attr("rel")-1;
     switch(slide+1)
     {
         case 1:
         $(this).find("img").attr("src", "/img/one.gif");
          $("#content").height(1100);
         break;

         case 2:
         $(this).find("img").attr("src", "/img/two.gif");
          $("#content").height(1500);
         break;

         case 3:
         $(this).find("img").attr("src", "/img/three.gif");
          $("#content").height(1530);
         break;
     }
     $("#plan").hide();
     $("#show_map").show();
     $("#layouts").cycle(slide);
     $("#layouts").show();
     return false;
 });

//  $("map area").click(function(){
//      var sl=$(this).attr("rel");
//      $(".proc div a[rel='"+sl+"']").click();
//      return false;
//  });

	
  
 $("#show_map").click(function(){
        $(this).hide();
        $("#content").height(900);
         $(".proc div").removeClass("select");
         $(".proc div a").each(function(){
         sl=parseInt($(this).attr("rel"));
         switch(sl)
         {
             case 1:
             $(this).find("img").attr("src", "/img/one2.gif");
             break;

             case 2:
             $(this).find("img").attr("src", "/img/two2.gif");
             break;

             case 3:
             $(this).find("img").attr("src", "/img/three2.gif");
             break;
         }
     });
        $("#layouts").hide();
        $("#plan").show();
 });
});


