// Sum SEOlife



$(document).ready(function(){

$(".flip").click(function(){

    $(".panel").slideToggle("slow");

  });

});



$(document).ready(function(){

$('input[title=vyplnit]').clearableTextField();

 });



/** SEOlife: for this great script thank you:

 * jQuery-Plugin "clearField"

 * @version: 1.1, 04.12.2010

 * @author: Stijn Van Minnebruggen

 *          stijn@donotfold.be

 *          http://www.donotfold.be

 * @example: $('selector').clearField();

 * @example: $('selector').clearField({ blurClass: 'myBlurredClass', activeClass: 'myActiveClass' });

 * 

 */

 $(document).ready(function() {

	$('.clearField').clearField();

});





(function($) {

		$.fn.clearField = function(settings) {

			settings = jQuery.extend({

			blurClass: 'clearFieldBlurred',

			activeClass: 'clearFieldActive',

			attribute: 'rel',

			value: ''

		}, settings);

		

		return $(this).each(function() {

		var el = $(this);

		settings.value = el.val();

		if(el.attr(settings.attribute) == undefined) {

				el.attr(settings.attribute, el.val()).addClass(settings.blurClass);

			} else {

				settings.value = el.attr(settings.attribute);

			}

			el.focus(function() {

				

				if(el.val() == el.attr(settings.attribute)) {

					el.val('').removeClass(settings.blurClass).addClass(settings.activeClass);

				}

				

			});

			el.blur(function() {

				

				if(el.val() == '') {

					el.val(el.attr(settings.attribute)).removeClass(settings.activeClass).addClass(settings.blurClass);

				}				

			});				

		});		

	};	

})(jQuery);





/* SEOlife: for this great script thank you:

  * Clearable Text Field - jQuery plugin version 0.2.1

  * Copyright (c) 2009 Tatsuya Ono

  * http://github.com/ono/clearable_text_field

  * Dual licensed under the MIT and GPL licenses:

  *   http://www.opensource.org/licenses/mit-license.php

  *   http://www.gnu.org/licenses/gpl.html

  */

(function($) {

  $.fn.clearableTextField = function() {

    if ($(this).length>0) {

      $(this).bind('keyup change paste cut', onSomethingChanged);

    

      for (var i=0; i<$(this).length; i++) {

        trigger($($(this)[i]));

      }

    }

  }

  

  function onSomethingChanged() {

    trigger($(this));

  }

  

  function trigger(input) {

    if(input.val().length>0){

      add_clear_button(input);

    } else {

      remove_clear_button(input);

    }    

  }

  

  function add_clear_button(input) {

    if (!input.next().hasClass('text_clear_button')) {

      // appends div

      input.after("<div class='text_clear_button'></div>");

    

      var clear_button = input.next();

      var w = clear_button.outerHeight(), h = clear_button.outerHeight();

      

      input.css('padding-right', parseInt(input.css('padding-right')) + w + 1);

      input.width(input.width() - w - 1);

          

      var pos = input.position();

      var style = {};  

      style['left'] = pos.left + input.outerWidth(false) - (w+2);

      var offset = Math.round((input.outerHeight(true) - h)/2.0);

      style['top'] = pos.top + offset;

            

      clear_button.css(style);

          

      clear_button.click(function(){

        input.val('');

        trigger(input);

      });

    }

  }

  

  function remove_clear_button(input) {

    var clear_button = input.next();

    

    if (clear_button.hasClass('text_clear_button')) {

      clear_button.remove();

      var w = clear_button.width();



      input.css('padding-right', parseInt(input.css('padding-right')) - w -1);

      input.width(input.width() + w + 1);

    }

  }

  

})(jQuery);



$(document).ready(function(){ 

$(".spriehladne, #kontcot,").fadeTo("slow", 0.3);	

$(".spriehladne, #kontcot").mouseover(function(){	 

		 $(this).fadeTo("slow", 1);

		  });

	$(".spriehladne, #kontcot").mouseout(function(){	 

		 $(this).fadeTo("slow", 0.3);	 

					   });

	 });



$(document).ready(function(){ 

$(".menpre").mouseover(function(){	 

		 $(".menpre").css("display","none");

$(".menpree").css("display","inline");

		  });

	$(".menpree").mouseout(function(){	 

	 $(".menpree").css("display","none");

$(".menpre").css("display","inline");

	 });

	$(".menpre1").mouseover(function(){	 

		 $(this).css("display","none");

$(".menpree1").css("display","inline");

		  });

	$(".menpree1").mouseout(function(){	 

	 $(this).css("display","none");

$(".menpre1").css("display","inline");

	 });

	$(".menpre2").mouseover(function(){	 

		 $(this).css("display","none");

$(".menpree2").css("display","inline");

		  });

	$(".menpree2").mouseout(function(){	 

	 $(this).css("display","none");

$(".menpre2").css("display","inline");

	 });

	$(".menpre3").mouseover(function(){	 

		 $(this).css("display","none");

$(".menpree3").css("display","inline");

		  });

	$(".menpree3").mouseout(function(){	 

	 $(this).css("display","none");

$(".menpre3").css("display","inline");

	 });

	$(".menpre4").mouseover(function(){	 

		 $(this).css("display","none");

$(".menpree4").css("display","inline");

		  });

	$(".menpree4").mouseout(function(){	 

	 $(this).css("display","none");

$(".menpre4").css("display","inline");

	 });

	$(".menpre5").mouseover(function(){	 

		 $(this).css("display","none");

$(".menpree5").css("display","inline");

		  });

	$(".menpree5").mouseout(function(){	 

	 $(this).css("display","none");

$(".menpre5").css("display","inline");

	 });

	$(".menpre6").mouseover(function(){	 

		 $(this).css("display","none");

$(".menpree6").css("display","inline");

		  });

	$(".menpree6").mouseout(function(){	 

	 $(this).css("display","none");

$(".menpre6").css("display","inline");

	 });

	});



$(document).ready(function(){

  $(".facot").click(function(){

  $(".facezat").slideToggle();

  });

  $(".kontcot").click(function(){

  $(".kontzat").slideToggle();

  });

  });



$(document).ready(function() {

	$('ul#tools').prepend('<li class="print"><a href="#print">Click me to print</a></li>');

	$('ul#tools li.print a').click(function() {

		window.print();

		return false;

	});

});



$(document).ready(function(){

	// add a "rel" attrib if Opera 7+

	if(window.opera) {

		if ($("a.jqbookmark").attr("rel") != ""){ // don't overwrite the rel attrib if already set

			$("a.jqbookmark").attr("rel","sidebar");

		}

	}



	$("a.jqbookmark").click(function(event){

		event.preventDefault(); // prevent the anchor tag from sending the user off to the link

		var url = this.href;

		var title = this.title;



		if (window.sidebar) { // Mozilla Firefox Bookmark

			window.sidebar.addPanel(title, url,"");

		} else if( window.external ) { // IE Favorite

			window.external.AddFavorite( url, title);

		} else if(window.opera) { // Opera 7+

			return false; // do nothing - the rel="sidebar" should do the trick

		} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)

			 alert('Unfortunately, this browser does not support the requested action,'

			 + ' please bookmark this page manually.');

		}



	});

});



function book_test()

{

var f = self.document.forms.formular;

if (f.meno.value.length <=0)

{

alert ("Zadajte prosím svoje meno!");

var cervena = document.getElementById("majo");

cervena.style.backgroundColor="#FFAB6C";

return false;

}

if (f.telefon.value.length <=0)

{

alert ("Zadajte prosím svoj telefón!");

var cervena = document.getElementById("majo");

cervena.style.backgroundColor="#ffffff";

var tel = document.getElementById("tel");

tel.style.backgroundColor="#FFAB6C";

return false;

}

if (f.email.value.length <=0)

{

alert ("Zadajte prosím Váš email!");

var cervena = document.getElementById("majo");

cervena.style.backgroundColor="#ffffff";

var tel = document.getElementById("tel");

tel.style.backgroundColor="#ffffff";

var em = document.getElementById("em");

em.style.backgroundColor="#FFAB6C";

return false;

}

if (f.antis.value.length <=0)

{

alert ("Zadajte prosím Antispamovú ochranu. Zadajte life!");

var cervena = document.getElementById("majo");

cervena.style.backgroundColor="#ffffff";

var tel = document.getElementById("tel");

tel.style.backgroundColor="#ffffff";

var em = document.getElementById("em");

em.style.backgroundColor="#ffffff";

var antis = document.getElementById("antis");

antis.style.backgroundColor="#FFAB6C";

return false;

}

if (f.typubytovanie.value.length <=0)

{

alert ("Zadajte produkt o ktorý máte záujem!");

return false;

}

return true;

}



$(document).ready(function(){ 

 $("#antis").click(function(){

    $('#poslatto').removeAttr("disabled");

	 })	

	  })



$(document).ready(function() {

	$(".mkopp").click(function(){

			$(".mkop").css("display","inline");				   

    setTimeout(function() {

        $(".mkop").fadeOut(5000);

      }, 1000);

      }); 

    }); 



var slideShow = new Array()

slideShow[0] = "01.jpg";

slideShow[1] = "02.jpg";

slideShow[2] = "03.jpg";

slideShow[3] = "04.jpg";

slideShow[4] = "05.jpg";





function fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current) {

    // get the length of the image array.

    var listSize = imageList.length;

    // If there's no current image selected, or the value is out of the range of the

    // slideshow, then set the current image to zero.

    if (!current || current >= listSize) current = 0;

    // If there's no slide duration set, set it to 5 seconds.

    if (!slideDuration) slideDuration = 10000;

    // If there's no fade speed set, set it to 1 second.

    if (!fadeSpeed) fadeSpeed = 1000;

    // Set the image's source to the current image's url.

    $(elem + " img").attr("src", imageList[current]);

    // If the current element is at the maximum of the element size, then set the 

    // wrapper's background (aka, the next image) to the first image.

    if (current == (listSize - 1)) {

        $(elem).css("background", "transparent url(" + imageList[0] + ") no-repeat");

    } else {

    // If not, set the next image in the list to the background of the wrapper.

        $(elem).css("background", "transparent url(" + imageList[current + 1] + ") no-repeat");

    }

    // Hold the current image for a period of time equal to slideDuration. Once that's done, then

    // fade the current image's opacity until the background image shows. Once that is done, then

    // call this same function again with the next image in line.

    $(elem + " img").animate({ opacity: "1" }, slideDuration).animate({ opacity: "0.01" }, fadeSpeed, function() { $(this).css("opacity", "1"); fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current + 1) });

} // end of function fadeinSlideshow()



function runSlideshow(){

    fadeinSlideshow("#slideshow", slideShow, 10000, 1000);

}



$(document).ready(runSlideshow);



$(document).ready(function(){ 

$(".yatv").click(function(){	 

		 $(".sumarr").css("display","none");

		 $(".dolpr").css("display","none");

		  $(".yatv").css("display","none");

$(".sumarrr").css("display","inline");

$(".otvo").css("display","inline");

		  });



$(".otvo").click(function(){	 

		 $(".sumarr").css("display","inline");

		 $(".dolpr").css("display","inline");

		  $(".yatv").css("display","inline");

$(".sumarrr").css("display","none");

$(".otvo").css("display","none");

		  });



 });



$(document).ready(function(){ 

$(".kodd").mouseover(function(){	 

		 $(this).fadeTo("slow", 0.1);

		  });

	$(".kodd").mouseout(function(){	

         $(this).fadeTo(5000, 1);	 

      }); 

	

$(".grafrefte1").click(function(){	 

		 $(".grafrefteb1").css("display","inline");

		$(".grafrefteb2").css("display","none");

		$(".grafrefteb3").css("display","none");

		$(".grafrefteb4").css("display","none");

  });

$(".grafrefte2").click(function(){	 

		 $(".grafrefteb2").css("display","inline");

		$(".grafrefteb1").css("display","none");

		$(".grafrefteb3").css("display","none");

		$(".grafrefteb4").css("display","none");

  });

$(".grafrefte3").click(function(){	 

		 $(".grafrefteb3").css("display","inline");

		$(".grafrefteb2").css("display","none");

		$(".grafrefteb1").css("display","none");

		$(".grafrefteb4").css("display","none");

  });

$(".grafrefte4").click(function(){	 

		 $(".grafrefteb4").css("display","inline");

		$(".grafrefteb2").css("display","none");

		$(".grafrefteb1").css("display","none");

		$(".grafrefteb3").css("display","none");

  });

		

	 });



/***********************************************

* SEOlife: for this great script thank you:

* CMotion Image Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)

* Visit http://www.dynamicDrive.com for source code

* This copyright notice must stay intact for legal use

* Modified for autowidth and optional starting positions in

* http://www.dynamicdrive.com/forums/showthread.php?t=11839 by jschuer1 8/5/06

***********************************************/



 //1) Set width of the "neutral" area in the center of the gallery.

var restarea=6;

 //2) Set top scroll speed in pixels. Script auto creates a range from 0 to top speed.

var maxspeed=7;

 //3) Set to maximum width for gallery - must be less than the actual length of the image train.

var maxwidth=1000;

 //4) Set to 1 for left start, 0 for right, 2 for center.

var startpos=0;

 //5) Set message to show at end of gallery. Enter "" to disable message.

var endofgallerymsg='<span style="font-size: 11px;">Grafické referencie</span>';



function enlargeimage(path, optWidth, optHeight){ //function to enlarge image. Change as desired.

var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width

var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height

var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"

window.open(path,"", winattributes)

}



////NO NEED TO EDIT BELOW THIS LINE////////////



var iedom=document.all||document.getElementById, scrollspeed=0, movestate='', actualwidth='', cross_scroll, ns_scroll, statusdiv, loadedyes=0, lefttime, righttime;



function ietruebody(){

return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;

}



function creatediv(){

statusdiv=document.createElement("div")

statusdiv.setAttribute("id","statusdiv")

document.body.appendChild(statusdiv)

statusdiv=document.getElementById("statusdiv")

statusdiv.innerHTML=endofgallerymsg

}



function positiondiv(){

var mainobjoffset=getposOffset(crossmain, "left"),

menuheight=parseInt(crossmain.offsetHeight),

mainobjoffsetH=getposOffset(crossmain, "top");

statusdiv.style.left=mainobjoffset+(menuwidth/2)-(statusdiv.offsetWidth/2)+"px";

statusdiv.style.top=menuheight+mainobjoffsetH+"px";

}



function showhidediv(what){

if (endofgallerymsg!="") {

positiondiv();

statusdiv.style.visibility=what;

}

}



function getposOffset(what, offsettype){

var totaloffset=(offsettype=="left")? what.offsetLeft: what.offsetTop;

var parentEl=what.offsetParent;

while (parentEl!=null){

totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;

parentEl=parentEl.offsetParent;

}

return totaloffset;

}





function moveleft(){

if (loadedyes){

movestate="left";

if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){

cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px";

showhidediv("hidden");

}

else

showhidediv("visible");

}

lefttime=setTimeout("moveleft()",10);

}



function moveright(){

if (loadedyes){

movestate="right";

if (iedom&&parseInt(cross_scroll.style.left)<0){

cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px";

showhidediv("hidden");

}

else

showhidediv("visible");

}

righttime=setTimeout("moveright()",10);

}



function motionengine(e){

var mainobjoffset=getposOffset(crossmain, "left"),

dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft,

dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop,

curposy=window.event? event.clientX : e.clientX? e.clientX: "";

curposy-=mainobjoffset-dsocx;

var leftbound=(menuwidth-restarea)/2;

var rightbound=(menuwidth+restarea)/2;

if (curposy>rightbound){

scrollspeed=(curposy-rightbound)/((menuwidth-restarea)/2) * maxspeed;

clearTimeout(righttime);

if (movestate!="left") moveleft();

}

else if (curposy<leftbound){

scrollspeed=(leftbound-curposy)/((menuwidth-restarea)/2) * maxspeed;

clearTimeout(lefttime);

if (movestate!="right") moveright();

}

else

scrollspeed=0;





}



function contains_ns6(a, b) {

if (b!==null)

while (b.parentNode)

if ((b = b.parentNode) == a)

return true;

return false;

}



function stopmotion(e){

if (!window.opera||(window.opera&&e.relatedTarget!==null))

if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){

clearTimeout(lefttime);

clearTimeout(righttime);

movestate="";

}

}



function fillup(){

if (iedom){

crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer;

if(typeof crossmain.style.maxWidth!=='undefined')

crossmain.style.maxWidth=maxwidth+'px';

menuwidth=crossmain.offsetWidth;

cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery;

actualwidth=document.getElementById? document.getElementById("trueContainer").offsetWidth : document.all['trueContainer'].offsetWidth;

if (startpos)

cross_scroll.style.left=(menuwidth-actualwidth)/startpos+'px';

crossmain.onmousemove=function(e){

motionengine(e);

}



crossmain.onmouseout=function(e){

stopmotion(e);

showhidediv("hidden");

}

}

loadedyes=1

if (endofgallerymsg!=""){

creatediv();

positiondiv();

}

if (document.body.filters)

onresize()

}

window.onload=fillup;



onresize=function(){

if (typeof motioncontainer!=='undefined'&&motioncontainer.filters){

motioncontainer.style.width="0";

motioncontainer.style.width="";

motioncontainer.style.width=Math.min(motioncontainer.offsetWidth, maxwidth)+'px';

}

menuwidth=crossmain.offsetWidth;

cross_scroll.style.left=startpos? (menuwidth-actualwidth)/startpos+'px' : 0;

}



$(document).ready(function(){ 

$(".cosme").fadeTo("slow", 0.5);

$(".cosme").mouseover(function(){	 

		 $(this).fadeTo("slow", 1);

		  });

	$(".cosme").mouseout(function(){	

         $(this).fadeTo("slow", 0.5);	 

      }); 

	$(".cototo").fadeTo("slow", 0.5);

$(".cototo").mouseover(function(){	 

		 $(this).fadeTo("slow", 1);

		  });	
		  $(".cototo").click(function(){

    $(this).fadeTo("slow", 0.1);

  });

	 });




$(document).ready(function(){

$(".npktt").click(function(){

$(".npkt1").css("display","none");

$(".npkt").css("display","inline");

});

$(".npktt1").click(function(){

$(".npkt").css("display","none");

$(".npkt1").css("display","inline");

});

});



$(document).ready(function() {

			/*

			*   Examples - images

			*/



			$("a#example1").fancybox({

				'titleShow'		: false

			});



			$("a#example2").fancybox({

				'titleShow'		: false,

				'transitionIn'	: 'elastic',

				'transitionOut'	: 'elastic'

			});



			$("a#example3").fancybox({

				'titleShow'		: false,

				'transitionIn'	: 'none',

				'transitionOut'	: 'none'

			});



			$("a#example4").fancybox();



			$("a#example5").fancybox({

				'titlePosition'	: 'inside'

			});



			$("a#example6").fancybox({

				'titlePosition'	: 'over'

			});



			$("a[rel=example_group]").fancybox({

				'transitionIn'		: 'none',

				'transitionOut'		: 'none',

				'titlePosition' 	: 'over',

				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {

					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';

				}

			});



			/*

			*   Examples - various

			*/



			$("#various1").fancybox({

				'titlePosition'		: 'inside',

				'transitionIn'		: 'none',

				'transitionOut'		: 'none'

			});



			$("#various2").fancybox();



			$("#various3").fancybox({

				'width'				: '75%',

				'height'			: '75%',

				'autoScale'			: false,

				'transitionIn'		: 'none',

				'transitionOut'		: 'none',

				'type'				: 'iframe'

			});



			$("#various4").fancybox({

				'padding'			: 0,

				'autoScale'			: false,

				'transitionIn'		: 'none',

				'transitionOut'		: 'none'

			});

		});

		/*

 * FancyBox - jQuery Plugin

 * SEOlife: for this great script thank you:

 * Simple and fancy lightbox alternative

 *

 * Examples and documentation at: http://fancybox.net

 * 

 * Copyright (c) 2008 - 2010 Janis Skarnelis

 *

 * Version: 1.3.1 (05/03/2010)

 * Requires: jQuery v1.3+

 *

 * Dual licensed under the MIT and GPL licenses:

 *   http://www.opensource.org/licenses/mit-license.php

 *   http://www.gnu.org/licenses/gpl.html

 */



(function($) {



	var tmp, loading, overlay, wrap, outer, inner, close, nav_left, nav_right,



		selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],



		ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,



		loadingTimer, loadingFrame = 1,



		start_pos, final_pos, busy = false, shadow = 20, fx = $.extend($('<div/>')[0], { prop: 0 }), titleh = 0, 



		isIE6 = !$.support.opacity && !window.XMLHttpRequest,



		/*

		 * Private methods 

		 */



		fancybox_abort = function() {

			loading.hide();



			imgPreloader.onerror = imgPreloader.onload = null;



			if (ajaxLoader) {

				ajaxLoader.abort();

			}



			tmp.empty();

		},



		fancybox_error = function() {

			$.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>', {

				'scrolling'		: 'no',

				'padding'		: 20,

				'transitionIn'	: 'none',

				'transitionOut'	: 'none'

			});

		},



		fancybox_get_viewport = function() {

			return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ];

		},



		fancybox_get_zoom_to = function () {

			var view	= fancybox_get_viewport(),

				to		= {},



				margin = currentOpts.margin,

				resize = currentOpts.autoScale,



				horizontal_space	= (shadow + margin) * 2,

				vertical_space		= (shadow + margin) * 2,

				double_padding		= (currentOpts.padding * 2),

				

				ratio;



			if (currentOpts.width.toString().indexOf('%') > -1) {

				to.width = ((view[0] * parseFloat(currentOpts.width)) / 100) - (shadow * 2) ;

				resize = false;



			} else {

				to.width = currentOpts.width + double_padding;

			}



			if (currentOpts.height.toString().indexOf('%') > -1) {

				to.height = ((view[1] * parseFloat(currentOpts.height)) / 100) - (shadow * 2);

				resize = false;



			} else {

				to.height = currentOpts.height + double_padding;

			}



			if (resize && (to.width > (view[0] - horizontal_space) || to.height > (view[1] - vertical_space))) {

				if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {

					horizontal_space	+= double_padding;

					vertical_space		+= double_padding;



					ratio = Math.min(Math.min( view[0] - horizontal_space, currentOpts.width) / currentOpts.width, Math.min( view[1] - vertical_space, currentOpts.height) / currentOpts.height);



					to.width	= Math.round(ratio * (to.width	- double_padding)) + double_padding;

					to.height	= Math.round(ratio * (to.height	- double_padding)) + double_padding;



				} else {

					to.width	= Math.min(to.width,	(view[0] - horizontal_space));

					to.height	= Math.min(to.height,	(view[1] - vertical_space));

				}

			}



			to.top	= view[3] + ((view[1] - (to.height	+ (shadow * 2 ))) * 0.5);

			to.left	= view[2] + ((view[0] - (to.width	+ (shadow * 2 ))) * 0.5);



			if (currentOpts.autoScale === false) {

				to.top	= Math.max(view[3] + margin, to.top);

				to.left	= Math.max(view[2] + margin, to.left);

			}



			return to;

		},



		fancybox_format_title = function(title) {

			if (title && title.length) {

				switch (currentOpts.titlePosition) {

					case 'inside':

						return title;

					case 'over':

						return '<span id="fancybox-title-over">' + title + '</span>';

					default:

						return '<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">' + title + '</span><span id="fancybox-title-right"></span></span>';

				}

			}



			return false;

		},



		fancybox_process_title = function() {

			var title	= currentOpts.title,

				width	= final_pos.width - (currentOpts.padding * 2),

				titlec	= 'fancybox-title-' + currentOpts.titlePosition;

				

			$('#fancybox-title').remove();



			titleh = 0;



			if (currentOpts.titleShow === false) {

				return;

			}



			title = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(title, currentArray, currentIndex, currentOpts) : fancybox_format_title(title);



			if (!title || title === '') {

				return;

			}



			$('<div id="fancybox-title" class="' + titlec + '" />').css({

				'width'			: width,

				'paddingLeft'	: currentOpts.padding,

				'paddingRight'	: currentOpts.padding

			}).html(title).appendTo('body');



			switch (currentOpts.titlePosition) {

				case 'inside':

					titleh = $("#fancybox-title").outerHeight(true) - currentOpts.padding;

					final_pos.height += titleh;

				break;



				case 'over':

					$('#fancybox-title').css('bottom', currentOpts.padding);

				break;



				default:

					$('#fancybox-title').css('bottom', $("#fancybox-title").outerHeight(true) * -1);

				break;

			}



			$('#fancybox-title').appendTo( outer ).hide();

		},



		fancybox_set_navigation = function() {

			$(document).unbind('keydown.fb').bind('keydown.fb', function(e) {

				if (e.keyCode == 27 && currentOpts.enableEscapeButton) {

					e.preventDefault();

					$.fancybox.close();



				} else if (e.keyCode == 37) {

					e.preventDefault();

					$.fancybox.prev();



				} else if (e.keyCode == 39) {

					e.preventDefault();

					$.fancybox.next();

				}

			});



			if ($.fn.mousewheel) {

				wrap.unbind('mousewheel.fb');



				if (currentArray.length > 1) {

					wrap.bind('mousewheel.fb', function(e, delta) {

						e.preventDefault();



						if (busy || delta === 0) {

							return;

						}



						if (delta > 0) {

							$.fancybox.prev();

						} else {

							$.fancybox.next();

						}

					});

				}

			}



			if (!currentOpts.showNavArrows) { return; }



			if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {

				nav_left.show();

			}



			if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {

				nav_right.show();

			}

		},



		fancybox_preload_images = function() {

			var href, 

				objNext;

				

			if ((currentArray.length -1) > currentIndex) {

				href = currentArray[ currentIndex + 1 ].href;



				if (typeof href !== 'undefined' && href.match(imgRegExp)) {

					objNext = new Image();

					objNext.src = href;

				}

			}



			if (currentIndex > 0) {

				href = currentArray[ currentIndex - 1 ].href;



				if (typeof href !== 'undefined' && href.match(imgRegExp)) {

					objNext = new Image();

					objNext.src = href;

				}

			}

		},



		_finish = function () {

			inner.css('overflow', (currentOpts.scrolling == 'auto' ? (currentOpts.type == 'image' || currentOpts.type == 'iframe' || currentOpts.type == 'swf' ? 'hidden' : 'auto') : (currentOpts.scrolling == 'yes' ? 'auto' : 'visible')));



			if (!$.support.opacity) {

				inner.get(0).style.removeAttribute('filter');

				wrap.get(0).style.removeAttribute('filter');

			}



			$('#fancybox-title').show();



			if (currentOpts.hideOnContentClick)	{

				inner.one('click', $.fancybox.close);

			}

			if (currentOpts.hideOnOverlayClick)	{

				overlay.one('click', $.fancybox.close);

			}



			if (currentOpts.showCloseButton) {

				close.show();

			}



			fancybox_set_navigation();



			$(window).bind("resize.fb", $.fancybox.center);



			if (currentOpts.centerOnScroll) {

				$(window).bind("scroll.fb", $.fancybox.center);

			} else {

				$(window).unbind("scroll.fb");

			}



			if ($.isFunction(currentOpts.onComplete)) {

				currentOpts.onComplete(currentArray, currentIndex, currentOpts);

			}



			busy = false;



			fancybox_preload_images();

		},



		fancybox_draw = function(pos) {

			var width	= Math.round(start_pos.width	+ (final_pos.width	- start_pos.width)	* pos),

				height	= Math.round(start_pos.height	+ (final_pos.height	- start_pos.height)	* pos),



				top		= Math.round(start_pos.top	+ (final_pos.top	- start_pos.top)	* pos),

				left	= Math.round(start_pos.left	+ (final_pos.left	- start_pos.left)	* pos);



			wrap.css({

				'width'		: width		+ 'px',

				'height'	: height	+ 'px',

				'top'		: top		+ 'px',

				'left'		: left		+ 'px'

			});



			width	= Math.max(width - currentOpts.padding * 2, 0);

			height	= Math.max(height - (currentOpts.padding * 2 + (titleh * pos)), 0);



			inner.css({

				'width'		: width		+ 'px',

				'height'	: height	+ 'px'

			});



			if (typeof final_pos.opacity !== 'undefined') {

				wrap.css('opacity', (pos < 0.5 ? 0.5 : pos));

			}

		},



		fancybox_get_obj_pos = function(obj) {

			var pos		= obj.offset();



			pos.top		+= parseFloat( obj.css('paddingTop') )	|| 0;

			pos.left	+= parseFloat( obj.css('paddingLeft') )	|| 0;



			pos.top		+= parseFloat( obj.css('border-top-width') )	|| 0;

			pos.left	+= parseFloat( obj.css('border-left-width') )	|| 0;



			pos.width	= obj.width();

			pos.height	= obj.height();



			return pos;

		},



		fancybox_get_zoom_from = function() {

			var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,

				from = {},

				pos,

				view;



			if (orig && orig.length) {

				pos = fancybox_get_obj_pos(orig);



				from = {

					width	: (pos.width	+ (currentOpts.padding * 2)),

					height	: (pos.height	+ (currentOpts.padding * 2)),

					top		: (pos.top		- currentOpts.padding - shadow),

					left	: (pos.left		- currentOpts.padding - shadow)

				};

				

			} else {

				view = fancybox_get_viewport();



				from = {

					width	: 1,

					height	: 1,

					top		: view[3] + view[1] * 0.5,

					left	: view[2] + view[0] * 0.5

				};

			}



			return from;

		},



		fancybox_show = function() {

			loading.hide();



			if (wrap.is(":visible") && $.isFunction(currentOpts.onCleanup)) {

				if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) {

					$.event.trigger('fancybox-cancel');



					busy = false;

					return;

				}

			}



			currentArray	= selectedArray;

			currentIndex	= selectedIndex;

			currentOpts		= selectedOpts;



			inner.get(0).scrollTop	= 0;

			inner.get(0).scrollLeft	= 0;



			if (currentOpts.overlayShow) {

				if (isIE6) {

					$('select:not(#fancybox-tmp select)').filter(function() {

						return this.style.visibility !== 'hidden';

					}).css({'visibility':'hidden'}).one('fancybox-cleanup', function() {

						this.style.visibility = 'inherit';

					});

				}



				overlay.css({

					'background-color'	: currentOpts.overlayColor,

					'opacity'			: currentOpts.overlayOpacity

				}).unbind().show();

			}



			final_pos = fancybox_get_zoom_to();



			fancybox_process_title();



			if (wrap.is(":visible")) {

				$( close.add( nav_left ).add( nav_right ) ).hide();



				var pos = wrap.position(),

					equal;



				start_pos = {

					top		:	pos.top ,

					left	:	pos.left,

					width	:	wrap.width(),

					height	:	wrap.height()

				};



				equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);



				inner.fadeOut(currentOpts.changeFade, function() {

					var finish_resizing = function() {

						inner.html( tmp.contents() ).fadeIn(currentOpts.changeFade, _finish);

					};

					

					$.event.trigger('fancybox-change');



					inner.empty().css('overflow', 'hidden');



					if (equal) {

						inner.css({

							top			: currentOpts.padding,

							left		: currentOpts.padding,

							width		: Math.max(final_pos.width	- (currentOpts.padding * 2), 1),

							height		: Math.max(final_pos.height	- (currentOpts.padding * 2) - titleh, 1)

						});

						

						finish_resizing();



					} else {

						inner.css({

							top			: currentOpts.padding,

							left		: currentOpts.padding,

							width		: Math.max(start_pos.width	- (currentOpts.padding * 2), 1),

							height		: Math.max(start_pos.height	- (currentOpts.padding * 2), 1)

						});

						

						fx.prop = 0;



						$(fx).animate({ prop: 1 }, {

							 duration	: currentOpts.changeSpeed,

							 easing		: currentOpts.easingChange,

							 step		: fancybox_draw,

							 complete	: finish_resizing

						});

					}

				});



				return;

			}



			wrap.css('opacity', 1);



			if (currentOpts.transitionIn == 'elastic') {

				start_pos = fancybox_get_zoom_from();



				inner.css({

						top			: currentOpts.padding,

						left		: currentOpts.padding,

						width		: Math.max(start_pos.width	- (currentOpts.padding * 2), 1),

						height		: Math.max(start_pos.height	- (currentOpts.padding * 2), 1)

					})

					.html( tmp.contents() );



				wrap.css(start_pos).show();



				if (currentOpts.opacity) {

					final_pos.opacity = 0;

				}



				fx.prop = 0;



				$(fx).animate({ prop: 1 }, {

					 duration	: currentOpts.speedIn,

					 easing		: currentOpts.easingIn,

					 step		: fancybox_draw,

					 complete	: _finish

				});



			} else {

				inner.css({

						top			: currentOpts.padding,

						left		: currentOpts.padding,

						width		: Math.max(final_pos.width	- (currentOpts.padding * 2), 1),

						height		: Math.max(final_pos.height	- (currentOpts.padding * 2) - titleh, 1)

					})

					.html( tmp.contents() );



				wrap.css( final_pos ).fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );

			}

		},



		fancybox_process_inline = function() {

			tmp.width(	selectedOpts.width );

			tmp.height(	selectedOpts.height );



			if (selectedOpts.width	== 'auto') {

				selectedOpts.width = tmp.width();

			}

			if (selectedOpts.height	== 'auto') {

				selectedOpts.height	= tmp.height();

			}



			fancybox_show();

		},

		

		fancybox_process_image = function() {

			busy = true;



			selectedOpts.width	= imgPreloader.width;

			selectedOpts.height	= imgPreloader.height;



			$("<img />").attr({

				'id'	: 'fancybox-img',

				'src'	: imgPreloader.src,

				'alt'	: selectedOpts.title

			}).appendTo( tmp );



			fancybox_show();

		},



		fancybox_start = function() {

			fancybox_abort();



			var obj	= selectedArray[ selectedIndex ],

				href, 

				type, 

				title,

				str,

				emb,

				selector,

				data;



			selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));

			title = obj.title || $(obj).title || selectedOpts.title || '';

			

			if (obj.nodeName && !selectedOpts.orig) {

				selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);

			}



			if (title === '' && selectedOpts.orig) {

				title = selectedOpts.orig.attr('alt');

			}



			if (obj.nodeName && (/^(?:javascript|#)/i).test(obj.href)) {

				href = selectedOpts.href || null;

			} else {

				href = selectedOpts.href || obj.href || null;

			}



			if (selectedOpts.type) {

				type = selectedOpts.type;



				if (!href) {

					href = selectedOpts.content;

				}

				

			} else if (selectedOpts.content) {

				type	= 'html';



			} else if (href) {

				if (href.match(imgRegExp)) {

					type = 'image';



				} else if (href.match(swfRegExp)) {

					type = 'swf';



				} else if ($(obj).hasClass("iframe")) {

					type = 'iframe';



				} else if (href.match(/#/)) {

					obj = href.substr(href.indexOf("#"));



					type = $(obj).length > 0 ? 'inline' : 'ajax';

				} else {

					type = 'ajax';

				}

			} else {

				type = 'inline';

			}



			selectedOpts.type	= type;

			selectedOpts.href	= href;

			selectedOpts.title	= title;



			if (selectedOpts.autoDimensions && selectedOpts.type !== 'iframe' && selectedOpts.type !== 'swf') {

				selectedOpts.width		= 'auto';

				selectedOpts.height		= 'auto';

			}



			if (selectedOpts.modal) {

				selectedOpts.overlayShow		= true;

				selectedOpts.hideOnOverlayClick	= false;

				selectedOpts.hideOnContentClick	= false;

				selectedOpts.enableEscapeButton	= false;

				selectedOpts.showCloseButton	= false;

			}



			if ($.isFunction(selectedOpts.onStart)) {

				if (selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts) === false) {

					busy = false;

					return;

				}

			}







			tmp.css('padding', (shadow + selectedOpts.padding + selectedOpts.margin));



			$('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {

				$(this).replaceWith(inner.children());

			});



			switch (type) {

				case 'html' :

					tmp.html( selectedOpts.content );

					fancybox_process_inline();

				break;



				case 'inline' :

					$('<div class="fancybox-inline-tmp" />').hide().insertBefore( $(obj) ).bind('fancybox-cleanup', function() {

						$(this).replaceWith(inner.children());

					}).bind('fancybox-cancel', function() {

						$(this).replaceWith(tmp.children());

					});



					$(obj).appendTo(tmp);



					fancybox_process_inline();

				break;



				case 'image':

					busy = false;



					$.fancybox.showActivity();



					imgPreloader = new Image();



					imgPreloader.onerror = function() {

						fancybox_error();

					};



					imgPreloader.onload = function() {

						imgPreloader.onerror = null;

						imgPreloader.onload = null;

						fancybox_process_image();

					};



					imgPreloader.src = href;

		

				break;



				case 'swf':

					str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';

					emb = '';

					

					$.each(selectedOpts.swf, function(name, val) {

						str += '<param name="' + name + '" value="' + val + '"></param>';

						emb += ' ' + name + '="' + val + '"';

					});



					str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';



					tmp.html(str);



					fancybox_process_inline();

				break;



				case 'ajax':

					selector	= href.split('#', 2);

					data		= selectedOpts.ajax.data || {};



					if (selector.length > 1) {

						href = selector[0];



						if (typeof data == "string") {

							data += '&selector=' + selector[1];

						} else {

							data.selector = selector[1];

						}

					}



					busy = false;

					$.fancybox.showActivity();



					ajaxLoader = $.ajax($.extend(selectedOpts.ajax, {

						url		: href,

						data	: data,

						error	: fancybox_error,

						success : function(data, textStatus, XMLHttpRequest) {

							if (ajaxLoader.status == 200) {

								tmp.html( data );

								fancybox_process_inline();

							}

						}

					}));



				break;



				case 'iframe' :

					$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" scrolling="' + selectedOpts.scrolling + '" src="' + selectedOpts.href + '"></iframe>').appendTo(tmp);

					fancybox_show();

				break;

			}

		},



		fancybox_animate_loading = function() {

			if (!loading.is(':visible')){

				clearInterval(loadingTimer);

				return;

			}



			$('div', loading).css('top', (loadingFrame * -40) + 'px');



			loadingFrame = (loadingFrame + 1) % 12;

		},



		fancybox_init = function() {

			if ($("#fancybox-wrap").length) {

				return;

			}



			$('body').append(

				tmp			= $('<div id="fancybox-tmp"></div>'),

				loading		= $('<div id="fancybox-loading"><div></div></div>'),

				overlay		= $('<div id="fancybox-overlay"></div>'),

				wrap		= $('<div id="fancybox-wrap"></div>')

			);



			if (!$.support.opacity) {

				wrap.addClass('fancybox-ie');

				loading.addClass('fancybox-ie');

			}



			outer = $('<div id="fancybox-outer"></div>')

				.append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>')

				.appendTo( wrap );



			outer.append(

				inner		= $('<div id="fancybox-inner"></div>'),

				close		= $('<a id="fancybox-close"></a>'),



				nav_left	= $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),

				nav_right	= $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')

			);



			close.click($.fancybox.close);

			loading.click($.fancybox.cancel);



			nav_left.click(function(e) {

				e.preventDefault();

				$.fancybox.prev();

			});



			nav_right.click(function(e) {

				e.preventDefault();

				$.fancybox.next();

			});



			if (isIE6) {

				overlay.get(0).style.setExpression('height',	"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");

				loading.get(0).style.setExpression('top',		"(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");



				outer.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>');

			}

		};



	/*

	 * Public methods 

	 */



	$.fn.fancybox = function(options) {

		$(this)

			.data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))

			.unbind('click.fb').bind('click.fb', function(e) {

				e.preventDefault();



				if (busy) {

					return;

				}



				busy = true;



				$(this).blur();



				selectedArray	= [];

				selectedIndex	= 0;



				var rel = $(this).attr('rel') || '';



				if (!rel || rel == '' || rel === 'nofollow') {

					selectedArray.push(this);



				} else {

					selectedArray	= $("a[rel=" + rel + "], area[rel=" + rel + "]");

					selectedIndex	= selectedArray.index( this );

				}



				fancybox_start();



				return false;

			});



		return this;

	};



	$.fancybox = function(obj) {

		if (busy) {

			return;

		}



		busy = true;



		var opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};



		selectedArray	= [];

		selectedIndex	= opts.index || 0;



		if ($.isArray(obj)) {

			for (var i = 0, j = obj.length; i < j; i++) {

				if (typeof obj[i] == 'object') {

					$(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));

				} else {

					obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));

				}

			}



			selectedArray = jQuery.merge(selectedArray, obj);



		} else {

			if (typeof obj == 'object') {

				$(obj).data('fancybox', $.extend({}, opts, obj));

			} else {

				obj = $({}).data('fancybox', $.extend({content : obj}, opts));

			}



			selectedArray.push(obj);

		}



		if (selectedIndex > selectedArray.length || selectedIndex < 0) {

			selectedIndex = 0;

		}



		fancybox_start();

	};



	$.fancybox.showActivity = function() {

		clearInterval(loadingTimer);



		loading.show();

		loadingTimer = setInterval(fancybox_animate_loading, 66);

	};



	$.fancybox.hideActivity = function() {

		loading.hide();

	};



	$.fancybox.next = function() {

		return $.fancybox.pos( currentIndex + 1);

	};

	

	$.fancybox.prev = function() {

		return $.fancybox.pos( currentIndex - 1);

	};



	$.fancybox.pos = function(pos) {

		if (busy) {

			return;

		}



		pos = parseInt(pos, 10);



		if (pos > -1 && currentArray.length > pos) {

			selectedIndex = pos;

			fancybox_start();

		}



		if (currentOpts.cyclic && currentArray.length > 1 && pos < 0) {

			selectedIndex = currentArray.length - 1;

			fancybox_start();

		}



		if (currentOpts.cyclic && currentArray.length > 1 && pos >= currentArray.length) {

			selectedIndex = 0;

			fancybox_start();

		}



		return;

	};



	$.fancybox.cancel = function() {

		if (busy) {

			return;

		}



		busy = true;



		$.event.trigger('fancybox-cancel');



		fancybox_abort();



		if (selectedOpts && $.isFunction(selectedOpts.onCancel)) {

			selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);

		}



		busy = false;

	};



	// Note: within an iframe use - parent.$.fancybox.close();

	$.fancybox.close = function() {

		if (busy || wrap.is(':hidden')) {

			return;



		}



		busy = true;



		if (currentOpts && $.isFunction(currentOpts.onCleanup)) {

			if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) {

				busy = false;

				return;

			}

		}



		fancybox_abort();



		$(close.add( nav_left ).add( nav_right )).hide();



		$('#fancybox-title').remove();



		wrap.add(inner).add(overlay).unbind();



		$(window).unbind("resize.fb scroll.fb");

		$(document).unbind('keydown.fb');



		function _cleanup() {

			overlay.fadeOut('fast');



			wrap.hide();



			$.event.trigger('fancybox-cleanup');



			inner.empty();



			if ($.isFunction(currentOpts.onClosed)) {

				currentOpts.onClosed(currentArray, currentIndex, currentOpts);

			}



			currentArray	= selectedOpts	= [];

			currentIndex	= selectedIndex	= 0;

			currentOpts		= selectedOpts	= {};



			busy = false;

		}



		inner.css('overflow', 'hidden');



		if (currentOpts.transitionOut == 'elastic') {

			start_pos = fancybox_get_zoom_from();



			var pos = wrap.position();



			final_pos = {

				top		:	pos.top ,

				left	:	pos.left,

				width	:	wrap.width(),

				height	:	wrap.height()

			};



			if (currentOpts.opacity) {

				final_pos.opacity = 1;

			}



			fx.prop = 1;



			$(fx).animate({ prop: 0 }, {

				 duration	: currentOpts.speedOut,

				 easing		: currentOpts.easingOut,

				 step		: fancybox_draw,

				 complete	: _cleanup

			});



		} else {

			wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);

		}

	};



	$.fancybox.resize = function() {

		var c, h;

		

		if (busy || wrap.is(':hidden')) {

			return;

		}



		busy = true;



		c = inner.wrapInner("<div style='overflow:auto'></div>").children();

		h = c.height();



		wrap.css({height:	h + (currentOpts.padding * 2) + titleh});

		inner.css({height:	h});



		c.replaceWith(c.children());



		$.fancybox.center();

	};



	$.fancybox.center = function() {

		busy = true;



		var view	= fancybox_get_viewport(),

			margin	= currentOpts.margin,

			to		= {};



		to.top	= view[3] + ((view[1] - ((wrap.height() - titleh) + (shadow * 2 ))) * 0.5);

		to.left	= view[2] + ((view[0] - (wrap.width() + (shadow * 2 ))) * 0.5);



		to.top	= Math.max(view[3] + margin, to.top);

		to.left	= Math.max(view[2] + margin, to.left);



		wrap.css(to);



		busy = false;

	};



	$.fn.fancybox.defaults = {

		padding				:	10,

		margin				:	20,

		opacity				:	false,

		modal				:	false,

		cyclic				:	false,

		scrolling			:	'auto',	// 'auto', 'yes' or 'no'



		width				:	560,

		height				:	340,



		autoScale			:	true,

		autoDimensions		:	true,

		centerOnScroll		:	false,



		ajax				:	{},

		swf					:	{ wmode: 'transparent' },



		hideOnOverlayClick	:	true,

		hideOnContentClick	:	false,



		overlayShow			:	true,

		overlayOpacity		:	0.3,

		overlayColor		:	'#666',



		titleShow			:	true,

		titlePosition		:	'outside',	// 'outside', 'inside' or 'over'

		titleFormat			:	null,



		transitionIn		:	'fade',	// 'elastic', 'fade' or 'none'

		transitionOut		:	'fade',	// 'elastic', 'fade' or 'none'



		speedIn				:	300,

		speedOut			:	300,



		changeSpeed			:	300,

		changeFade			:	'fast',



		easingIn			:	'swing',

		easingOut			:	'swing',



		showCloseButton		:	true,

		showNavArrows		:	true,

		enableEscapeButton	:	true,



		onStart				:	null,

		onCancel			:	null,

		onComplete			:	null,

		onCleanup			:	null,

		onClosed			:	null

	};



	$(document).ready(function() {

		fancybox_init();

	});



})(jQuery);



$(document).ready(function(){

  $(".sipkomon").click(function(){

 $(".sipkomola").css({"display":"inline"});

    $(".sipkomon").css({"display":"none"});

	$(".sipkomof").css({"display":"inline"});

  });  });

$(document).ready(function(){

  $(".sipkomof").click(function(){

 $(".sipkomola").css({"display":"none"});

    $(".sipkomof").css({"display":"none"});

	$(".sipkomon").css({"display":"inline"});

  });  });



/**************************************************

 * dom-drag.js

 * 09.25.2001

 * www.youngpup.net

 **************************************************

 * 10.28.2001 - fixed minor bug where events

 * sometimes fired off the handle, not the root.

 **************************************************/



var Drag = {



	obj : null,



	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)

	{

		o.onmousedown	= Drag.start;



		o.hmode			= bSwapHorzRef ? false : true ;

		o.vmode			= bSwapVertRef ? false : true ;



		o.root = oRoot && oRoot != null ? oRoot : o ;



		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";

		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";

		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";

		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";



		o.minX	= typeof minX != 'undefined' ? minX : null;

		o.minY	= typeof minY != 'undefined' ? minY : null;

		o.maxX	= typeof maxX != 'undefined' ? maxX : null;

		o.maxY	= typeof maxY != 'undefined' ? maxY : null;



		o.xMapper = fXMapper ? fXMapper : null;

		o.yMapper = fYMapper ? fYMapper : null;



		o.root.onDragStart	= new Function();

		o.root.onDragEnd	= new Function();

		o.root.onDrag		= new Function();

	},



	start : function(e)

	{

		var o = Drag.obj = this;

		e = Drag.fixE(e);

		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);

		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );

		o.root.onDragStart(x, y);



		o.lastMouseX	= e.clientX;

		o.lastMouseY	= e.clientY;



		if (o.hmode) {

			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;

			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;

		} else {

			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;

			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;

		}



		if (o.vmode) {

			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;

			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;

		} else {

			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;

			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;

		}



		document.onmousemove	= Drag.drag;

		document.onmouseup		= Drag.end;



		return false;

	},



	drag : function(e)

	{

		e = Drag.fixE(e);

		var o = Drag.obj;



		var ey	= e.clientY;

		var ex	= e.clientX;

		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);

		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );

		var nx, ny;



		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);

		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);

		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);

		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);



		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));

		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));



		if (o.xMapper)		nx = o.xMapper(y)

		else if (o.yMapper)	ny = o.yMapper(x)



		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";

		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";

		Drag.obj.lastMouseX	= ex;

		Drag.obj.lastMouseY	= ey;



		Drag.obj.root.onDrag(nx, ny);

		return false;

	},



	end : function()

	{

		document.onmousemove = null;

		document.onmouseup   = null;

		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 

									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));

		Drag.obj = null;

	},



	fixE : function(e)

	{

		if (typeof e == 'undefined') e = window.event;

		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;

		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;

		return e;

	}

};

