var _imgsize = 0, _maxWidth = 770, _selimg = 'img_1', _actpos = 0, max_sizeH = 1080, _nice_zoom = false;
function focusInput() {
	if($('.first_focus').length) $('.first_focus')[0].focus();
}
function listBuyAllPage() {
	tb_init();
	checkBuyAllCompleted();
}

function checkBuyAllCompleted() {
	if(document.location.href.indexOf('buy_all_completed') !== -1) {
		tb_show('buy_all', _locale + 'buy_all?completed=1&width=680&height=380', '', '');
	} else if(document.location.href.indexOf('newsletter_completed') !== -1) {
		tb_show('newsletter', _locale + 'newsletter?completed=1&width=580&height=210', '', '');
	}
}
function ajaxReload() {
	if(document.ajaxform) document.ajaxform.redir.value = __uri;
}
function checkoutRegisterPage() {
	$('.select_basket_country').bind('change', function() { this.form.country_top.value = '0'; this.form.only_update.value = '1'; this.form.submit(); });
}
function checkoutViewPage() {
	$('.autoselect').bind('click', function() { this.select(); });
	$('.select_country').bind('change', function() { this.form.only_update.value = '1'; this.form.submit(); });
	$('.select_color').bind('change', function() { this.form.submit(); });
	$('.update_button').bind('click', function() { this.form.submit(); });
	$('.account_button').bind('click', function() { goLoc(_locale + 'selection?register=1'); return false; });
	$('.remove_button').bind('click', function() { if(!confirm('Remove item?')) return false; var id = $(this).attr('id').split('_')[1]; goLoc(_locale + 'selection?del=' + id); });
}
function enableImageSlide() {
 	$('.other_img').click(function() {
 		var id = this.id.split('_')[1]; selImg(id);
 		this.className = 'sel other_img';
 		if(_selimg != this.id) $('#' + _selimg).removeClass('sel');
 		_selimg = this.id;
 		return false;
 	});
};
function productViewPage() {
	enableImageSlide();
 	$('#continue_shopping').click(function() {
 		$('.hidden_info').show();
 		$('#added_product').hide();
 		return false;
 	});
 	$('#checkout_btn').click(function() {
 		goLoc(_locale + 'selection');
 		return false;
 	});
 	tb_init();
	$(".color_picker a").click(function(){
		var hash = this.href;
		hash = hash.replace(/^.*#/, '');
		$.historyLoad(hash);
		return false;
	});
	activateSizes();
	$.historyInit(pageload);
	$('.sizetable_link').click(function() {
		$(this).parent().hide();
		$('.sizetable_div').show();
		return false;
	});
	$('.sizetable_hide_link').click(function() {
		$('.sizetable_div').hide();
		$('.sizetable_link').parent().show();
		return false;
	});
};
function selImg(key) {
	var val = (-406*(key-1));
	actpos = val;
	$('#ProductImageBigListing').stop().animate({top:val});
	var img_src = $('#img_' + key).attr('href');
	img_src = img_src.substr(0, img_src.length-8) + '-big.jpg';
	$('#enlarge_link').attr('href', img_src);
	$('.biglisting').attr('href', img_src);
	return false;
};
function itemListingPage() {
	var val = $.cookie('slider_placement'); if(val === '' || val == undefined) val = 17;
	$('#slider').slider({
	        'startValue': val,
	        'handle': '#slider-handle',
	        'stop': function(e, ui) {
	        	var proc = ui.value;
	        	if(proc == 17) proc = null;
	     		$.cookie('slider_placement', proc, { expires: 1, path: '/' });
	        },
	        'slide': function(e,ui) {
        			var proc = ui.value;
        			var procval = parseFloat(proc/100.00);
	        		var imgWidth = 100 + Math.round(270*procval);
	                $('.item').css('height', 226 + Math.round(386*procval)).css('width', 100 + Math.round(270*procval));
	                $('.item img').css('height', 143 + Math.round(386*procval)).css('width', 100 + Math.round(270*procval));
	                var imgOnOne = Math.floor(_maxWidth / (imgWidth+8));
	                var spaceOnImg = _maxWidth - (imgOnOne * imgWidth);
	                $('.item').css('margin-right', (spaceOnImg/imgOnOne/2)).css('margin-left', (spaceOnImg/imgOnOne/2));
					if(proc > 17 && !_imgsize) {
						var elem = $('.item img');
						for(var i = 0; i < elem.length; i++) {
							if(elem[i].src.indexOf('-') !== -1) {
								var filename = elem[i].src.split('-');
								filename.pop();
								filename = filename.join('-');
							} else {
								var filename = [elem[i].src];
								filename = filename.join('-');
								filename = filename.substr(0, filename.length-4);
							}
							elem[i].src = filename + '-full.jpg';
						}
						_imgsize = 1;
					} else if(proc <= 17 && _imgsize) {
						var elem = $('.item img');
						for(var i = 0; i < elem.length; i++) {
							if(elem[i].src.indexOf('-') !== -1) {
								var filename = elem[i].src.split('-');
								filename.pop();
								filename = filename.join('-');
							} else {
								var filename = [elem[i].src];
								filename = filename.join('-');
								filename = filename.substr(0, filename.length-4);
							}
							elem[i].src = filename + '-thumb.jpg';
						}
						_imgsize = 0;
					}
	        }
	});
	$('.item').click(function() {
		document.location.href = $(this).children('.link').attr('href');	
		return false;
	});
	//cookie set of slider
	sliderGetFromCookie();
	//paging-info
	var elem = $('.paging_next');
	if(elem.length) {
		elem.click(function(){
			goLoc(__next_link);
			return false;
		});	
	}
	var elem = $('.paging_previous');
	if(elem.length) {
		elem.click(function(){
			goLoc(__prev_link);
			return false;
		});	
	}
};
function sliderGetFromCookie() {
	var val = $.cookie('slider_placement');
	if(val == undefined) val = 17;
	$('#slider').slider('moveTo', val);
};
function goLoc(url) {
	document.location.href = url;	
};
function tb_init(){
	$('.fixedbox').unbind().click(function(e){
		var t = this.title || this.name || null;
		var a = this.href || this.alt;
		var g = this.rel || 'fixedbox';
		tb_show(t,a,g, e);
		this.blur();
		return false;
	});
	$('.buy_all').click(function(e){
		  tb_show('buy_all', _locale + 'buy_all?width=680&height=380', '', '');
		  this.blur();
		  return false;
	});
	$('.newsletter').click(function(e){
		  tb_show('newsletter', _locale + 'newsletter?width=580&height=210', '', '');
		  this.blur();
		  return false;
	});
	imgLoader = new Image();
	imgLoader.src = __static + 'loading_anim.gif';
	$(window).bind('resize', function(e) {
		tb_setcontent();
		if(_nice_zoom) tb_testcontent(e, 1);
	});
};
function tb_show(caption, url, imageGroup, e) {
  var ajaxpopup = false;
	if(caption == 'buy_all' || caption == 'newsletter') ajaxpopup = true;
  try {
    if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
      $("body","html").css({height: "100%", width: "100%"});
      $("html").css({overflow:"hidden"});
      if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
        $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_" + (ajaxpopup?'C':'') + "window'></div>");
        $("#TB_overlay").click(tb_remove);
        if(ajaxpopup) {
        	$("#TB_Cwindow").css("display", 'none')	
        }
      }
    }else{//all others
      if(document.getElementById("TB_overlay") === null){
      	//$("body").css("overflow","hidden");
      	$("html").css({overflow: "hidden"});
        $("body").append("<div id='TB_overlay'></div><div id='TB_" + (ajaxpopup?'C':'') + "window'></div>");
        $("#TB_overlay").click(tb_remove);
        if(ajaxpopup) {
        	$("#TB_Cwindow").css("display", 'none')	
        }
      }
    }
    if(tb_detectMacXFF()){
      $("#TB_overlay").addClass(ajaxpopup?'TB_overlaySoftMacFFBGHack':"TB_overlayMacFFBGHack");//use png overlay so hide flash
    }else{
      $("#TB_overlay").addClass(ajaxpopup?'TB_overlaySoftBG':"TB_overlayBG");//use background and opacity
    }
    if(caption===null){caption="";}
    $("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
    $('#TB_load').show();//show loader
    var baseURL;
     if(url.indexOf("?")!==-1){ //ff there is a query string involved
      baseURL = url.substr(0, url.indexOf("?"));
     }else{ 
         baseURL = url;
     }
     var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
     var urlType = baseURL.toLowerCase().match(urlString);
    if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
      TB_PrevCaption = "";
      TB_PrevURL = "";
      TB_PrevHTML = "<span class='off' id='TB_prev'>PREVIOUS</span>";
      TB_NextCaption = "";
      TB_NextURL = "";
      TB_NextHTML = "<span class='off' id='TB_next'>NEXT</span>";
      TB_imageCount = "";
      TB_FoundURL = false;
      if(imageGroup){
        TB_TempArray = $("a[@rel="+imageGroup+"]").get();
        for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextURL === "")); TB_Counter++) {
          var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
            if (!(TB_TempArray[TB_Counter].href == url)) {            
              if (TB_FoundURL) {
                TB_NextCaption = TB_TempArray[TB_Counter].title;
                TB_NextURL = TB_TempArray[TB_Counter].href;
                TB_NextHTML = "<a href='#' id='TB_next'>NEXT</a>";
              } else {
                TB_PrevCaption = TB_TempArray[TB_Counter].title;
                TB_PrevURL = TB_TempArray[TB_Counter].href;
                TB_PrevHTML = "<a href='#' id='TB_prev'>PREVIOUS</a>";
              }
            } else {
              TB_FoundURL = true;
              TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);                      
            }
        }
      }
      imgPreloader = new Image();
      imgPreloader.onload = function(){    
      imgPreloader.onload = null;
        
      // Resizing large images - orginal by Christian Montoya edited by me.
      var pagesize = tb_getPageSize();
      var x = pagesize[0];
      var y = pagesize[1] > max_sizeH && !_nice_zoom?max_sizeH:pagesize[1];
      var imageWidth = imgPreloader.width;
      var imageHeight = imgPreloader.height;
      var origWH = [imageWidth, imageHeight];
      if(_nice_zoom) {
        imageHeight = imageHeight * (x / imageWidth); 
        imageWidth = x; 
      } else {
        imageWidth = imageWidth * (y / imageHeight); 
        imageHeight = y; 
      }
      TB_WIDTH = Math.round(imageWidth + 0);
      TB_HEIGHT = Math.round(imageHeight + 0); //
      $('body').append("<a href='#' id='TB_close'>CLICK ANYWHERE ON THE IMAGE TO CLOSE</a>" + TB_PrevHTML + TB_NextHTML);
      $("#TB_window").append("<a href='#' id='TB_ImageOff'><img id='TB_Image' src='"+url+"' width='"+TB_WIDTH+"' height='"+TB_HEIGHT+"' alt='"+caption+"'/></a>");     
      $('#TB_load').hide();
      //$("#TB_closeWindowButton").click(tb_remove);
      $('#TB_Image').attr('rel', 'w_' + origWH[0] + '_' + origWH[1]);
      if (!(TB_PrevURL === "")) {
        function goPrev(e){
          if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
          $("#TB_window").remove();
          $("#TB_next,#TB_prev,#TB_close").unbind().remove();
          $("body").append("<div id='TB_window'></div>");
          tb_show(TB_PrevCaption, TB_PrevURL, imageGroup, e);
          return false;  
        }
        $("#TB_prev").click(goPrev);
      } else {
      	$("#TB_prev").click(tb_remove);	
      }
      if (!(TB_NextURL === "")) {    
        function goNext(e){
          $("#TB_window").remove();
          $("#TB_next,#TB_prev,#TB_close").unbind().remove();
          $("body").append("<div id='TB_window'></div>");
          tb_show(TB_NextCaption, TB_NextURL, imageGroup, e);        
          return false;  
        }
        $("#TB_next").click(goNext);
      } else {
      	$("#TB_next").click(tb_remove);	
      }
      if(_nice_zoom) {
      	$('#TB_window').bind('mousemove', tb_testcontent);
      	tb_testcontent(e);
      }
      $(document).bind('keydown', tb_keydown);
      tb_position();
      //$("#TB_load").remove();
      $("#TB_ImageOff").click(tb_remove);
      $("#TB_window").css({display:"block"}); //for safari using css instead of show
      };
      imgPreloader.src = url;
    } else {
		 //SHOW HTML
		 //tb_position();
		 var queryString = url.replace(/^[^\?]+\??/,'');
	     var params = tb_parseQuery( queryString );
	     TB_WIDTH = (params['width']*1) || 630; //defaults to 630 if no paramaters were added to URL
	     TB_HEIGHT = (params['height']*1) || 440; //defaults to 440 if no paramaters were added to URL
	     ajaxContentW = TB_WIDTH;
	     ajaxContentH = TB_HEIGHT;
	     if($("#TB_Cwindow").css("display") != "block"){
	    	 $("#TB_Cwindow").append("<div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
	     } else {//this means the window is already up, we are just loading new content via ajax
	       $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
	       $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
	       $("#TB_ajaxContent")[0].scrollTop = 0;
	     }
	     $("#TB_closeWindowButton").click(tb_remove);
	     if(url.indexOf('TB_inline') != -1){  
	       $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
	       $("#TB_Cwindow").unload(function () {
	         $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
	       });
	       tb_position();
	       $("#TB_load").remove();
	       $("#TB_Cwindow").css({display:"block"}); 
	     } else {
	       $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
	         tb_position();
	         $("#TB_load").remove();
	         //tb_init("#TB_ajaxContent a.thickbox");
	         $("#TB_closeWindowButton, .close_btn").click(tb_remove);
	         $("#TB_Cwindow").css({display:"block"});
	         focusInput();
	         ajaxReload();
	       });
	     }
    }
  } catch(e) {
    //nothing here
  }
};

function tb_keydown(e){   
  if (e == null) { // ie
    keycode = event.keyCode;
  } else { // mozilla
    keycode = e.which;
  }
  if(e.ctrlKey) {
  	_nice_zoom = !_nice_zoom;
  	$('#TB_window').unbind('mousemove', tb_testcontent);
  	$('#TB_window').bind('mousemove', tb_testcontent);
  	tb_setcontent();
  	tb_testcontent(e, 2);
  }
  if(keycode == 27){ // close
    tb_remove();
  } else if(keycode == 190){ // display previous image
    if(!(TB_NextHTML == "")){
      $(document).unbind('keydown', tb_keydown);
      goNext();
    }
  } else if(keycode == 188){ // display next image
    if(!(TB_PrevHTML == "")){
      $(document).unbind('keydown', tb_keydown);
      goPrev();
    }
  }  
};
function tb_testcontent(e, resize) {
	var offset = $(window).scrollTop();
	//alert(offset);
	var mouseY = e.pageY;
	mouseY -= offset;
	var sizes = tb_getPageSize();
	var hh = $('#TB_Image').attr('height');
	if(resize == 1 || resize == 2) {
		var val = -((hh - sizes[1])/2); 
		if(sizes[1] > hh) val = (sizes[1]-hh)/2;
		$('#TB_Image').css({marginTop: val + 'px'});
	} else {
		if(hh > sizes[1]) {
			var proc = mouseY / sizes[1];
			var maxVal = hh - sizes[1];
			$('#TB_Image').css({marginTop: -(proc*maxVal) + 'px'});//marginLeft: -(mouseX) + 'px', marginTop: -(mouseY) + 'px' });
		} else {
			var val = (sizes[1] - hh)/2
			$('#TB_Image').css({marginTop: val + 'px'});
		}
	}
};

function tb_setcontent() {
	if($('#TB_Image').length <= 0) return;
	var pos = tb_getPageSize();
	var info = $('#TB_Image').attr('rel').split('_');
	var ww = parseInt(info[1], 10);
	var hh = parseInt(info[2], 10);
	if(pos[1] > max_sizeH) pos[1] = max_sizeH;
	if(_nice_zoom) {
		var nw = pos[0];
		var nh = Math.floor((pos[0] / ww)*hh);
	} else {
		var nh = pos[1];
		var nw = Math.floor((pos[1] / hh)*ww);
	}
	TB_WIDTH = nw;
    TB_HEIGHT = nh;
	$('#TB_Image').height(nh).width(nw);
	tb_position();
};
//helper functions below
function tb_showIframe(){
  $("#TB_load").remove();
  $("#TB_window").css({display:"block"});
};
function tb_remove() {
   $("#TB_imageOff").unbind("click");
  $('#TB_window,#TB_close,#TB_Cwindow,#TB_overlay,#TB_HideSelect,#TB_next,#TB_prev').trigger("unload").unbind().remove();
  $("#TB_load").remove();
  if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
    $("body","html").css({overflow: "",height: "auto", width: "auto"});
  }
  $("html").css({overflow: "auto"});
  $("html").css({overflowY: "scroll"});
  setTimeout(fixscroll, 100);
  $(document).unbind('keydown', tb_keydown);
  return false;
};
function fixscroll() {
	$("html").css({overflowY: "auto"});
};
function tb_position() {
	$("#TB_window,#TB_Cwindow").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px', height: TB_HEIGHT + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
	    $("#TB_Cwindow").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	  }
};
function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
};
function tb_getPageSize(){
  var de = document.documentElement;
  var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
  var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
  arrayPageSize = [w,h];
  return arrayPageSize;
};
function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
};
function toggle_adding(setmode) {
	var elem = $('.add_prod');
	if(setmode) {
		elem.removeClass('dis');
		elem.removeAttr('disabled'); 
	} else {
		elem.addClass('dis');
		elem.attr('disabled', true);
	}
};
function selColor(id) {
	var obj = $('#col_' + id.split('_')[1]);
	obj.addClass('sel');
	if(obj.attr('id') != __sel_color) {
		$('#' + __sel_color).removeClass('sel');
	}
	__sel_color = obj.attr('id');
	if(__sel_color == __act_color) return true;
	id = 'col_' + id.split('_')[1];
	$('.sizes').html('Loading...');
	$('#sel_size').html('...');
	toggle_adding(false);
	$.ajax({
	   type: 'GET',
	   url: _locale + 'ajax/color_select/' + __sel_prod,
	   dataType: 'json',
	   cache: false,
	   data: '&color=' + __sel_color.split('_')[1] + '&size_text=' + __sel_size_text,
	   success: function(msg){
	     var sold_out = 0, exists = 0;
	     if(typeof(__selectwhole) != 'undefined') {
			toggle_adding(msg.got_table);
			var str = '';
			str = msg.html;
			refillImages(msg.sel_img);
			__act_color = msg.sel_color_img;
		     for(key in msg.sizes) {
		     	exists++;
		     	if(msg.sizes[key][1]) {
		  		
		     	} else {				
		     		sold_out++;		     	
		     	}
		     	if(msg.sizes[key][1] && msg.sizes[key][0] == sel_size_text) {

		     	}
		     }
		     if(sold_out == exists) {
		    	 str += '<div class="error_box">This color is sold out.</div>';
			     toggle_adding(false);
		     } else {
		    	 toggle_adding(true);
		     }
		     $('.sizes').html(str);
			return;
		}
	     var str = '';
	     var sel_size_text = msg.sel_size_text, sel_size = '';
	     var sel_name = '...';
	     var found = false;
	     __act_color = msg.sel_color_img;
	     for(key in msg.sizes) {
	     	exists++;
	     	if(msg.sizes[key][1]) {
	  			str += '<a href="' + __prod + '&color=' + msg.sel_color_img + '&size=' + key + '#" id="size_' + key + '"' + (msg.sizes[key][0] == sel_size_text?' class="sel"':'') + '>' + msg.sizes[key][0] + '</a>';
	     	} else {				
	     		sold_out++;		     	
	  			str += '<span class="dis" id="size_' + key + '"' + '>' + msg.sizes[key][0] + '</span>';
	     	}
	     	if(msg.sizes[key][1] && msg.sizes[key][0] == sel_size_text) {
	     		sel_size = key;
	     		found = true;
	     		sel_name = msg.sizes[key][0];	
	     		__sel_size = key;
	     		$('#formSize').attr('value', key);
	     	}
	     }
	     if(!found) {
	    	 $('#formSize').attr('value', -1);
	     }
	     if(sold_out == exists) {
	    	 $('.size_info').css({display: 'none'});
	     	str += '<div class="error_box">This color is sold out.</div>';
	     } else {
	    	 $('.size_info').css({display: 'block'});
	     }
	     toggle_adding(sel_name != '...');
	     $('#sel_size').html(sel_name);
	     $('.sizes').html(str);
	     delete str;
	     activateSizes('size_' + sel_size);
	     refillImages(msg.sel_img);
	   }
	});
	$('#formColor').attr('value', __sel_color.split('_')[1]);
	var selcolortext = obj.children().attr('alt')?obj.children().attr('alt'):obj.text();
	$('#sel_color').attr('innerHTML', selcolortext);
};
function refillImages(arr) {
	var elem = $('#ProductImageListing'), bigelem = $('#ProductImageBigListing'), first_img = '';
	bigelem.html('');
	elem.html('');
	for(var i = 0; i < arr.length; i++) {
		if(!i) first_img = arr[i];
		bigelem.append('<img src="' + arr[i] + '.jpg" alt="" />');
		if(i < 5) elem.append('<a href="' + arr[i] + '-big.jpg" rel="fixedbox" class="' + (!i?'sel':'') + ' other_img" id="img_' + (i+1) + '"><img src="' + arr[i] + '-mini.jpg" alt="" /></a>');
	}
	$('#ProductImageBigListing').css({top:0});
	$('#enlarge_link').attr('href', first_img + '-big.jpg');
	$('.biglisting').attr('href', first_img + '-big.jpg');
	enableImageSlide();
};
function selSize(id) {
	$('#formSize').attr('value', id);
	toggle_adding(true);
};
function activateSizes(reg_size) {
	$('.size_picker a').click(function() {
		this.className = 'sel';
		if(this.id != __sel_size) $('#' + __sel_size).removeClass('sel');
		__sel_size = this.id;
		__sel_size_text = this.innerHTML;
		selSize(this.id.split('_')[1]);
		$('#sel_size').attr('innerHTML', this.innerHTML);
		return false;
	});	
	if(reg_size) __sel_size = reg_size;
};
function pageload(hash) {
	if(hash && __active_hash != hash) {
		if(hash.indexOf('c_') !== -1) { selColor(hash); }
		__active_hash = hash;
		$('#formAdd').attr('action', '#' + __active_hash);
	}
};

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
            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
        }
        // NOTE 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;
    }
};

;(function($){var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).triggerHandler("remove");return _remove.apply(this,arguments);};function isVisible(element){function checkStyles(element){var style=element.style;return(style.display!='none'&&style.visibility!='hidden');}
var visible=checkStyles(element);(visible&&$.each($.dir(element,'parentNode'),function(){return(visible=checkStyles(this));}));return visible;}
$.extend($.expr[':'],{data:function(a,i,m){return $.data(a,m[3]);},tabbable:function(a,i,m){var nodeName=a.nodeName.toLowerCase();return(a.tabIndex>=0&&(('a'==nodeName&&a.href)||(/input|select|textarea|button/.test(nodeName)&&'hidden'!=a.type&&!a.disabled))&&isVisible(a));}});$.keyCode={BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38};function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];return(typeof methods=='string'?methods.split(/,?\s+/):methods);}
var methods=getMethods('getter');if(args.length==1&&typeof args[0]=='string'){methods=methods.concat(getMethods('getterSetter'));}
return($.inArray(method,methods)!=-1);}
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&options.substring(0,1)=='_'){return this;}
if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
return this.each(function(){var instance=$.data(this,name);(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options)));(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args));});};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetEventPrefix=$[namespace][name].eventPrefix||name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self._setData(key,value);}).bind('getData.'+name,function(e,key){return self._getData(key);}).bind('remove',function(){return self.destroy();});this._init();};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);$[namespace][name].getterSetter='option';};$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName);},option:function(key,value){var options=key,self=this;if(typeof key=="string"){if(value===undefined){return this._getData(key);}
options={};options[key]=value;}
$.each(options,function(key,value){self._setData(key,value);});},_getData:function(key){return this.options[key];},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled');}},enable:function(){this._setData('disabled',false);},disable:function(){this._setData('disabled',true);},_trigger:function(type,e,data){var eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);e=e||$.event.fix({type:eventName,target:this.element[0]});return this.element.triggerHandler(eventName,[e,data],this.options[type]);}};$.widget.defaults={disabled:false};$.ui={plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}
return $.ui.cssCache[name];},disableSelection:function(el){return $(el).attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false;});},enableSelection:function(el){return $(el).attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui');},hasScroll:function(e,a){if($(e).css('overflow')=='hidden'){return false;}
var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(e[scroll]>0){return true;}
e[scroll]=1;has=(e[scroll]>0);e[scroll]=0;return has;}};$.ui.mouse={_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(e){return self._mouseDown(e);});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},_mouseDown:function(e){(this._mouseStarted&&this._mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(e)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)){this._mouseStarted=(this._mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true;}}
this._mouseMoveDelegate=function(e){return self._mouseMove(e);};this._mouseUpDelegate=function(e){return self._mouseUp(e);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false;},_mouseMove:function(e){if($.browser.msie&&!e.button){return this._mouseUp(e);}
if(this._mouseStarted){this._mouseDrag(e);return false;}
if(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,e)!==false);(this._mouseStarted?this._mouseDrag(e):this._mouseUp(e));}
return!this._mouseStarted;},_mouseUp:function(e){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._mouseStop(e);}
return false;},_mouseDistanceMet:function(e){return(Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance);},_mouseDelayMet:function(e){return this.mouseDelayMet;},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.fn.unwrap=$.fn.unwrap||function(expr){return this.each(function(){$(this).parents(expr).eq(0).after(this).remove();});};$.widget("ui.slider",{plugins:{},ui:function(e){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?Math.round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:Math.round(this.value(null,"x")),y:Math.round(this.value(null,"y"))},range:this._getRange()};},_propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);this.element.triggerHandler(n=="slide"?n:"slide"+n,[e,this.ui()],this.options[n]);},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){$(this).data("mouse")._mouseDestroy();});}
this.generated&&this.generated.remove();},_setData:function(key,value){$.widget.prototype._setData.apply(this,arguments);if(/min|max|steps/.test(key)){this._initBoundaries();}
if(key=="range"){value?this.handle.length==2&&this._createRange():this._removeRange();}},_init:function(){var self=this;this.element.addClass("ui-slider");this._initBoundaries();this.handle=$(this.options.handle,this.element);if(!this.handle.length){self.handle=self.generated=$(self.options.handles||[0]).map(function(){var handle=$("<div/>").addClass("ui-slider-handle").appendTo(self.element);if(this.id)
handle.attr("id",this.id);return handle[0];});}
var handleclass=function(el){this.element=$(el);this.element.data("mouse",this);this.options=self.options;this.element.bind("mousedown",function(){if(self.currentHandle)this.blur(self.currentHandle);self._focus(this,true);});this._mouseInit();};$.extend(handleclass.prototype,$.ui.mouse,{_mouseStart:function(e){return self._start.call(self,e,this.element[0]);},_mouseStop:function(e){return self._stop.call(self,e,this.element[0]);},_mouseDrag:function(e){return self._drag.call(self,e,this.element[0]);},_mouseCapture:function(){return true;},trigger:function(e){this._mouseDown(e);}});$(this.handle).each(function(){new handleclass(this);}).wrap('<a href="#" style="outline:none;border:none;"></a>').parent().bind('click',function(){return false;}).bind('focus',function(e){self._focus(this.firstChild);}).bind('blur',function(e){self._blur(this.firstChild);}).bind('keydown',function(e){if(!self.options.noKeyboard)return self._keydown(e.keyCode,this.firstChild);});this.element.bind('mousedown.slider',function(e){self._click.apply(self,[e]);self.currentHandle.data("mouse").trigger(e);self.firstValue=self.firstValue+1;});$.each(this.options.handles||[],function(index,handle){self.moveTo(handle.start,index,true);});if(!isNaN(this.options.startValue))
this.moveTo(this.options.startValue,0,true);this.previousHandle=$(this.handle[0]);if(this.handle.length==2&&this.options.range)this._createRange();},_initBoundaries:function(){var element=this.element[0],o=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};$.extend(o,{axis:o.axis||(element.offsetWidth<element.offsetHeight?'vertical':'horizontal'),max:!isNaN(parseInt(o.max,10))?{x:parseInt(o.max,10),y:parseInt(o.max,10)}:({x:o.max&&o.max.x||100,y:o.max&&o.max.y||100}),min:!isNaN(parseInt(o.min,10))?{x:parseInt(o.min,10),y:parseInt(o.min,10)}:({x:o.min&&o.min.x||0,y:o.min&&o.min.y||0})});o.realMax={x:o.max.x-o.min.x,y:o.max.y-o.min.y};o.stepping={x:o.stepping&&o.stepping.x||parseInt(o.stepping,10)||(o.steps?o.realMax.x/(o.steps.x||parseInt(o.steps,10)||o.realMax.x):0),y:o.stepping&&o.stepping.y||parseInt(o.stepping,10)||(o.steps?o.realMax.y/(o.steps.y||parseInt(o.steps,10)||o.realMax.y):0)};},_keydown:function(keyCode,handle){var k=keyCode;if(/(33|34|35|36|37|38|39|40)/.test(k)){var o=this.options,xpos,ypos;if(/(35|36)/.test(k)){xpos=(k==35)?o.max.x:o.min.x;ypos=(k==35)?o.max.y:o.min.y;}else{var oper=/(34|37|40)/.test(k)?"-=":"+=";var step=/(37|38|39|40)/.test(k)?"_oneStep":"_pageStep";xpos=oper+this[step]("x");ypos=oper+this[step]("y");}
this.moveTo({x:xpos,y:ypos},handle);return false;}
return true;},_focus:function(handle,hard){this.currentHandle=$(handle).addClass('ui-slider-handle-active');if(hard)
this.currentHandle.parent()[0].focus();},_blur:function(handle){$(handle).removeClass('ui-slider-handle-active');if(this.currentHandle&&this.currentHandle[0]==handle){this.previousHandle=this.currentHandle;this.currentHandle=null;};},_click:function(e){var pointer=[e.pageX,e.pageY];var clickedHandle=false;this.handle.each(function(){if(this==e.target)
clickedHandle=true;});if(clickedHandle||this.options.disabled||!(this.currentHandle||this.previousHandle))
return;if(!this.currentHandle&&this.previousHandle)
this._focus(this.previousHandle,true);this.offset=this.element.offset();this.moveTo({y:this._convertValue(e.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this._convertValue(e.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance);},_createRange:function(){if(this.rangeElement)return;this.rangeElement=$('<div></div>').addClass('ui-slider-range').css({position:'absolute'}).appendTo(this.element);this._updateRange();},_removeRange:function(){this.rangeElement.remove();this.rangeElement=null;},_updateRange:function(){var prop=this.options.axis=="vertical"?"top":"left";var size=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(prop,(parseInt($(this.handle[0]).css(prop),10)||0)+this._handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(size,(parseInt($(this.handle[1]).css(prop),10)||0)-(parseInt($(this.handle[0]).css(prop),10)||0));},_getRange:function(){return this.rangeElement?this._convertValue(parseInt(this.rangeElement.css(this.options.axis=="vertical"?"height":"width"),10),this.options.axis=="vertical"?"y":"x"):null;},_handleIndex:function(){return this.handle.index(this.currentHandle[0]);},value:function(handle,axis){if(this.handle.length==1)this.currentHandle=this.handle;if(!axis)axis=this.options.axis=="vertical"?"y":"x";var curHandle=$(handle!=undefined&&handle!==null?this.handle[handle]||handle:this.currentHandle);if(curHandle.data("mouse").sliderValue){return parseInt(curHandle.data("mouse").sliderValue[axis],10);}else{return parseInt(((parseInt(curHandle.css(axis=="x"?"left":"top"),10)/(this.actualSize[axis=="x"?"width":"height"]-this._handleSize(handle,axis)))*this.options.realMax[axis])+this.options.min[axis],10);}},_convertValue:function(value,axis){return this.options.min[axis]+(value/(this.actualSize[axis=="x"?"width":"height"]-this._handleSize(null,axis)))*this.options.realMax[axis];},_translateValue:function(value,axis){return((value-this.options.min[axis])/this.options.realMax[axis])*(this.actualSize[axis=="x"?"width":"height"]-this._handleSize(null,axis));},_translateRange:function(value,axis){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&value>=this._translateValue(this.value(1),axis))
value=this._translateValue(this.value(1,axis)-this._oneStep(axis),axis);if(this.currentHandle[0]==this.handle[1]&&value<=this._translateValue(this.value(0),axis))
value=this._translateValue(this.value(0,axis)+this._oneStep(axis),axis);}
if(this.options.handles){var handle=this.options.handles[this._handleIndex()];if(value<this._translateValue(handle.min,axis)){value=this._translateValue(handle.min,axis);}else if(value>this._translateValue(handle.max,axis)){value=this._translateValue(handle.max,axis);}}
return value;},_translateLimits:function(value,axis){if(value>=this.actualSize[axis=="x"?"width":"height"]-this._handleSize(null,axis))
value=this.actualSize[axis=="x"?"width":"height"]-this._handleSize(null,axis);if(value<=0)
value=0;return value;},_handleSize:function(handle,axis){return $(handle!=undefined&&handle!==null?this.handle[handle]:this.currentHandle)[0]["offset"+(axis=="x"?"Width":"Height")];},_oneStep:function(axis){return this.options.stepping[axis]||1;},_pageStep:function(axis){return 10;},_start:function(e,handle){var o=this.options;if(o.disabled)return false;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle)
this._focus(this.previousHandle,true);this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:e.pageY-this.handleOffset.top,left:e.pageX-this.handleOffset.left};this.firstValue=this.value();this._propagate('start',e);this._drag(e,handle);return true;},_stop:function(e){this._propagate('stop',e);if(this.firstValue!=this.value())
this._propagate('change',e);this._focus(this.currentHandle,true);return false;},_drag:function(e,handle){var o=this.options;var position={top:e.pageY-this.offset.top-this.clickOffset.top,left:e.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle)this._focus(this.previousHandle,true);position.left=this._translateLimits(position.left,"x");position.top=this._translateLimits(position.top,"y");if(o.stepping.x){var value=this._convertValue(position.left,"x");value=Math.round(value/o.stepping.x)*o.stepping.x;position.left=this._translateValue(value,"x");}
if(o.stepping.y){var value=this._convertValue(position.top,"y");value=Math.round(value/o.stepping.y)*o.stepping.y;position.top=this._translateValue(value,"y");}
position.left=this._translateRange(position.left,"x");position.top=this._translateRange(position.top,"y");if(o.axis!="vertical")this.currentHandle.css({left:position.left});if(o.axis!="horizontal")this.currentHandle.css({top:position.top});this.currentHandle.data("mouse").sliderValue={x:Math.round(this._convertValue(position.left,"x"))||0,y:Math.round(this._convertValue(position.top,"y"))||0};if(this.rangeElement)
this._updateRange();this._propagate('slide',e);return false;},moveTo:function(value,handle,noPropagation){var o=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(handle==undefined&&!this.currentHandle&&this.handle.length!=1)
return false;if(handle==undefined&&!this.currentHandle)
handle=0;if(handle!=undefined)
this.currentHandle=this.previousHandle=$(this.handle[handle]||handle);if(value.x!==undefined&&value.y!==undefined){var x=value.x,y=value.y;}else{var x=value,y=value;}
if(x!==undefined&&x.constructor!=Number){var me=/^\-\=/.test(x),pe=/^\+\=/.test(x);if(me||pe){x=this.value(null,"x")+parseInt(x.replace(me?'=':'+=',''),10);}else{x=isNaN(parseInt(x,10))?undefined:parseInt(x,10);}}
if(y!==undefined&&y.constructor!=Number){var me=/^\-\=/.test(y),pe=/^\+\=/.test(y);if(me||pe){y=this.value(null,"y")+parseInt(y.replace(me?'=':'+=',''),10);}else{y=isNaN(parseInt(y,10))?undefined:parseInt(y,10);}}
if(o.axis!="vertical"&&x!==undefined){if(o.stepping.x)x=Math.round(x/o.stepping.x)*o.stepping.x;x=this._translateValue(x,"x");x=this._translateLimits(x,"x");x=this._translateRange(x,"x");o.animate?this.currentHandle.stop().animate({left:x},(Math.abs(parseInt(this.currentHandle.css("left"))-x))*(!isNaN(parseInt(o.animate))?o.animate:5)):this.currentHandle.css({left:x});}
if(o.axis!="horizontal"&&y!==undefined){if(o.stepping.y)y=Math.round(y/o.stepping.y)*o.stepping.y;y=this._translateValue(y,"y");y=this._translateLimits(y,"y");y=this._translateRange(y,"y");o.animate?this.currentHandle.stop().animate({top:y},(Math.abs(parseInt(this.currentHandle.css("top"))-y))*(!isNaN(parseInt(o.animate))?o.animate:5)):this.currentHandle.css({top:y});}
if(this.rangeElement)
this._updateRange();this.currentHandle.data("mouse").sliderValue={x:Math.round(this._convertValue(x,"x"))||0,y:Math.round(this._convertValue(y,"y"))||0};if(!noPropagation){this._propagate('start',null);this._propagate('stop',null);this._propagate('change',null);this._propagate("slide",null);}}});$.ui.slider.getter="value";$.ui.slider.defaults={handle:".ui-slider-handle",distance:1,animate:false};})(jQuery);