// ###########################################################################################################	
//     INICIALIZAÇÕES 
// ###########################################################################################################	

// --> FIX FLASH OBJECT

theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++)
{
	theObjects[i].outerHTML = theObjects[i].outerHTML;
}

// --> SHOW AND NO SHOW

function OnOff(x) {

	if (document.getElementById(x).className = "alertas_links_off") {

		document.getElementById(x).className = "alertas_links";

	} else {

		document.getElementById(x).className = "alertas_links_off";

	}

}
		

// --> PNG FIX

	$(document).ready(function(){
		$('#principal').pngFix( );
	});
	
// --> MENU 

jQuery().ready(function(){
		// simple accordion
		jQuery('#menu').accordion({
			autoheight: false,
			//animated: "bounceslide", //"easeslide", 
			alwaysOpen: false,
			active: true    
		});
		
				// second simple accordion with special markup
		jQuery('#navigation').accordion({
			active: true,
			animated: "bounceslide", //"easeslide", 
			header: '.head',
			navigation: true,
			autoheight: false,
			animated: 'easeslide'
		});
		
	
	});

// --> PROMO BANNER

var mycarousel_itemList = [
	{url: 'promo_banner/assistencia_odontologica.gif', title: 'Assistência Médica', lk: 'assistencia_saude.php'},
	{url: 'promo_banner/jucesp.gif', title: 'JUCESP', lk: 'jucesp.php'},
	{url: 'promo_banner/cert2.gif', title: 'Certisign', lk: 'http://www.progerecs.com.br/cert/ribeiraopreto'},
	{url: 'promo_banner/aluguel_de_salas.gif', title: 'Aluguel de Salas', lk: 'locacao_salas.php'},
	{url: 'promo_banner/cbmae5.gif', title: 'CBMAE', lk: 'camara.php'},
	{url: 'promo_banner/revista_acao.gif', title: 'Anuncie Revista AÇÃO', lk: 'anuncie_revista.php'},
	{url: 'promo_banner/economia.gif', title: 'Instituto de Economia', lk: 'dados_economicos.php'},
	{url: 'promo_banner/assistencia_medica.gif', title: 'Assistência Médica', lk: 'assistencia_saude.php'},
    {url: 'promo_banner/banco_de_talentos.gif', title: 'Cadastre seu currículo', lk: 'empregos.php'},
    //{url: 'promo_banner/tv_corporativa.gif', title: 'TV Corporativa', lk: 'http://www.tvcacb.com.br/site/agenda.asp'},
	{url: 'promo_banner/cooperativa.gif', title: 'Cooperativa de Crédito', lk: 'http://www.cooperac.com.br'}
	
];

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<a href="' + item.lk + '"><img src="' + item.url + '" width="181" height="143" alt="' + item.title + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
	    auto: 12,
		animation: 1000,
		scroll: 3,
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});

// --> FULL BANNER

$(function() {
    $('#fade').cycle({
       fx:     'blindY',
       speed:   1000,
       timeout: 10000,
       delay:  -4000
    });

});

// --> COMERCIAL BANNER

$(function() {
    $('#bnrs').cycle({
       fx:     'fade',
       speed:   1000,
       timeout: 10000
    });

});

// --> MODAL PANEL



$(function() {
		   
		function preloadImg(image) {
			var img = new Image();
			img.src = image;
		}

		preloadImg('imgs/ajaxLoader.gif');
		preloadImg('imgs/prev.gif');
		preloadImg('imgs/next.gif');

	});




// --> BENEFÍCIOS

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// --> FLASH TOPO

function flash_topo() {
  var obj_str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="778" height="92" id="topo" align="middle">';
  obj_str += '<param name="movie" value="topo.swf" />';
  obj_str += '<param name="quality" value="high" />';
  obj_str += '<param name="wmode" value="transparent" />';
  obj_str += '<param name="bgcolor" value="#f8f8f8" />';
  obj_str += '<embed src="topo.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="778" height="92" name="topo" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
  obj_str += '</object>';
  document.write(obj_str);
}

// --> VALIDA LOGIN


function PermiteApenasNumeros(e, campo)
{
	var Digit = parseInt(eval(((navigator.appName == "Netscape")?"e.which":"e.keyCode" )))

	if (!(Digit>47 && Digit<58 || Digit == 8 || Digit == 0 || Digit == 13))				
	{
		alert ("Favor digitar somente caracteres numéricos");
	    document.login.edtcodigo.focus();
		return false;	
	}
	
	return true;
}

function conta_senha(campo) {
	vr = campo.value;
	tam = vr.length;
	

	if ( tam <= 6) {
		document.login.area[0].checked = 'checked';
	}
	
	if ( tam >= 8) {
		document.login.area[1].checked = 'checked';
	}
	
}

function check_login() {
	
	// ÁREA
	var j = 0;
	if (document.login.area.length != null) {
		for (var i=0; i<document.login.area.length; i++) {
			if (document.login.area[i].checked == true) {
				j = 1;
				
					// SE FOR SCPC
					if (document.login.area[0].checked == true) {
						// CÓDIGO SCPC
						if (document.login.edtcodigo.value == "") {
							alert("Preencha o Campo CÓDIGO SCPC.");
							document.login.edtcodigo.focus();
							return (false);
						}
						// SENHA SCPC
						if (document.login.edtsenha.value == "") {
							alert("Preencha o Campo SENHA.");
							document.login.edtsenha.focus();
							return (false);
						}
						document.login.action="http://www.acirp.com.br/recic/scripts/pscpc.exe/login";
                    	document.login.submit(); 
					}
					
					// SE FOR ACIRP
					if (document.login.area[1].checked == true) {
						// CÓDIGO ACIRP
						if (document.login.edtcodigo.value == "") {
							alert("Preencha o Campo CÓDIGO ACIRP.");
							document.login.edtcodigo.focus();
							return (false);
						}
						// SENHA ACIRP
						if (document.login.edtsenha.value == "") {
							alert("Preencha o Campo SENHA.");
							document.login.edtsenha.focus();
							return (false);
						}
						
						if (document.login.edtsenha.value != "") {
							vr = document.login.edtsenha.value;
							tam = vr.length;
								if ( tam < 8 || tam > 32) {
									alert("A senha de acesso para a ACIRP é diferente da senha do SCPC \n e deve conter no mínimo \"8\"  CARACTERES. \n\n Inicialmente a senha da ACIRP é o CNPJ da empresa");
									document.login.edtsenha.focus();
									return(false);
								}
						}
						document.login.action="valida.php";
                    	document.login.submit(); 
					}
			}
			
		}
	} else {
		if (document.login.area.checked)
			j = 1;
	}
	
	if (j != 1) {
		alert('Selecione uma area de acesso SCPC ou ACIRP');
		return (false);
	}	

  return (true);
}


//--> FAQ

function panel_down(y) {
        document.getElementById('pd' + y).className = "panel_down";
	
        for (var i=1; i<=numero_itens; i++) {
        	if (i != y) {
	            document.getElementById('pd' + i.toString()).className = "panel_down_off";
	        }
        }
    }
	
// --> JUMP MENU

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// --> POPUP

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// --> CARREGA PÁGINA

function caregaPagina(bla, ble){
var page = bla;
var id_div = ble;

//alert(paragrafo);
   
  $().ajaxStart(function() { $('#loading').show(); });
  $().ajaxStop(function() { $('#loading').hide(); });
  
 $.ajax({
   type: "GET",
   url: page,
   data: "",
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });


}


// --> AJAX EVENTO 1

function evento(bla, ble){
var page = bla;
var id_div = ble;

   
  $().ajaxStart(function() { $('#loading').show(); });
  $().ajaxStop(function() { $('#loading').hide(); });
  
 $.ajax({
   type: "POST",
   url: page,
   data: "",
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });

}

// --> AJAX EVENTO 2

function evento2(bla, ble, bli){
var page = bla;
var id_div = ble;
var destino = bli;

var paragrafo = destino.value;

//alert(paragrafo);
   
  $().ajaxStart(function() { $('#loading').show(); });
  $().ajaxStop(function() { $('#loading').hide(); });
  
 $.ajax({
   type: "GET",
   url: page,
   data: "valor="+paragrafo+"",
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });


}

// --> AJAX CPF

function Verifica_CPF(bla, ble, bli){
var page = bla;
var id_div = ble;
var destino = bli;

var paragrafo = destino.value;

//alert(paragrafo);
   
  $().ajaxStart(function() { $('#loading').show(); });
  $().ajaxStop(function() { $('#loading').hide(); });
  
 $.ajax({
   type: "GET",
   url: page,
   data: "recebe="+paragrafo+"",
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });


}

// --> AJAX GERAL

function AJAX_Geral(bla, ble, bli){
var page = bla;
var id_div = ble;
var destino = bli;
var paragrafo = destino.value;

//alert(paragrafo);
   
  $().ajaxStart(function() { $('#loading').show(); });
  $().ajaxStop(function() { $('#loading').hide(); });
  
 $.ajax({
   type: "GET",
   url: page,
   data: "recebe="+paragrafo+"",
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });


}

// --> AJAX email

function Verifica_EMAIL(bla, ble, bli){
var page = bla;
var id_div = ble;
var destino = bli;

var paragrafo = destino.value;

//alert(paragrafo);
   
  $().ajaxStart(function() { $('#loading').show(); });
  $().ajaxStop(function() { $('#loading').hide(); });
  
 $.ajax({
   type: "GET",
   url: page,
   data: "recebe="+paragrafo+"",
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });


}

// ------------------------------- AJAX CONTEÚDO2 -----------------------------------
function Cargo(bla, ble, bli){
var page = bla;
var id_div = ble;
var destino = bli;



 $().ajaxStart(function() { $('#loading').show(); });
 $().ajaxStop(function() { $('#loading').hide(); });

 $.ajax({
   type: "GET",
   url: page,
   data: "recebe="+destino.options[destino.selectedIndex].value,
   success: function(msg){
     $('#'+id_div+'').html(msg);
   }
 });

}







// ###########################################################################################################	
// ###########################################################################################################	
// ###########################################################################################################	

//--------------------------------------------------------------------------------------------------
//         MENU - jquery.easing.js            
//--------------------------------------------------------------------------------------------------

/*
 * jQuery Easing v1.1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Uses the built in easing capabilities added in jQuery 1.1
 * to offer multiple easing options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

jQuery.extend(jQuery.easing, {
	easein: function(x, t, b, c, d) {
		return c*(t/=d)*t + b; // in
	},
	easeinout: function(x, t, b, c, d) {
		if (t < d/2) return 2*c*t*t/(d*d) + b;
		var ts = t - d/2;
		return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;		
	},
	easeout: function(x, t, b, c, d) {
		return -c*t*t/(d*d) + 2*c*t/d + b;
	},
	expoin: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		return flip * (Math.exp(Math.log(c)/d * t)) + b;		
	},
	expoout: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b;
	},
	expoinout: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b;
		return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b;
	},
	bouncein: function(x, t, b, c, d) {
		return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b;
	},
	bounceout: function(x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	bounceinout: function(x, t, b, c, d) {
		if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b;
	},
	elasin: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	elasout: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	elasinout: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	backin: function(x, t, b, c, d) {
		var s=1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	backout: function(x, t, b, c, d) {
		var s=1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	backinout: function(x, t, b, c, d) {
		var s=1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	}
});

//--------------------------------------------------------------------------------------------------
//         MENU - jquery.accordion.js            
//--------------------------------------------------------------------------------------------------

/*
 * jQuery UI Accordion 1.6
 * 
 * Copyright (c) 2007 Jörn Zaefferer
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.accordion.js 4876 2008-03-08 11:49:04Z joern.zaefferer $
 *
 */

;(function($) {
	
// If the UI scope is not available, add it
$.ui = $.ui || {};

$.fn.extend({
	accordion: function(options, data) {
		var args = Array.prototype.slice.call(arguments, 1);

		return this.each(function() {
			if (typeof options == "string") {
				var accordion = $.data(this, "ui-accordion");
				accordion[options].apply(accordion, args);
			// INIT with optional options
			} else if (!$(this).is(".ui-accordion"))
				$.data(this, "ui-accordion", new $.ui.accordion(this, options));
		});
	},
	// deprecated, use accordion("activate", index) instead
	activate: function(index) {
		return this.accordion("activate", index);

	}
});

$.ui.accordion = function(container, options) {
	
	// setup configuration
	this.options = options = $.extend({}, $.ui.accordion.defaults, options);
	this.element = container;
	
	$(container).addClass("ui-accordion");
	
	if ( options.navigation ) {
		var current = $(container).find("a").filter(options.navigationFilter);
		if ( current.length ) {
			if ( current.filter(options.header).length ) {
				options.active = current;
			} else {
				options.active = current.parent().parent().prev();
				current.addClass("current");
			}
		}
	}
	
	// calculate active if not specified, using the first header
	options.headers = $(container).find(options.header);
	options.active = findActive(options.headers, options.active);

	if ( options.fillSpace ) {
		var maxHeight = $(container).parent().height();
		options.headers.each(function() {
			maxHeight -= $(this).outerHeight();
		});
		var maxPadding = 0;
		options.headers.next().each(function() {
			maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
		}).height(maxHeight - maxPadding);
	} else if ( options.autoheight ) {
		var maxHeight = 0;
		options.headers.next().each(function() {
			maxHeight = Math.max(maxHeight, $(this).outerHeight());
		}).height(maxHeight);
	}

	options.headers
		.not(options.active || "")
		.next()
		.hide();
	options.active.parent().andSelf().addClass(options.selectedClass);
	
	if (options.event)
		$(container).bind((options.event) + ".ui-accordion", clickHandler);
};

$.ui.accordion.prototype = {
	activate: function(index) {
		// call clickHandler with custom event
		clickHandler.call(this.element, {
			target: findActive( this.options.headers, index )[0]
		});
	},
	
	enable: function() {
		this.options.disabled = false;
	},
	disable: function() {
		this.options.disabled = true;
	},
	destroy: function() {
		this.options.headers.next().css("display", "");
		if ( this.options.fillSpace || this.options.autoheight ) {
			this.options.headers.next().css("height", "");
		}
		$.removeData(this.element, "ui-accordion");
		$(this.element).removeClass("ui-accordion").unbind(".ui-accordion");
	}
}

function scopeCallback(callback, scope) {
	return function() {
		return callback.apply(scope, arguments);
	};
}

function completed(cancel) {
	// if removed while animated data can be empty
	if (!$.data(this, "ui-accordion"))
		return;
	var instance = $.data(this, "ui-accordion");
	var options = instance.options;
	options.running = cancel ? 0 : --options.running;
	if ( options.running )
		return;
	if ( options.clearStyle ) {
		options.toShow.add(options.toHide).css({
			height: "",
			overflow: ""
		});
	}
	$(this).triggerHandler("change.ui-accordion", [options.data], options.change);
}

function toggle(toShow, toHide, data, clickedActive, down) {
	var options = $.data(this, "ui-accordion").options;
	options.toShow = toShow;
	options.toHide = toHide;
	options.data = data;
	var complete = scopeCallback(completed, this);
	

	// count elements to animate
	options.running = toHide.size() == 0 ? toShow.size() : toHide.size();
	
	if ( options.animated ) {
		if ( !options.alwaysOpen && clickedActive ) {
			$.ui.accordion.animations[options.animated]({
				toShow: jQuery([]),
				toHide: toHide,
				complete: complete,
				down: down,
				autoheight: options.autoheight
			});
		} else {
			$.ui.accordion.animations[options.animated]({
				toShow: toShow,
				toHide: toHide,
				complete: complete,
				down: down,
				autoheight: options.autoheight
			});
		}
	} else {
		if ( !options.alwaysOpen && clickedActive ) {
			toShow.toggle();
		} else {
			toHide.hide();
			toShow.show();
		}
		complete(true);
	}
}

function clickHandler(event) {
	var options = $.data(this, "ui-accordion").options;
	if (options.disabled)
		return false;
	
	// called only when using activate(false) to close all parts programmatically
	if ( !event.target && !options.alwaysOpen ) {
		options.active.parent().andSelf().toggleClass(options.selectedClass);
		var toHide = options.active.next(),
			data = {
				instance: this,
				options: options,
				newHeader: jQuery([]),
				oldHeader: options.active,
				newContent: jQuery([]),
				oldContent: toHide
			},
			toShow = options.active = $([]);
		toggle.call(this, toShow, toHide, data );
		return false;
	}
	// get the click target
	var clicked = $(event.target);
	
	// due to the event delegation model, we have to check if one
	// of the parent elements is our actual header, and find that
	if ( clicked.parents(options.header).length )
		while ( !clicked.is(options.header) )
			clicked = clicked.parent();
	
	var clickedActive = clicked[0] == options.active[0];
	
	// if animations are still active, or the active header is the target, ignore click
	if (options.running || (options.alwaysOpen && clickedActive))
		return false;
	if (!clicked.is(options.header))
		return;

	// switch classes
	options.active.parent().andSelf().toggleClass(options.selectedClass);
	if ( !clickedActive ) {
		clicked.parent().andSelf().addClass(options.selectedClass);
	}

	// find elements to show and hide
	var toShow = clicked.next(),
		toHide = options.active.next(),
		//data = [clicked, options.active, toShow, toHide],
		data = {
			instance: this,
			options: options,
			newHeader: clicked,
			oldHeader: options.active,
			newContent: toShow,
			oldContent: toHide
		},
		down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
	
	options.active = clickedActive ? $([]) : clicked;
	toggle.call(this, toShow, toHide, data, clickedActive, down );

	return false;
};

function findActive(headers, selector) {
	return selector != undefined
		? typeof selector == "number"
			? headers.filter(":eq(" + selector + ")")
			: headers.not(headers.not(selector))
		: selector === false
			? $([])
			: headers.filter(":eq(0)");
}

$.extend($.ui.accordion, {
	defaults: {
		selectedClass: "selected",
		alwaysOpen: true,
		animated: 'slide',
		event: "click",
		header: "a",
		autoheight: true,
		running: 0,
		navigationFilter: function() {
			return this.href.toLowerCase() == location.href.toLowerCase();
		}
	},
	animations: {
		slide: function(options, additions) {
			options = $.extend({
				easing: "swing",
				duration: 300
			}, options, additions);
			if ( !options.toHide.size() ) {
				options.toShow.animate({height: "show"}, options);
				return;
			}
			var hideHeight = options.toHide.height(),
				showHeight = options.toShow.height(),
				difference = showHeight / hideHeight;
			options.toShow.css({ height: 0, overflow: 'hidden' }).show();
			options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
				step: function(now) {
					var current = (hideHeight - now) * difference;
					if ($.browser.msie || $.browser.opera) {
						current = Math.ceil(current);
					}
					options.toShow.height( current );
				},
				duration: options.duration,
				easing: options.easing,
				complete: function() {
					if ( !options.autoheight ) {
						options.toShow.css("height", "auto");
					}
					options.complete();
				}
			});
		},
		bounceslide: function(options) {
			this.slide(options, {
				easing: options.down ? "bounceout" : "swing",
				duration: options.down ? 1000 : 200
			});
		},
		easeslide: function(options) {
			this.slide(options, {
				easing: "easeinout",
				duration: 700
			})
		}
	}
});

})(jQuery);

//--------------------------------------------------------------------------------------------------
//        PNG FIX         
//--------------------------------------------------------------------------------------------------

/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[@src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[@src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);

