// JavaScript Document


jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){

   
    var cookie = $.cookie('cookie01');
    
	var cookie01 = 0;
	
	if(cookie != null){
	    cookie01 = cookie;
	}
	
	
    cookie01 == cookie01++;
    if(cookie01 > $('#slideshow li').length-1){
        cookie01 = 1;
    }

	
	$.cookie('cookie01',eval("\"" + cookie01 + "\"") );
	
	$('#slideshow').serialScroll({
		items:'li',
		prev:'#screen2 a.prev',
		next:'#screen2 a.next',
		offset:-440, //when scrolling to photo, stop 230 before reaching it (from the left)
		start:cookie01, //as we are centering it, start at the 2nd
		duration:1200,
		force:true,
		stop:true,
		lock:false,
		cycle:false, //don't pull back once you reach the end
		controlsFade: true, 
		easing:'easeOutQuart', //use this easing equation for a funny effect
		jump:false, //click on the images to scroll to them		
		onBefore:function( e, elem, $pane, $items, pos ){
          $.cookie('cookie01',eval("\"" + pos + "\"") )
        }
	});
	
});

function open_win(url_add)
   {
   window.open(url_add,'','width=1270,height=887,menubar=1,resizable=1,status=1,location=1,toolbar=1,scrollbars=1,target=_parent');
   }
   
 function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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;
    }
};



