﻿	function fancyClose()
		{
		$.fancybox.close();
		}
		
		$(document).ready(function() {
								   
			$("#phead .topmenu > a.dd, #phead .accmenu > a.dd").each(function(){
				$(this).click(function(){return false;});								 
				var bId = $(this).attr('id');
				var sId = '#'+bId+'menu';
				var sm = $(sId).get(0);	
				var offset = $(this).offset();
				var height = $(sm).height();
				var poffset = $(this).parent().offset();
				$(sm).css({'left':offset.left-poffset.left}).attr({"cheight":height,"rel":bId}).height("0");											 
			});
			
			$("#phead .topmenu > a.dd, #phead .accmenu > a.dd").hover(
				function(){
					$(this).addClass("downed");
					var bId = $(this).attr('id');
					var sId = '#'+bId+'menu';
					var sm = $(sId).get(0);	
					$(sm).stop().show().animate({"height":$(sm).attr("cheight")+"px"},200);
				},
				function(){
					var did=$(this).attr("id");	
					$("#"+did+"menu").stop().animate({"height":"0"},200,function(){ $(this).hide(); $("#"+did).removeClass("downed"); });						   
			});
				
			$("#phead .ddmenu").hover(
				function(){
					$(this).stop().animate({"height":$(this).attr("cheight")+"px"},200);
				},
				function(){
					var bId = $(this).attr('rel');
					$(this).stop().animate({"height":"0"},200,function(){ $("#"+bId).removeClass("downed"); });						   
			});

			$("a.boxload").fancybox({
				"overlayOpacity"	:	0.7,
				"overlayColor"		:	"#000",
				"transitionIn"		:	"none",
				"transitionOut"		:	"none",
				"centerOnScroll"	:	true,
				"autoDimensions"	:	true
			});
			
			$("a.zoom").fancybox({
				'overlayOpacity'	:	0.7,
				'overlayColor'		:	'#000',
				'centerOnScroll'	:	true,
				'titlePosition'		:	'over',
				'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    								if (currentArray.length>1)
											return '<span id="fancybox-title-over"><div class="yaki-title-over">'+((title.length>0)?'<div class="slash">/</div>':'')+'<div class="title">'+title+'</div><div class="pages"><div class="page">' +  (currentIndex + 1) + '</div><div class="slash">/</div><div class="page">' + currentArray.length + '</div></div></div></span>';
											else 
											return '<span id="fancybox-title-over"><div class="yaki-title-over">'+((title.length>0)?'<div class="slash">/</div>':'')+'<div class="title">'+title+'</div></div></span>';
											}
			});
			
			$("a.hiddenstart").fancybox({
				'margin'			:	0,
				'overlayOpacity'	:	0.7,
				'overlayColor'		:	'#000',
				'width'				: 	550,
				'height'			: 	553,
				'autoDimensions'	:	false,
				'centerOnScroll'	:	true,
				'onStart'			:	function() {cl = setTimeout("fancyClose()",13000);}
			}).trigger('click');;
			
			$('div.moffer').cycle({ 
			fx:    'fade', 
			speed:  1500,
			timeout:  6000,
			random: 1
		 	});
			
			$('div.moffer1').cycle({ 
			fx:    'fade', 
			speed:  1500,
			timeout:  4500
		 	});
			
			$('div.moffer2').cycle({ 
			fx:    'fade', 
			speed:  1500,
			timeout:  4500
		 	});
			
		});
