
(function($) {
	/**
	 * attaches a character counter to each textarea element in the jQuery object
	 * usage: $("#myTextArea").charCounter(max, settings);
	 */
/* wordcount, charcount and limitor
	** developend by some one
	** madified by sankar.suda to work with words and chars both
*/
	
	$.fn.wordCharCounter = function (settings) {
		//max = max || 10;
		settings = $.extend({
			container: "<br><span></span>",
			classname: "charcounter",
//			format: "(%1 words remaining)",
			pulse: true,
			delay: 0,
			word : false,
			valueAttr:'maxlength'
			
		}, settings);
		var p, timeout;
		
		function count(el, container) 
		{
			el = $(el);
			
			var max = isNaN(el.attr(settings.valueAttr)) ? 100 : el.attr(settings.valueAttr);
			var format = (settings.word) ? "(%1 words remaining)" : "(%1 Chars remaining)" 
			var len = (settings.word) ? $.trim(el.val()).replace(/\s+/g," ").split(' ').length : el.val().length;
			
			if ( len > max) 
			{
				if(settings.word)
				{
					el.val(el.val().split(/(\s+)/, (max*2)-1).join(''));
				}
				else
				{
			  		el.val(el.val().substr(0, max));
				}
				 
			    if (settings.pulse && !p) {
			    	pulse(container, true);
			    };
			};
			if (settings.delay > 0) {
				if (timeout) {
					window.clearTimeout(timeout);
				}
				timeout = window.setTimeout(function () {
					container.html(format.replace(/%1/, (max - len)));
				}, settings.delay);
			} else {
				container.html(format.replace(/%1/, (max - len)));
			}
		};
		
		function pulse(el, again) {
			if (p) {
				window.clearTimeout(p);
				p = null;
			};
			el.animate({ opacity: 0.1 }, 100, function () {
				$(this).animate({ opacity: 1.0 }, 100);
			});
			if (again) {
				p = window.setTimeout(function () { pulse(el) }, 200);
			};
		};
		
		return this.each(function () {
			var container = (!settings.container.match(/^<.+>$/)) 
				? $(settings.container) 
				: $(settings.container)
					.insertAfter(this)
					.addClass(settings.classname);
			$(this)
				.bind("keydown", function () { count(this, container); })
				.bind("keypress", function () { count(this, container); })
				.bind("keyup", function () { count(this, container); })
				.bind("focus", function () { count(this, container); })
				.bind("mouseover", function () { count(this, container); })
				.bind("mouseout", function () { count(this, container); })
				.bind("paste", function () { 
					var me = this;
					setTimeout(function () { count(me, container); }, 10);
				});
			if (this.addEventListener) {
				this.addEventListener('input', function () { count(this, container); }, false);
			};
			count(this, container);
		});
	};

})(jQuery);

(function($)
{
	
/*watermark plugin written dy sankar.suda(sankar.suda@gmail.com)
*/

	$.fn.watermark = function(settings)
	{
		var opt = $.extend($.fn.watermark.settings,settings);
		
		return this.each(function()
				{
					var $this = $(this);
					var markup = $this.attr(opt.valueAttribute);
					var defaultColor = $this.css('color');
					
					if($this.val().length && $this.val() != markup)
					{
						$this.removeClass(opt.watermarkClass);
						$this.css('color',defaultColor);
					}else
					{
						$this.val(markup);
						$this.addClass(opt.watermarkClass);
						$this.css('color',opt.watermarkColor);
					}

				function focus()
				{					
					if($this.hasClass(opt.watermarkClass))
					{
						$this.val('');
						$this.css('color',defaultColor);
						//$this.removeClass(opt.watermarkClass);
					}
				};
				
				function blur()
				{					
					if(!$this.val().length)
					{
						$this.val($this.attr(opt.valueAttribute));
						$this.addClass(opt.watermarkClass);
						$this.css('color',opt.watermarkColor);
					}else
					{
						$this.removeClass(opt.watermarkClass);
						$this.css('color',defaultColor);
					}
				};
				
				function submit()
				{
					if ($this.val() == $this.attr(opt.valueAttribute))
						$this.val('');
				}
				
				$this.focus(focus);
				$this.blur(blur);
				$this.parents("form:first").submit(submit);
				
				});
		

	};
	
				
	$.fn.watermark.settings = {
		watermarkClass : 'watermark',
		watermarkColor : '#ccc',
		valueAttribute : 'title'
	};
	
})(jQuery);



(function($)
{
	$.fn.formHints = function(settings)
	{
		settings = $.extend({},{
				offsetX : 20,
				offsetY : 0
				},settings);

		return this.each(function()
				{
					var $this 		= $(this);
					var counter = 0;

				function blur()
				{
					remove();
					if($this.hasClass('must') && $this.val().length == 0)
					{
						messsage();
					}else 
					if($this.hasClass('must') && $this.val().length > 0)
					{
						
						validate(true);		
					}else
					{	
						//alert('not mandatarty');
						validate();
					};
					
				}
				
					function validate(must)
					{
						var m = (must) ?  $this.val().length > 0 : $this.val().length > 0;
								//validate email
								if($this.hasClass('email') && m)
								{	
									if(!isValidEmail($this.val()))
										messsage('Please enter a valid email address');
								}
								
								//validate mobile
								if($this.hasClass('mobile') && m)
								{
									if(isNaN($this.val()) || $this.val().length < 10)
										messsage('Please enter a valid 10 digists mobile number');
								}
								
								//check is number
								if($this.hasClass('int') && m )
								{
									if( isNaN($this.val()) )
										messsage('Please enter a numeric value');
								}
								
								//validate url
								if($this.hasClass('url') && m)
								{
									if(!isUrl($this.val()))
										messsage('Please enter a valid URL');
								}
					}
					
					function messsage(msg)
					{
						//remove();
						var positions 	= $this.position();
						var top 		= positions.top;
						var left 		= positions.left;
						var w			= $this.width();
						var h   		= $this.height();
						
						if($this.is("input") || $this.get(0).tagName == 'SELECT')
						{
							var y 			= (top-settings.offsetY-h);
							var x 			= (left+w+settings.offsetX);
						}else
						{
							var y 			= (top-settings.offsetY+6);
							var x 			= (left+w+settings.offsetX);
						}
						var msg1 = (msg) ? msg : 'This field is required';
						
						$this.after('<p class="vtips" style="display:none;top:'+y+'px; left:'+x+'px"><img src="images/tip.png" class="hintTip">'+msg1+'</p>');
						$this.next('.vtips').fadeIn();
						$this.addClass('input_error');
					}
					
					
					function remove()
					{
						//$this.next('.vtips:eq(0)').fadeOut('slow',function(){$this.next('.vtips:eq(0)').remove();});
						$this.next('.vtips:eq(0)').remove();
						$this.removeClass('input_error');
					};
					
					function isUrl(s) {
						var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
						return regexp.test(s);
					 };

					function isValidEmail(emailAddress) {
					var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
					return pattern.test(emailAddress);
				};

/*					$this.parents("form:first").submit(function()
					  {
						  alert(' i am submitting');
						  return false;
					  });
*/					$this.blur(blur);
					
				});
	};
	

  
})(jQuery);


(function($)
{

$.fn.infiniteCarousel = function () {

    function repeat(str, num) {
        return new Array( num + 1 ).join( str );
    }
  
    return this.each(function () {
        var $wrapper = $('> div', this).css('overflow', 'hidden'),
            $slider = $wrapper.find('> ul'),
            $items = $slider.find('> li'),
            $single = $items.filter(':first'),
            
            singleWidth = $single.outerWidth(), 
            visible = Math.ceil($wrapper.innerWidth() / singleWidth),
            currentPage = 1,
            pages = Math.ceil($items.length / visible);            


        // 1. Pad so that 'visible' number will always be seen, otherwise create empty items
        if (($items.length % visible) != 0) {
            $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
            $items = $slider.find('> li');
        }

        // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
        $items.filter(':first').before($items.slice(- visible).clone().addClass('cloned'));
        $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
        $items = $slider.find('> li'); // reselect
        
        // 3. Set the left position to the first 'real' item
        $wrapper.scrollLeft(singleWidth * visible);
        
        // 4. paging function
        function gotoPage(page) {
            var dir = page < currentPage ? -1 : 1,
                n = Math.abs(currentPage - page),
                left = singleWidth * dir * visible * n;
            
            $wrapper.filter(':not(:animated)').animate({
                scrollLeft : '+=' + left
            }, 500, function () {
                if (page == 0) {
                    $wrapper.scrollLeft(singleWidth * visible * pages);
                    page = pages;
                } else if (page > pages) {
                    $wrapper.scrollLeft(singleWidth * visible);
                    // reset back to start position
                    page = 1;
                } 

                currentPage = page;
            });                
            
            return false;
        }
        
        $wrapper.after('<a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a>');
        
        // 5. Bind to the forward and back buttons
        $('a.back', this).click(function () {
            return gotoPage(currentPage - 1);                
        });
        
        $('a.forward', this).click(function () {
            return gotoPage(currentPage + 1);
        });
        
        // create a public interface to move to a specific page
        $(this).bind('goto', function (event, page) {
            gotoPage(page);
        });
    });  
};
})(jQuery);
//ceebox
/*
 * CeeBox 2.1.4 jQuery Plugin (minimized version)
 * Requires jQuery 1.3.2 and swfobject.jquery.js plugin to work
 * Code hosted on GitHub (http://github.com/catcubed/ceebox) Please visit there for version history information
 * By Colin Fahrion (http://www.catcubed.com)
 * Inspiration for ceebox comes from Thickbox (http://jquery.com/demo/thickbox/) and Videobox (http://videobox-lb.sourceforge.net/)
 * However, along the upgrade path ceebox has morphed a long way from those roots.
 * Copyright (c) 2009 Colin Fahrion
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

(function(b){function v(c,a,d){l.vidRegex=function(){var f="";b.each(b.fn.ceebox.videos,function(e,g){if(g.siteRgx!==null&&typeof g.siteRgx!=="string"){e=String(g.siteRgx);f=f+e.slice(1,e.length-2)+"|"}});return new RegExp(f+"\\.swf$","i")}();l.userAgent=navigator.userAgent;b(".cee_close").die().live("click",function(){b.fn.ceebox.closebox();return false});d!=false&&b(c).each(function(f){B(this,f,a,d)});b(c).live("click",function(f){var e=b(f.target).closest("[href]"),g=e.data("ceebox");if(g){var h=
g.opts?b.extend({},a,g.opts):a;b.fn.ceebox.overlay(h);if(g.type=="image"){var i=new Image;i.onload=function(){var m=i.width,j=i.height;h.imageWidth=s(m,b.fn.ceebox.defaults.imageWidth);h.imageHeight=s(j,b.fn.ceebox.defaults.imageHeight);h.imageRatio=m/j;b.fn.ceebox.popup(e,b.extend(h,{type:g.type},{gallery:g.gallery}))};i.src=b(e).attr("href")}else b.fn.ceebox.popup(e,b.extend(h,{type:g.type},{gallery:g.gallery}));return false}})}function w(c){var a=document.documentElement;c=c||100;this.width=(window.innerWidth||
self.innerWidth||a&&a.clientWidth||document.body.clientWidth)-c;this.height=(window.innerHeight||self.innerHeight||a&&a.clientHeight||document.body.clientHeight)-c;return this}function y(c){var a="fixed",d=0,f=z(c.borderWidth,/[0-9]+/g);if(!window.XMLHttpRequest){b("#cee_HideSelect")===null&&b("body").append("<iframe id='cee_HideSelect'></iframe>");a="absolute";d=parseInt(document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop,10)}this.mleft=parseInt(-1*(c.width/2+Number(f[3])),
10);this.mtop=parseInt(-1*(c.height/2+Number(f[0])),10)+d;this.position=a;return this}function z(c,a){c=c.match(a);a=[];var d=c.length;if(d>1){a[0]=c[0];a[1]=c[1];a[2]=d==2?c[0]:c[2];a[3]=d==4?c[3]:c[1]}else a=[c,c,c,c];return a}function C(){document.onkeydown=function(c){c=c||window.event;switch(c.keyCode||c.which){case 13:return false;case 27:b.fn.ceebox.closebox();document.onkeydown=null;break;case 188:case 37:b("#cee_prev").trigger("click");break;case 190:case 39:b("#cee_next").trigger("click");
break;default:break}return true}}function D(c,a,d){function f(m,j){var k,o=i[d.type].bgtop,p=o-2E3;m=="prev"?(k=[{left:0},"left"]):(k=[{right:0},x="right"]);var n=function(q){return b.extend({zIndex:105,width:i[d.type].w+"px",height:i[d.type].h+"px",position:"absolute",top:i[d.type].top,backgroundPosition:k[1]+" "+q+"px"},k[0])};b("<a href='#'></a>").text(m).attr({id:"cee_"+m}).css(n(p)).hover(function(){b(this).css(n(o))},function(){b(this).css(n(p))}).one("click",function(q){q.preventDefault();
(function(E,F,G){b("#cee_prev,#cee_next").unbind().click(function(){return false});document.onkeydown=null;var u=b("#cee_box").children(),H=u.length;u.fadeOut(G,function(){b(this).remove();this==u[H-1]&&E.eq(F).trigger("click")})})(a,j,d.fadeOut)}).appendTo("#cee_box")}var e=d.height,g=d.titleHeight,h=d.padding,i={image:{w:parseInt(d.width/2,10),h:e-g-2*h,top:h,bgtop:(e-g-2*h)/2},video:{w:60,h:80,top:parseInt((e-g-10-2*h)/2,10),bgtop:24}};i.html=i.video;c.prevId>=0&&f("prev",c.prevId);c.nextId&&f("next",
c.nextId);b("#cee_title").append("<div id='cee_count'>Item "+(c.gNum+1)+" of "+c.gLen+"</div>")}function s(c,a){return c&&c<a||!a?c:a}function t(c){return typeof c=="function"}function r(c){var a=c.length;return a>1?c[a-1]:c}b.ceebox={version:"2.1.5"};b.fn.ceebox=function(c){c=b.extend({selector:b(this).selector},b.fn.ceebox.defaults,c);var a=this,d=b(this).selector;c.videoJSON?b.getJSON(c.videoJSON,function(f){b.extend(b.fn.ceebox.videos,f);v(a,c,d)}):v(a,c,d);return this};b.fn.ceebox.defaults={html:true,
image:true,video:true,modal:false,titles:true,htmlGallery:true,imageGallery:true,videoGallery:true,videoWidth:false,videoHeight:false,videoRatio:"16:9",htmlWidth:false,htmlHeight:false,htmlRatio:false,imageWidth:false,imageHeight:false,animSpeed:"normal",easing:"swing",fadeOut:400,fadeIn:400,overlayColor:"#000",overlayOpacity:0.8,boxColor:"",textColor:"",borderColor:"",borderWidth:"3px",padding:15,margin:150,onload:null,unload:null,videoJSON:null,iPhoneRedirect:true};b.fn.ceebox.ratios={"4:3":1.333,
"3:2":1.5,"16:9":1.778,"1:1":1,square:1};b.fn.ceebox.relMatch={width:/(?:width:)([0-9]+)/i,height:/(?:height:)([0-9]+)/i,ratio:/(?:ratio:)([0-9\.:]+)/i,modal:/modal:true/i,nonmodal:/modal:false/i,videoSrc:/(?:videoSrc:)(http:[\/\-\._0-9a-zA-Z:]+)/i,videoId:/(?:videoId:)([\-\._0-9a-zA-Z:]+)/i};b.fn.ceebox.loader="<div id='cee_load' style='z-index:105;top:50%;left:50%;position:fixed'></div>";b.fn.ceebox.videos={base:{param:{wmode:"transparent",allowFullScreen:"true",allowScriptAccess:"always"},flashvars:{autoplay:true}},
facebook:{siteRgx:/facebook\.com\/video/i,idRgx:/(?:v=)([a-zA-Z0-9_]+)/i,src:"http://www.facebook.com/v/[id]"},youtube:{siteRgx:/youtube\.com\/watch/i,idRgx:/(?:v=)([a-zA-Z0-9_\-]+)/i,src:"http://www.youtube.com/v/[id]&hl=en&fs=1&autoplay=1"},metacafe:{siteRgx:/metacafe\.com\/watch/i,idRgx:/(?:watch\/)([a-zA-Z0-9_]+)/i,src:"http://www.metacafe.com/fplayer/[id]/.swf"},google:{siteRgx:/google\.com\/videoplay/i,idRgx:/(?:id=)([a-zA-Z0-9_\-]+)/i,src:"http://video.google.com/googleplayer.swf?docId=[id]&hl=en&fs=true",
flashvars:{playerMode:"normal",fs:true}},spike:{siteRgx:/spike\.com\/video|ifilm\.com\/video/i,idRgx:/(?:\/)([0-9]+)/i,src:"http://www.spike.com/efp",flashvars:{flvbaseclip:"[id]"}},vimeo:{siteRgx:/vimeo\.com\/[0-9]+/i,idRgx:/(?:\.com\/)([a-zA-Z0-9_]+)/i,src:"http://www.vimeo.com/moogaloop.swf?clip_id=[id]&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1"},dailymotion:{siteRgx:/dailymotion\.com\/video/i,idRgx:/(?:video\/)([a-zA-Z0-9_]+)/i,src:"http://www.dailymotion.com/swf/[id]&related=0&autoplay=1"},
cnn:{siteRgx:/cnn\.com\/video/i,idRgx:/(?:\?\/video\/)([a-zA-Z0-9_\/\.]+)/i,src:"http://i.cdn.turner.com/cnn/.element/apps/cvp/3.0/swf/cnn_416x234_embed.swf?context=embed&videoId=[id]",width:416,height:374}};b.fn.ceebox.overlay=function(c){c=b.extend({width:60,height:30,type:"html"},b.fn.ceebox.defaults,c);b("#cee_overlay").size()===0&&b("<div id='cee_overlay'></div>").css({opacity:c.overlayOpacity,position:"absolute",top:0,left:0,backgroundColor:c.overlayColor,width:"100%",height:b(document).height(),
zIndex:100}).appendTo(b("body"));if(b("#cee_box").size()===0){var a=y(c);a={position:a.position,zIndex:102,top:"50%",left:"50%",height:c.height+"px",width:c.width+"px",marginLeft:a.mleft+"px",marginTop:a.mtop+"px",opacity:0,borderWidth:c.borderWidth,borderColor:c.borderColor,backgroundColor:c.boxColor,color:c.textColor};b("<div id='cee_box'></div>").css(a).appendTo("body").animate({opacity:1},c.animSpeed,function(){b("#cee_overlay").addClass("cee_close")})}b("#cee_box").removeClass().addClass("cee_"+
c.type);b("#cee_load").size()===0&&b(b.fn.ceebox.loader).appendTo("body");b("#cee_load").show("fast").animate({opacity:1},"fast")};b.fn.ceebox.popup=function(c,a){var d=w(a.margin);a=b.extend({width:d.width,height:d.height,modal:false,type:"html",onload:null},b.fn.ceebox.defaults,a);var f;if(b(c).is("a,area,input")&&(a.type=="html"||a.type=="image"||a.type=="video")){if(a.gallery)f=b(a.selector).eq(a.gallery.parentId).find("a[href],area[href],input[href]");A[a.type].prototype=new I(c,a);d=new A[a.type];
c=d.content;a.action=d.action;a.modal=d.modal;if(a.titles){a.titleHeight=b(d.titlebox).contents().contents().wrap("<div></div>").parent().attr("id","ceetitletest").css({position:"absolute",top:"-300px",width:d.width+"px"}).appendTo("body").height();b("#ceetitletest").remove();a.titleHeight=a.titleHeight>=10?a.titleHeight+20:30}else a.titleHeight=0;a.width=d.width+2*a.padding;a.height=d.height+a.titleHeight+2*a.padding}b.fn.ceebox.overlay(a);l.action=a.action;l.onload=a.onload;l.unload=a.unload;d=
y(a);d={marginLeft:d.mleft,marginTop:d.mtop,width:a.width+"px",height:a.height+"px",borderWidth:a.borderWidth};if(a.borderColor){var e=z(a.borderColor,/#[1-90a-f]+/gi);d=b.extend(d,{borderTopColor:e[0],borderRightColor:e[1],borderBottomColor:e[2],borderLeftColor:e[3]})}d=a.textColor?b.extend(d,{color:a.textColor}):d;d=a.boxColor?b.extend(d,{backgroundColor:a.boxColor}):d;b("#cee_box").animate(d,a.animSpeed,a.easing,function(){var g=b(this).append(c).children().hide(),h=g.length,i=true;g.fadeIn(a.fadeIn,
function(){if(b(this).is("#cee_iframeContent"))i=false;i&&this==g[h-1]&&b.fn.ceebox.onload()});if(a.modal===true)b("#cee_overlay").removeClass("cee_close");else{b("<a href='#' id='cee_closeBtn' class='cee_close' title='Close'>close</a>").prependTo("#cee_box");a.gallery&&D(a.gallery,f,a);C(void 0,f,a.fadeOut)}})};b.fn.ceebox.closebox=function(c,a){c=c||400;b("#cee_box").fadeOut(c);b("#cee_overlay").fadeOut(typeof c=="number"?c*2:"slow",function(){b("#cee_box,#cee_overlay,#cee_HideSelect,#cee_load").unbind().trigger("unload").remove();
if(t(a))a();else t(l.unload)&&l.unload();l.unload=null});document.onkeydown=null};b.fn.ceebox.onload=function(){b("#cee_load").hide(300).fadeOut(600,function(){b(this).remove()});if(t(l.action)){l.action();l.action=null}if(t(l.onload)){l.onload();l.onload=null}};var l={},B=function(c,a,d){var f,e=[],g=[],h=0;b(c).is("[href]")?(f=b(c)):(f=b(c).find("[href]"));var i={image:function(j,k){return k&&k.match(/\bimage\b/i)?true:j.match(/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/i)||false},video:function(j,k){return k&&
k.match(/\bvideo\b/i)?true:j.match(l.vidRegex)||false},html:function(){return true}};f.each(function(j){var k=this,o=b.metadata?b(k).metadata():false,p=o?b.extend({},d,o):d;b.each(i,function(n){if(i[n](b(k).attr("href"),b(k).attr("rel"))&&p[n]){var q=false;if(p[n+"Gallery"]===true){g[g.length]=j;q=true}e[e.length]={linkObj:k,type:n,gallery:q,linkOpts:p};return false}})});var m=g.length;b.each(e,function(j){if(e[j].gallery){var k={parentId:a,gNum:h,gLen:m};if(h>0)k.prevId=g[h-1];if(h<m-1)k.nextId=
g[h+1];h++}!b.support.opacity&&b(c).is("map")&&b(e[j].linkObj).click(function(o){o.preventDefault()});b.data(e[j].linkObj,"ceebox",{type:e[j].type,opts:e[j].linkOpts,gallery:k})})},I=function(c,a){var d=a[a.type+"Width"],f=a[a.type+"Height"],e=a[a.type+"Ratio"]||d/f,g=b(c).attr("rel");if(g&&g!==""){var h={};b.each(b.fn.ceebox.relMatch,function(m,j){h[m]=j.exec(g)});if(h.modal)a.modal=true;if(h.nonmodal)a.modal=false;if(h.width)d=Number(r(h.width));if(h.height)f=Number(r(h.height));if(h.ratio){e=r(h.ratio);
e=Number(e)?Number(e):String(e)}if(h.videoSrc)this.videoSrc=String(r(h.videoSrc));if(h.videoId)this.videoId=String(r(h.videoId))}var i=w(a.margin);d=s(d,i.width);f=s(f,i.height);if(e){Number(e)||(e=b.fn.ceebox.ratios[e]?Number(b.fn.ceebox.ratios[e]):1);if(d/f>e)d=parseInt(f*e,10);if(d/f<e)f=parseInt(d/e,10)}this.modal=a.modal;this.href=b(c).attr("href");this.title=b(c).attr("title")||c.t||"";this.titlebox=a.titles?"<div id='cee_title'><h2>"+this.title+"</h2></div>":"";this.width=d;this.height=f;this.rel=
g;this.iPhoneRedirect=a.iPhoneRedirect},A={image:function(){this.content="<img id='cee_img' src='"+this.href+"' width='"+this.width+"' height='"+this.height+"' alt='"+this.title+"'/>"+this.titlebox},video:function(){var c="",a=this,d=function(){var e=this,g=a.videoId;e.flashvars=e.param={};e.src=a.videoSrc||a.href;e.width=a.width;e.height=a.height;b.each(b.fn.ceebox.videos,function(h,i){if(i.siteRgx&&typeof i.siteRgx!="string"&&i.siteRgx.test(a.href)){if(i.idRgx){i.idRgx=new RegExp(i.idRgx);g=String(r(i.idRgx.exec(a.href)))}e.src=
i.src?i.src.replace("[id]",g):e.src;i.flashvars&&b.each(i.flashvars,function(m,j){if(typeof j=="string")e.flashvars[m]=j.replace("[id]",g)});i.param&&b.each(i.param,function(m,j){if(typeof j=="string")e.param[m]=j.replace("[id]",g)});e.width=i.width||e.width;e.height=i.height||e.height;e.site=h}});return e}();if(b.flash.hasVersion(8)){this.width=d.width;this.height=d.height;this.action=function(){b("#cee_vid").flash({swf:d.src,params:b.extend(b.fn.ceebox.videos.base.param,d.param),flashvars:b.extend(b.fn.ceebox.videos.base.flashvars,
d.flashvars),width:d.width,height:d.height})}}else{this.width=400;this.height=200;if(l.userAgent.match(/iPhone/i)&&this.iPhoneRedirect||l.userAgent.match(/iPod/i)&&this.iPhoneRedirect){var f=this.href;this.action=function(){b.fn.ceebox.closebox(400,function(){window.location=f})}}else{d.site=d.site||"SWF file";c="<p style='margin:20px'>Adobe Flash 8 or higher is required to view this movie. You can either:</p><ul><li>Follow link to <a href='"+this.href+"'>"+d.site+" </a></li><li>or <a href='http://www.adobe.com/products/flashplayer/'>Install Flash</a></li><li> or <a href='#' class='cee_close'>Close This Popup</a></li></ul>"}}this.content=
"<div id='cee_vid' style='width:"+this.width+"px;height:"+this.height+"px;'>"+c+"</div>"+this.titlebox},html:function(){var c=this.href,a=this.rel;a=[c.match(/[a-zA-Z0-9_\.]+\.[a-zA-Z]{2,4}/i),c.match(/^http:+/),a?a.match(/^iframe/):false];if(document.domain==a[0]&&a[1]&&!a[2]||!a[1]&&!a[2]){var d,f=(d=c.match(/#[a-zA-Z0-9_\-]+/))?String(c.split("#")[0]+" "+d):c;this.action=function(){b("#cee_ajax").load(f)};this.content=this.titlebox+"<div id='cee_ajax' style='width:"+(this.width-30)+"px;height:"+
(this.height-20)+"px'></div>"}else{b("#cee_iframe").remove();this.content=this.titlebox+"<iframe frameborder='0' hspace='0' src='"+c+"' id='cee_iframeContent' name='cee_iframeContent"+Math.round(Math.random()*1E3)+"' onload='jQuery.fn.ceebox.onload()' style='width:"+this.width+"px;height:"+this.height+"px;' > </iframe>"}}}})(jQuery);



//jquery swfobject 1.0.9
(function(F,C){var D=function(H){var G,I=[];for(G in H){if(/string|number/.test(typeof H[G])&&H[G]!==""){I.push(G+'="'+H[G]+'"')}}return I[A]("")},E=function(I){var G,K,J=[],H;if(typeof I=="object"){for(G in I){if(typeof I[G]=="object"){H=[];for(K in I[G]){H.push([K,"=",encodeURIComponent(I[G][K])][A](""))}I[G]=H[A]("&amp;")}if(I[G]){J.push(['<param name="',G,'" value="',I[G],'" />'][A](""))}}I=J[A]("")}return I},B=false,A="join";F[C]=(function(){try{var G="0,0,0",H=navigator.plugins["Shockwave Flash"]||ActiveXObject;G=H.description||(function(){try{return(new H("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}catch(J){}}())}catch(I){}G=G.match(/^[A-Za-z\s]*?(\d+)[\.|,](\d+)(?:\s+[d|r]|,)(\d+)/);return{available:G[1]>0,activeX:H&&!H.name,version:{major:G[1]*1,minor:G[2]*1,release:G[3]*1},hasVersion:function(K){var N=this.version,L="major",M="minor",J="release";K=(/string|number/.test(typeof K))?K.toString().split("."):K||[0,0,0];K=[K[L]||K[0]||N[L],K[M]||K[1]||N[M],K[J]||K[2]||N[J]];return(K[0]<N[L])||(K[0]==N[L]&&K[1]<N[M])||(K[0]==N[L]&&K[1]==N[M]&&K[2]<=N[J])},expressInstall:"expressInstall.swf",create:function(J){if(!F[C].available||B||!typeof J=="object"||!J.swf){return false}if(J.hasVersion&&!F[C].hasVersion(J.hasVersion)){J={swf:J.expressInstall||F[C].expressInstall,attrs:{id:J.id||"SWFObjectExprInst",name:J.name,height:Math.max(J.height||137),width:Math.max(J.width||214)},params:{flashvars:{MMredirectURL:location.href,MMplayerType:(F[C].activeX)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}};B=true}else{J=F.extend(true,{attrs:{id:J.id,name:J.name,height:J.height||180,width:J.width||320},params:{wmode:J.wmode||"opaque",flashvars:J.flashvars}},J)}if(F[C].activeX){J.attrs.classid=J.attrs.classid||"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";J.params.movie=J.params.movie||J.swf}else{J.attrs.type=J.attrs.classid||"application/x-shockwave-flash";J.attrs.data=J.attrs.data||J.swf}return["<object ",D(J.attrs),">",E(J.params),"</object>"][A]("")}}}());F.fn[C]=function(G){if(typeof G=="object"){this.each(function(){var I=document.createElement(C);var H=F[C].create(G);if(H){I.innerHTML=H;if(I.childNodes[0]){this.appendChild(I.childNodes[0])}}})}else{if(typeof G=="function"){this.find("object").andSelf().filter("object").each(function(){var I=this,H="jsInteractionTimeoutMs";I[H]=I[H]||0;if(I[H]<660){if(I.clientWidth||I.clientHeight){G.call(this)}else{setTimeout(function(){F(I)[C](G)},I[H]+66)}}})}}return this}}(jQuery,"flash"));





/**
* Name: piroBox v.1.2.2
* Date: May 2010
* Autor: Diego Valobra (http://www.pirolab.it),(http://www.diegovalobra.com)
* Version: 1.2.2
* Licence: CC-BY-SA http://creativecommons.org/licenses/by-sa/2.5/it/
**/
(function($){$.fn.piroBox=function(opt){opt=jQuery.extend({my_speed:null,close_speed:300,bg_alpha:0.5,close_all:".piro_close,.piro_overlay",slideShow:null,slideSpeed:null},opt);function start_pirobox(){var corners="<tr>"+'<td colspan="3" class="pirobox_up"></td>'+"</tr>"+"<tr>"+'<td class="t_l"></td>'+'<td class="t_c"></td>'+'<td class="t_r"></td>'+"</tr>"+"<tr>"+'<td class="c_l"></td>'+'<td class="c_c"><span><span></span></span><div></div></td>'+'<td class="c_r"></td>'+"</tr>"+"<tr>"+'<td class="b_l"></td>'+'<td class="b_c"></td>'+'<td class="b_r"></td>'+"</tr>"+"<tr>"+'<td colspan="3" class="pirobox_down"></td>'+"</tr>";var window_height=$(document).height();var bg_overlay=$(jQuery('<div class="piro_overlay"></div>').hide().css({"opacity":+opt.bg_alpha,"height":window_height+"px"}));var main_cont=$(jQuery('<table class="pirobox_content" cellpadding="0" cellspacing="0"></table>'));var caption=$(jQuery('<div class="caption"></div>'));var piro_nav=$(jQuery('<div class="piro_nav"></div>'));var piro_close=$(jQuery('<a href="#close" class="piro_close" title="close"></a>'));var piro_play=$(jQuery('<a href="#play" class="play" title="play slideshow"></a>'));var piro_stop=$(jQuery('<a href="#stop" class="stop" title="stop slideshow"></a>'));var piro_prev=$(jQuery('<a href="#prev" class="piro_prev" title="previous image"></a>'));var piro_next=$(jQuery('<a href="#next" class="piro_next" title="next image"></a>'));$("body").append(bg_overlay).append(main_cont);main_cont.append(corners);$(".pirobox_up").append(piro_close);$(".pirobox_down").append(piro_nav);$(".pirobox_down").append(piro_play);piro_play.hide();$(".pirobox_down").append(piro_prev).append(piro_next);piro_nav.append(caption);var my_nav_w=piro_prev.width();main_cont.hide();var my_gall_classes=$("a[class^='pirobox']");var map=new Object();for(var i=0;i<my_gall_classes.length;i++){var it=$(my_gall_classes[i]);map["a."+it.attr("class")]=0;}var gall_settings=new Array();for(var key in map){gall_settings.push(key);}for(var i=0;i<gall_settings.length;i++){$(gall_settings[i]).each(function(rel){this.rel=rel+1+"&nbsp;of&nbsp;"+$(gall_settings[i]).length;});var add_first=$(gall_settings[i]+":first").addClass("first");var add_last=$(gall_settings[i]+":last").addClass("last");}$(my_gall_classes).each(function(rev){this.rev=rev+0;});var imgCache=$(my_gall_classes).each(function(){this.href;});var hidden=$("body").append('<div id="imgCache" style="display:none"></div').children("#imgCache");$.each(imgCache,function(i,val){$("<div/>").css({"background":"url("+val+")"}).appendTo(hidden);});var piro_gallery=$(my_gall_classes);$.fn.fixPNG=function(){return this.each(function(){var image=$(this).css("backgroundImage");if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({"backgroundImage":"none","filter":"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+($(this).css("backgroundRepeat")=="no-repeat"?"crop":"scale")+", src='"+image+"')"}).each(function(){var position=$(this).css("position");if(position!="absolute"&&position!="relative"){$(this).css("position","relative");}});}});};$.browser.msie6=($.browser.msie&&/MSIE 6\.0/i.test(window.navigator.userAgent));if($.browser.msie6&&!/MSIE 8\.0/i.test(window.navigator.userAgent)){$(".t_l,.t_c,.t_r,.c_l,.c_r,.b_l,.b_c,.b_r,a.piro_next, a.piro_prev,a.piro_prev_out,a.piro_next_out,.c_c,.piro_close,a.play,a.stop").fixPNG();var ie_w_h=$(document).height();bg_overlay.css("height",ie_w_h+"px");}if($.browser.msie){opt.close_speed=0;}$(window).resize(function(){var new_w_bg=$(document).height();bg_overlay.css({"visibility":"visible","height":+new_w_bg+"px"});});piro_prev.add(piro_next).bind("click",function(c){c.preventDefault();var image_count=parseInt($(piro_gallery).filter(".item").attr("rev"));var start=$(this).is(".piro_prev_out,.piro_prev")?$(piro_gallery).eq(image_count-1):$(piro_gallery).eq(image_count+1);if(!start.size()){start=$(this).is(".piro_prev_out,.piro_prev")?$(piro_gallery).eq($(piro_gallery).size()-1):$(piro_gallery).eq(0);}start.click();piro_close.add(caption).add(piro_next).add(piro_prev).css("visibility","hidden");});$(piro_gallery).each(function(array){var item=$(this);item.unbind();item.bind("click",function(c){c.preventDefault();piro_open(item.attr("href"));var this_url=item.attr("href");var descr=item.attr("title");var number=item.attr("rel");if(descr==""){caption.html("<p>"+this_url+'<em class="number">'+number+"</em><a href="+this_url+' class="link_to" target="_blank" title="Open Image in a new window"></a></p>');}else{caption.html("<p>"+descr+'<em class="number">'+number+"</em><a href="+this_url+' class="link_to" target="_blank" title="Open Image in a new window"></a></p>');}if(item.is(".last")){$(".number").css("text-decoration","underline");}else{$(".number").css("text-decoration","none");}if(item.is(".first")){piro_prev.hide();piro_next.show();}else{piro_next.add(piro_prev).show();}if(item.is(".last")){piro_prev.show();piro_next.hide();piro_play.css("width","0");}else{piro_play.css("width","40px");}if(item.is(".last")&&item.is(".first")){piro_prev.add(piro_next).hide();$(".number").hide();piro_play.remove();}$(piro_gallery).filter(".item").removeClass("item");item.addClass("item");$(".c_c").removeClass("unique");});});var piro_open=function(my_url){piro_play.add(piro_stop).hide();piro_close.add(caption).add(piro_next).add(piro_prev).css("visibility","hidden");if(main_cont.is(":visible")){$(".c_c div").children().fadeOut(300,function(){$(".c_c div").children().remove();load_img(my_url);});}else{$(".c_c div").children().remove();main_cont.show();bg_overlay.fadeIn(300,function(){load_img(my_url);});}};var load_img=function(my_url){if(main_cont.is(".loading")){return;}main_cont.addClass("loading");var img=new Image();img.onerror=function(){var main_cont_h=$(main_cont).height();main_cont.css({marginTop:parseInt($(document).scrollTop())-(main_cont_h/1.9)});$(".c_c div").append('<p class="err_mess">There seems to be an Error:&nbsp;<a href="#close" class="close_pirobox">Close Pirobox</a></p>');$(".close_pirobox").bind("click",function(c){c.preventDefault();piro_close.add(bg_overlay).add(main_cont).add(caption).add(piro_next).add(piro_prev).hide(0,function(){img.src="";});main_cont.removeClass("loading");});};img.onload=function(){var imgH=img.height;var imgW=img.width;var main_cont_h=$(main_cont).height();var w_H=$(window).height();var w_W=$(window).width();$(img).height(imgH).width(imgW).hide();$(".c_c div").animate({height:imgH+"px",width:imgW+"px"},opt.my_speed);var fix=imgH/w_H*2.3;if(w_H<imgH){h_fix=fix;}else{h_fix=2;}main_cont.animate({height:(imgH+40)+"px",width:(imgW+40)+"px",marginLeft:"-"+((imgW)/2+20)+"px",marginTop:parseInt($(document).scrollTop())-(imgH/h_fix)},opt.my_speed,function(){$(".piro_nav,.caption").css({width:(imgW)+"px","margin-bottom":"10px"});$(".piro_nav").css("margin-left","-"+(imgW)/2+"px");var caption_height=caption.height();$(".c_c div").append(img);piro_close.css("display","block");piro_next.add(piro_prev).add(piro_close).css("visibility","visible");caption.css({"visibility":"visible","display":"block","opacity":"0.8","overflow":"hidden"});main_cont.hover(function(){caption.stop().fadeTo(200,0.8);},function(){caption.stop().fadeTo(200,0);});$(img).fadeIn(300);main_cont.removeClass("loading");if(opt.slideShow===true){piro_play.add(piro_stop).show();}else{piro_play.add(piro_stop).hide();}});};img.src=my_url;$("html").bind("keyup",function(c){if(c.keyCode==27){c.preventDefault();if($(img).is(":visible")||$(".c_c>div>p>a").is(".close_pirobox")){$(piro_gallery).removeClass("slideshow").removeClass("item");piro_close.add(bg_overlay).add(main_cont).add(caption).add(piro_next).add(piro_prev).hide(0,function(){img.src="";});main_cont.removeClass("loading");clearTimeout(timer);$(piro_gallery).children().removeAttr("class");$(".stop").remove();$(".c_c").append(piro_play);$(".sc_menu").css("display","none");$("ul.sc_menu li a").removeClass("img_active").css("opacity","0.4");piro_next.add(piro_prev).show().css({"top":"50%"});$(piro_gallery).children().fadeTo(100,1);}}});$("html").bind("keyup",function(e){if($(".item").is(".first")){}else{if(e.keyCode==37){e.preventDefault();if($(img).is(":visible")){clearTimeout(timer);$(piro_gallery).children().removeAttr("class");$(".stop").remove();$(".c_c").append(piro_play);piro_prev.click();}}}});$("html").bind("keyup",function(z){if($(".item").is(".last")){}else{if(z.keyCode==39){z.preventDefault();if($(img).is(":visible")){clearTimeout(timer);$(piro_gallery).children().removeAttr("class");$(".stop").remove();$(".c_c").append(piro_play);piro_next.click();}}}});var win_h=$(window).height();piro_stop.bind("click",function(x){x.preventDefault();clearTimeout(timer);$(piro_gallery).removeClass("slideshow");$(".stop").remove();$(".pirobox_down").append(piro_play);piro_next.add(piro_prev).css("width",my_nav_w+"px");});piro_play.bind("click",function(w){w.preventDefault();clearTimeout(timer);if($(img).is(":visible")){$(piro_gallery).addClass("slideshow");$(".play").remove();$(".pirobox_down").append(piro_stop);}piro_next.add(piro_prev).css({"width":"0px"});return slideshow();});$(opt.close_all).bind("click",function(c){$(piro_gallery).removeClass("slideshow");clearTimeout(timer);if($(img).is(":visible")){c.preventDefault();piro_close.add(bg_overlay).add(main_cont).add(caption).add(piro_next).add(piro_prev).hide(0,function(){img.src="";});main_cont.removeClass("loading");$(piro_gallery).removeClass("slideshow");piro_next.add(piro_prev).css("width",my_nav_w+"px").hide();$(".stop").remove();$(".pirobox_down").append(piro_play);piro_play.hide();}});if(opt.slideShow===true){function slideshow(){if($(piro_gallery).filter(".item").is(".last")){clearTimeout(timer);$(piro_gallery).removeClass("slideshow");$(".stop").remove();$(".pirobox_down").append(piro_play);piro_next.add(piro_prev).css("width",my_nav_w+"px");}else{if($(piro_gallery).is(".slideshow")&&$(img).is(":visible")){clearTimeout(timer);piro_next.click();}}}var timer=setInterval(slideshow,opt.slideSpeed*1000);}};}start_pirobox();};})(jQuery);

//JQUERY CYCLE MIN
(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery)



jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
