/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){
	$.fn.noHtml = function( span ){
		span = (span === true )?true:false;
		return this.each(function(){
			$(this).html( $(this).children('p').text() + ( (span)?'<span></span>':'' ));
		});
	};
})(jQuery);
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
(function($) {
jQuery.fn.pngFix = function(settings) {
	settings = jQuery.extend({
		blankgif: '/resources/img/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);
(function($){$.fn.tooltip=function(){return this.each(function(){if($(this).attr('title')!=''&&$(this).attr('title')!='undefined'&&$(this).attr('title')!=' '){var title=$(this).attr('title');}else{var title='';}if(title!=''&&title!='undefined'&&title!=' '){$(this).attr('title','');$(this).hover(function(event){var x=(event.pageX+20);var y=(event.pageY+15);$(this).attr('title','');$( 'body' ).append('<div id="jquery-tooltip" class="tooltip">'+title+'</div>');if($.browser.msie){var contextWidth=$("#jquery-tooltip").outerWidth(true);}else{var contextWidth=$("#jquery-tooltip").width();}$("#jquery-tooltip").width(contextWidth).css("left",x).css("top",y).fadeIn("medium");},function(){$('#jquery-tooltip').remove();$(this).attr("title",title);});$(this).mousemove(function(event){var x=(event.pageX+20);var y=(event.pageY+15);var contextWidth=$("#jquery-tooltip").outerWidth(true);var contextHeight=$("#jquery-tooltip").outerHeight(true);if(x+contextWidth>$(window).scrollLeft()+$(window).width()){x=event.pageX-contextWidth;}if($(window).height()+$(window).scrollTop()<y+contextHeight){y=event.pageY-contextHeight;}$("#jquery-tooltip").css("left",x).css("top",y).fadeIn("medium");});}});}})(jQuery);
/**
 * jqFancyTransitions - jQuery plugin
 * @version: 1.8 (2010/06/13)
 * @requires jQuery v1.2.2 or later 
 * @author Ivan Lazarevic
 * Examples and documentation at: http://www.workshop.rs/projects/jqfancytransitions
 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
**/

(function($){var opts=new Array;var level=new Array;var img=new Array;var links=new Array;var titles=new Array;var order=new Array;var imgInc=new Array;var inc=new Array;var stripInt=new Array;var imgInt=new Array;$.fn.jqFancyTransitions=$.fn.jqfancytransitions=function(options){init=function(el){opts[el.id]=$.extend({},$.fn.jqFancyTransitions.defaults,options);img[el.id]=new Array();links[el.id]=new Array();titles[el.id]=new Array();order[el.id]=new Array();imgInc[el.id]=0;inc[el.id]=0;params=opts[el.id];if(params.effect=='zipper'){params.direction='alternate';params.position='alternate';}
if(params.effect=='wave'){params.direction='alternate';params.position='top';}
if(params.effect=='curtain'){params.direction='alternate';params.position='curtain';}
stripWidth=parseInt(params.width/params.strips);gap=params.width-stripWidth*params.strips;stripLeft=0;$.each($('#'+el.id+' img'),function(i,item){img[el.id][i]=$(item).attr('src');links[el.id][i]=$(item).next().attr('href');titles[el.id][i]=$(item).attr('alt')?$(item).attr('alt'):'';$(item).hide();});$('#'+el.id).css({'background-image':'url('+img[el.id][0]+')','width':params.width,'height':params.height,'position':'relative','background-position':'top left'});$('#'+el.id).append("<div class='ft-title' id='ft-title-"+el.id+"' style='position: absolute; bottom:0; left: 0; z-index: 1000; color: #fff; background-color: #000; '>"+titles[el.id][0]+"</div>");if(titles[el.id][imgInc[el.id]])
$('#ft-title-'+el.id).css('opacity',opts[el.id].titleOpacity);else
$('#ft-title-'+el.id).css('opacity',0);if(params.navigation){$.navigation(el);$('#ft-buttons-'+el.id).children().first().addClass('ft-button-'+el.id+'-active');}
odd=1;for(j=1;j<params.strips+1;j++){if(gap>0){tstripWidth=stripWidth+1;gap--;}else{tstripWidth=stripWidth;}
if(params.links)
$('#'+el.id).append("<a href='"+links[el.id][0]+"' class='ft-"+el.id+"' id='ft-"+el.id+j+"' style='width:"+tstripWidth+"px; height:"+params.height+"px; float: left; position: absolute;outline:none;'></a>");else
$('#'+el.id).append("<div class='ft-"+el.id+"' id='ft-"+el.id+j+"' style='width:"+tstripWidth+"px; height:"+params.height+"px; float: left; position: absolute;'></div>");$("#ft-"+el.id+j).css({'background-position':-stripLeft+'px top','left':stripLeft});stripLeft+=tstripWidth;if(params.position=='bottom')
$("#ft-"+el.id+j).css('bottom',0);if(j%2==0&&params.position=='alternate')
$("#ft-"+el.id+j).css('bottom',0);if(params.direction=='fountain'||params.direction=='fountainAlternate'){order[el.id][j-1]=parseInt(params.strips/2)-(parseInt(j/2)*odd);order[el.id][params.strips-1]=params.strips;odd*=-1;}else{order[el.id][j-1]=j;}}
$('.ft-'+el.id).mouseover(function(){opts[el.id].pause=true;});$('.ft-'+el.id).mouseout(function(){opts[el.id].pause=false;});$('#ft-title-'+el.id).mouseover(function(){opts[el.id].pause=true;});$('#ft-title-'+el.id).mouseout(function(){opts[el.id].pause=false;});clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);};$.transition=function(el,direction){if(opts[el.id].pause==true)return;stripInt[el.id]=setInterval(function(){$.strips(order[el.id][inc[el.id]],el)},opts[el.id].stripDelay);$('#'+el.id).css({'background-image':'url('+img[el.id][imgInc[el.id]]+')'});if(typeof(direction)=="undefined")
imgInc[el.id]++;else
if(direction=='prev')
imgInc[el.id]--;else
imgInc[el.id]=direction;if(imgInc[el.id]==img[el.id].length){imgInc[el.id]=0;}
if(imgInc[el.id]==-1){imgInc[el.id]=img[el.id].length-1;}
if(titles[el.id][imgInc[el.id]]!=''){$('#ft-title-'+el.id).animate({opacity:0},opts[el.id].titleSpeed,function(){$(this).html(titles[el.id][imgInc[el.id]]).animate({opacity:opts[el.id].titleOpacity},opts[el.id].titleSpeed);});}else{$('#ft-title-'+el.id).animate({opacity:0},opts[el.id].titleSpeed);}
inc[el.id]=0;buttons=$('#ft-buttons-'+el.id).children();buttons.each(function(index){if(index==imgInc[el.id]){$(this).addClass('ft-button-'+el.id+'-active');}else{$(this).removeClass('ft-button-'+el.id+'-active');}});if(opts[el.id].direction=='random')
$.fisherYates(order[el.id]);if((opts[el.id].direction=='right'&&order[el.id][0]==1)||opts[el.id].direction=='alternate'||opts[el.id].direction=='fountainAlternate')
order[el.id].reverse();};$.strips=function(itemId,el){temp=opts[el.id].strips;if(inc[el.id]==temp){clearInterval(stripInt[el.id]);return;}
$('.ft-'+el.id).attr('href',links[el.id][imgInc[el.id]]);if(opts[el.id].position=='curtain'){currWidth=$('#ft-'+el.id+itemId).width();$('#ft-'+el.id+itemId).css({width:0,opacity:0,'background-image':'url('+img[el.id][imgInc[el.id]]+')'});$('#ft-'+el.id+itemId).animate({width:currWidth,opacity:1},1000);}else{$('#ft-'+el.id+itemId).css({height:0,opacity:0,'background-image':'url('+img[el.id][imgInc[el.id]]+')'});$('#ft-'+el.id+itemId).animate({height:opts[el.id].height,opacity:1},1000);}
inc[el.id]++;};$.navigation=function(el){$('#'+el.id).append("<a href='#' id='ft-prev-"+el.id+"' class='ft-prev'>prev</a>");$('#'+el.id).append("<a href='#' id='ft-next-"+el.id+"' class='ft-next'>next</a>");$('#ft-prev-'+el.id).css({'position':'absolute','top':params.height/2-15,'left':0,'z-index':1001,'line-height':'30px','opacity':0.7}).click(function(e){e.preventDefault();$.transition(el,'prev');clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);});$('#ft-next-'+el.id).css({'position':'absolute','top':params.height/2-15,'right':0,'z-index':1001,'line-height':'30px','opacity':0.7}).click(function(e){e.preventDefault();$.transition(el);clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);});$("<div id='ft-buttons-"+el.id+"'></div>").insertAfter($('#'+el.id));$('#ft-buttons-'+el.id).css({'text-align':'right','padding-top':5,'width':opts[el.id].width});for(k=1;k<img[el.id].length+1;k++){$('#ft-buttons-'+el.id).append("<a href='#' class='ft-button-"+el.id+"'>"+k+"</a>");}
$('.ft-button-'+el.id).css({'padding':5});$.each($('.ft-button-'+el.id),function(i,item){$(item).click(function(e){e.preventDefault();$.transition(el,i);clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);})});}
$.fisherYates=function(arr){var i=arr.length;if(i==0)return false;while(--i){var j=Math.floor(Math.random()*(i+1));var tempi=arr[i];var tempj=arr[j];arr[i]=tempj;arr[j]=tempi;}}
this.each(function(){init(this);});};$.fn.jqFancyTransitions.defaults={width:500,height:332,strips:10,delay:5000,stripDelay:50,titleOpacity:0.7,titleSpeed:1000,position:'alternate',direction:'fountainAlternate',effect:'',navigation:false,links:false};})(jQuery);
(function(jQuery){
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],

		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
})(jQuery);	
jQuery.fn.ajaxSubmit = function(options) {
    if (typeof options == 'function')
        options = { success: options };

    options = jQuery.extend({
        url:    this.attr('action') || '',
        method: this.attr('method') || 'GET'
    }, options || {});

    // remap deprecated options (temporarily)
    options.success = options.success || options.after;
    options.beforeSubmit = options.beforeSubmit || options.before;
    options.type = options.type || options.method;

    var a = this.formToArray(options.semantic);

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;

    var q = jQuery.param(a);

    if (options.type.toUpperCase() == 'GET') {
        // if url already has a '?' then append args after '&'
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else
        options.data = q; // data is the query string for 'post'

    var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

    // perform a load on the target only if dataType is not provided
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data, status) {
            jQuery(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, [data, status]);
        });
    }
    else if (options.success)
        callbacks.push(options.success);

    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i](data, status);
    };

    jQuery.ajax(options);
    return this;
};
jQuery.fn.ajaxForm = function(options) {
    return this.each(function() {
        jQuery("input:submit,input:image,button:submit", this).click(function(ev) {
            var $form = this.form;
            $form.clk = this;
            if (this.type == 'image') {
                if (ev.offsetX != undefined) {
                    $form.clk_x = ev.offsetX;
                    $form.clk_y = ev.offsetY;
                } else if (typeof jQuery.fn.offset == 'function') { // try to use dimensions plugin
                    var offset = jQuery(this).offset();
                    $form.clk_x = ev.pageX - offset.left;
                    $form.clk_y = ev.pageY - offset.top;
                } else {
                    $form.clk_x = ev.pageX - this.offsetLeft;
                    $form.clk_y = ev.pageY - this.offsetTop;
                }
            }
            // clear form vars
            setTimeout(function() {
                $form.clk = $form.clk_x = $form.clk_y = null;
                }, 10);
        })
    }).submit(function(e) {
        jQuery(this).ajaxSubmit(options);
        return false;
    });
};
jQuery.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;

    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;

        if (semantic && form.clk && el.type == "image") {
            // handle image inputs on the fly when semantic == true
            if(!el.disabled && form.clk == el)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            continue;
        }
        var v = jQuery.fieldValue(el, true);
        if (v === null) continue;
        if (v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else
            a.push({name: n, value: v});
    }

    if (!semantic && form.clk) {
        // input type=='image' are not found in elements array! handle them here
        var inputs = form.getElementsByTagName("input");
        for(var i=0, max=inputs.length; i < max; i++) {
            var input = inputs[i];
            var n = input.name;
            if(n && !input.disabled && input.type == "image" && form.clk == input)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};
jQuery.fn.formSerialize = function(semantic) {
    return jQuery.param(this.formToArray(semantic));
};
jQuery.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = jQuery.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    //hand off to jQuery.param for proper encoding
    return jQuery.param(a);
};
jQuery.fn.fieldValue = function(successful) {
    var cbVal, cbName;

    // loop until we find a value
    for (var i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = jQuery.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;

        // for checkboxes, consider multiple elements, for everything else just return first valid value
        if (el.type != 'checkbox') return v;

        cbName = cbName || el.name;
        if (cbName != el.name) // return if we hit a checkbox with a different name
            return cbVal;
        cbVal = cbVal || [];
        cbVal.push(v);
    }
    return cbVal;
};
jQuery.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;

    if (successful && ( !n || el.disabled || t == 'reset' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
                // extra pain for IE...
                var v = jQuery.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};
jQuery.fn.clearForm = function() {
    return this.each(function() {
        jQuery('input,select,textarea', this).clearFields();
    });
};
jQuery.fn.clearFields = jQuery.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};
jQuery.fn.resetForm = function() {
    return this.each(function() {
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};
(function($){

/**
esto es para que funcione el menu
*/

$(document).ready(function() {
	$(document).pngFix(); 
	$.fn.extend({resetForm:function(){return this.each(function(){$(this).is('form')&&this.reset();});}});
	function megaHoverOver(){
		$(this).find(".sub,.sub2,.sub3,.sub4,.sub5").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub,.sub2,.sub3,.sub4,.sub5").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub,.sub2,.sub3,.sub4,.sub5").css({'width' : rowWidth});
			
		}
	}
	function megaHoverOut(){$(this).find(".sub,.sub2,.sub3,.sub4,.sub5").stop().fadeTo('fast',0,function(){$(this).hide();});}
	var config = {    sensitivity: 2,interval: 20,over: megaHoverOver,timeout: 20,out: megaHoverOut};
	$("ul#topnav li .sub,.sub2,.sub3,.sub4,.sub5").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);
	
	$("ul#topnav2 li .sub,.sub2,.sub3,.sub4,.sub5").css({'opacity':'0'});
	$("ul#topnav2 li").hoverIntent(config);
	
	$('[rel=tip], .mostrartip').tooltip();
	$("#contenedor #contenidos_interior .zona_cont_derecha .lista_noticia:last-child,#litado_actividades .lista_a .lista_repetir:last-child").css({border:'0 none'});
	$('.descripcion_carrera:last-child').css({borderBottom:'0 none'});
	
		
	
	//send to friends
	$('.enviar_amigo').click(function( ){
		var self = $('.min_form_area');
		$(this).fadeOut(function(){$(this).next('.min_form_area').fadeIn(250);});
		$('.min_form_area form').append('<input type="hidden" name="enviarUrl" value="'+document.URL+'">')
		$('.min_form_area form').submit(function(){
			$(this).fadeOut(250).ajaxSubmit({
				dataType:'html',
				url:'http://'+document.domain+'/areas/areas/response',
				type:'POST',
				success:function(response){$(self).append('<p align="center" class="p0 lh17">'+response+'</p>');}
			});
			return false;
		});
		return false;
	});
	
	
	//slide
	$('.descripcion_carrera.slide_oculto span').click(function(){var self=this;$('.descripcion_carrera.slide_oculto .data_set_g015_v547').slideUp(250);if($(self).parent('div').children('.data_set_g015_v547').css('display')=='none'){$(self).parent('div').children('.data_set_g015_v547').slideDown(250);}else{$(self).parent('div').children('.data_set_g015_v547').slideUp(250);}});
	
	//fade icon
	$('.pdf_img_area_g015,.imagen_ar a,.fx_over').hover(function(){if($(this).attr('sleep')==undefined){$(this).attr('sleep',true).animate({opacity:0.4},250).animate({opacity:1.0},250,function(){$(this).removeAttr('sleep');});}},function(){});
	
	
	
	$('#fx_recomendar').click(function(){
		var self = this;
		if( $('#fx_cont_recomendar').css('display') == 'none'){
			$('#fx_cont_recomendar').css({position:'absolute'}).slideDown();
		}else{
			$('#fx_cont_recomendar').css({position:'absolute'}).slideUp();
		}
		
		if($('#fx_cont_recomendar').css('display')!='none'){
			var self = $('.min_form_area'); 
			$('.min_form_area form').submit(function(){
				$(this).fadeOut(250).ajaxSubmit({
					dataType:'html',
					url:'http://'+document.domain+'/areas/areas/response',
					type:'POST',
					success:function(response){$(self).append('<p align="center" class="lh17">'+response+'</p>');}
				});
				return false;
			});
		}
		
		$('.fx_cerrar_recomendar').click(function(){
			$('#fx_cont_recomendar').slideUp();
		});
		return false;
	});
	
	
	
	$('.article_area+.article_area').css({borderTop:'1px solid #d1dfe1',paddingTop:'10px',marginTop:'10px'});
	$('select,option').css({color:'#404b4d'});
	
	if( $.browser.msie && $.browser.version.substr(0,1) == 6 ){
		$('.w738').css({width:738});
		$('.ml20.noticias_dest.flota_izquierda').removeClass('ml20').css({
			width:488,overflow:'hidden',
			marginLeft:10
		});
		$('.flota_izquierda.menu_notice').css({marginLeft:10});
		var reg_site = new RegExp(/^(http\:\/\/)([0-9a-z.-])+([0-9a-z.-])(.cl\/)(sede\/carreras\/)([a-z0-9._-]){0,}$/).exec(document.URL);


		if( reg_site != null ){
			$('.w738.zona_cont_derecha.pl0').css({width:720});
		}
		
		
		$('#left_error_data').css({width:'auto'});
		
	}
	
	
	
	$('li.linea a.area_estudio,li a.sedes').click(function(){$(this).css({cursor:'default'});return false;});
	$('li.linea a.area_estudio,li a.sedes').hover(function(){$(this).css({cursor:'default'});});
	
	$('.menu_notice ul li,.submenu_3 ul li').hover(function(){
			if( $(this).attr('class') != undefined && $(this).attr('class') == 'submenu_3_selec' ){
				return false;
			}
			$(this).animate({'backgroundColor':'#ffffff'},250);
		},
		function(){
			if( $(this).attr('class') != undefined && $(this).attr('class') == 'submenu_3_selec' ){
				return false;
			}
			$(this).animate({'backgroundColor':'#F2F5F5'},250);return false;
		});
	
	$('.menu_izquierda .nivel_uno a').hover(function(){if( $(this).parent('div').attr('class') != undefined && $(this).parent('div').attr('class') == 'nivel_1_selec' ){return false;}$(this).animate({'backgroundColor':'#f2f0f0'},250);},function(){if( $(this).parent('div').attr('class') != undefined && $(this).parent('div').attr('class') == 'nivel_1_selec' ){return false;}$(this).animate({'backgroundColor':'#FFFFFF'},250);return false;});
	$('.menu_izquierda .nivel_dos a').hover(function(){if( $(this).parent('div').attr('class') != undefined && $(this).parent('div').attr('class') == 'nivel_2_selec' ){return false;}$(this).animate({'backgroundColor':'#cdd9d9'},250);},function(){if( $(this).parent('div').attr('class') != undefined && $(this).parent('div').attr('class') == 'nivel_2_selec' ){return false;}$(this).animate({'backgroundColor':'#dee7e7'},250);return false;});
	$('.menu_izquierda .nivel_uno_prensa a').hover(function(){if( $(this).parent('div').attr('class') != undefined && $(this).parent('div').attr('class') == 'nivel_1_selec' ){return false;}$(this).animate({'backgroundColor':'#cdd9d9'},250);},function(){if( $(this).parent('div').attr('class') != undefined && $(this).parent('div').attr('class') == 'nivel_1_selec' ){return false;}$(this).animate({'backgroundColor':'#e7ecee'},250);return false;});
	
	
	
	$('.subir').click(function(){$('html,body').animate({scrollTop:'0px'}, 500);return false;});
	if($.browser.safari){$('.boton_comun').children('.btn_centro').css({paddingTop:'3px',height:'18px'});}
	$('.boton_comun').hover(function(){$(this).children('.btn_left,.btn_right,.btn_centro').css({cursor:'pointer',backgroundPosition:'0 -23px'}).animate({opacity:0.8},250).animate({opacity:1.0},250);},function(){$(this).children('.btn_left,.btn_right,.btn_centro').css({backgroundPosition:'0 0'}).animate({opacity:0.8},250).animate({opacity:1.0},250);});
	$('#slideshowHolder').jqFancyTransitions({ width: 412, height: 270,delay:2500});
	$('#slideshowHolder2').jqFancyTransitions({ width: 282, height: 424,delay:2500});
	$('#slideshowHolder3').jqFancyTransitions({ width: 490, height: 225,delay:2500});
$('.fx_nolink').css({cursor:'default'}).click(function(){return false;});
	$('.file_input_hidden,.file_input_hidden1').css({ opacity:0 });
	
	$('.fx_nohtml_span').noHtml(true);
	$('.fx_nohtml').noHtml();
	
	
});

/*ventana emergencias*/

$(document).ready(function() {   
 
    //select all the a tag with name equal to modal 
    $('a[class=modal]').click(function(e) { 
        //Cancel the link behavior 
        e.preventDefault(); 
        //Get the A tag 
        var id = $(this).attr('href'); 
     
        //Get the screen height and width 
        var maskHeight = $(document).height(); 
        var maskWidth = $(window).width(); 
     
        //Set height and width to mask to fill up the whole screen 
        $('#mask').css({'width':maskWidth,'height':maskHeight}); 
         
        //transition effect       
        $('#mask').fadeIn(1000);     
        $('#mask').fadeTo("slow",0.9);   
     
        //Get the window height and width 
        var winH = $(window).height(); 
        var winW = $(window).width(); 
               
        //Set the popup window to center 
        $(id).css('top',  winH/2-$(id).height()/2); 
        $(id).css('left', winW/2-$(id).width()/2); 
     
        //transition effect 
        $(id).fadeIn(2000).go();
     
    }); 
     
    //if close button is clicked 
    $('.window .close').click(function (e) { 
        //Cancel the link behavior 
        e.preventDefault(); 
        $('#mask, .window').hide(); 
    });       
     
    //if mask is clicked 
    $('#mask').click(function () { 
        $(this).hide(); 
        $('.window').hide(); 
    });           
     
}); 

/*ventana emergencias*/



/*TOOLTIP*/
// JavaScript Document
$(document).ready(function() {

	//Select all anchor tag with rel set to tooltip
	$('a[rel=tooltip]').mouseover(function(e) {
		
		//Grab the title attribute's value and assign it to a variable
		var tip = $(this).attr('title');	
		
		//Remove the title attribute's to avoid the native tooltip from the browser
		$(this).attr('title','');
		
		//Append the tooltip template and its value
		$(this).append('<div id="tooltip"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>');		
				
		//Show the tooltip with faceIn effect
		$('#tooltip').fadeIn('500');
		$('#tooltip').fadeTo('10',0.9);
		
	}).mousemove(function(e) {
	
		//Keep changing the X and Y axis for the tooltip, thus, the tooltip move along with the mouse
		$('#tooltip').css('top', e.pageY + 10 );
		$('#tooltip').css('left', e.pageX + 20 );
		
	}).mouseout(function() {
	
		//Put back the title attribute's value
		$(this).attr('title',$('.tipBody').html());
	
		//Remove the appended tooltip template
		$(this).children('div#tooltip').remove();
		
	});

});

/*TOOLTIP*/


/*CAMBIAR MAPA CON FOTOS*/


window.obtenerElemento = function( id ) {
	if ( document.getElementById ) {
		return self.document.getElementById( id );
	}
	else if ( window[id] ) {
		return window[id];
	}
	return null;
}

window.showhide = function(id){
    if (id==1)
	{
		$('#cambiaImg').hide();
		$('#cambiaMapa').show();
		if(!$('#map_canvas').data('cl.cc.initialized')){
			$('#map_canvas').googlemap();			
		}
	}
		if (id==2)
	{
		$('#cambiaImg').show();
		$('#cambiaMapa').hide(); 
	}
}

})(jQuery);

/**
 * $.fn.go() : focus anything !!!
 */
(function($) {
	var rFocusableNodeName = /input|select|textarea|button|a/i;
	var rFocusableNodeNotType = /hidden/i;
	$.expr[':'].focusAware = function(elem, index, meta, stack) {
		return rFocusableNodeName.test(elem.nodeName)
				&& (elem.style.display || jQuery.css(elem, "display")) !== "none"
				&& !rFocusableNodeNotType.test(elem.type);
	};
	$.fn.go = function() {
		return this.each(function(i, e) {
			if (i !== 0)
				return false;
			focus_($(e));
		});
	};
	/** Blur the active element and then focus */
	var focus_ = function(we) {
		// Fix hidden
		if (!we.is(':focusAware')) {
			goTo_(we);
		} else {
			blurActiveElement_();
			we.focus();
		}
	};
	/** Blur active element on document */
	var blurActiveElement_ = function() {
		var activeElement = document.activeElement;
		if (activeElement) {
			$(activeElement).blur();
		}
		return activeElement;
	};
	/** Focus appending a temporal anchor after (or before) this element */
	var goTo_ = function(target) {
		var activeElement = blurActiveElement_();
		var activeTop = activeElement && $(activeElement).offset().top;
		var top = !isNaN(activeTop) && target.offset().top;
		var tmp = $('<a href="#">&nbsp;</a>');
		if (!isNaN(top) && top > activeTop) {
			tmp.insertAfter(target);
		} else {
			tmp.insertBefore(target);
		}
		tmp.focus();
		tmp.remove();
	};
})(jQuery);

/**
 * $.acto() : hacer funcionar los select multiples de las paginas de la session de actos
 */
(function($) {
	
	var rgx = /.*\/(.*)\.html.*/;	
	var getBaseHtmlName = function(){
		var href = window.location.href;
		if(!rgx.test(href))
			throw 'Error al recuperar el nombre de pagina html base para los combos anio/mes';
		return RegExp.$1;
	};
	
	var stop = function(e){
		e.stopPropagation();		
		return false; 
	};
	
	$.acto = function(options) {
		// Fix options
		options = $.extend({
		 id_select_anio: 'ui_element',
		 id_select_mes: 'ui_element2',
		 base_html: options && options.base_html || getBaseHtmlName(),
		 id_boton_ir: 'imageField'
		}, options || {});
		// Prevent change events
		var select_anio = $('#' + options.id_select_anio).unbind('change');	
		var select_mes = $('#' + options.id_select_mes).unbind('change');
		// Bind click event
		$('#' + options.id_boton_ir).click(function(){
			var anio = select_anio.val();
			if(!anio) {
				alert('Favor seleccionar un año');
				return false;
			}
			var mes = select_mes.val();
			if(!mes) {
				alert('Favor seleccionar un mes');
				return false;
			}
			window.location.replace('/transparencia/' + options.base_html + '_' + anio + '_' + mes + '.html');
			return false;
		});
	};
	
	
	// Aumenta/Reduce Tamaño Texto
	$(document).ready(function(){
	 
	  // Donde queremos cambiar el tamaño de la fuente
	  var donde = $('#cont_derecha p, #cont_derecha p a, #cont_derecha h4, #cont_derecha h5, #cont_derecha h6, .tabla2 td, .tabla2 th, .tabla_1 td, .tabla_1 th, #cont_derecha li, .bajada, .bajada p, .titulo a, .bajada a, .area_noticias p, .titulo, #form1').filter(function(){
				var size = $(this).css('font-size').replace('px', '');
				return +size === 11;																																																				   
																																																														   		});
	  var sizeFuenteOriginal = donde.css('font-size');
	  var state = 0;
	  
	  // Resetear Font Size
	  $(".resetearFont").click(function(){
		donde.css('font-size', sizeFuenteOriginal);
		state = 0;
		return false;
	  });
	  // Aumentar Font Size
	  $(".aumentarFont").click(function(){
		if (state >= 2) return false;
		state++;
		var sizeFuenteActual = donde.css('font-size');
		var sizeFuenteActualNum = parseFloat(sizeFuenteActual, 11);
		var sizeFuenteNuevo = sizeFuenteActualNum*1.2;
		donde.css('font-size', sizeFuenteNuevo);
		return false;
	  });
	  // Disminuir Font Size
	  $(".disminuirFont").click(function(){
		if (state <= -2) return false;
		state--;
		var sizeFuenteActual = donde.css('font-size');
		var sizeFuenteActualNum = parseFloat(sizeFuenteActual, 11);
		var sizeFuenteNuevo = sizeFuenteActualNum*0.8;
		donde.css('font-size', sizeFuenteNuevo);
		return false;
	  });
	 
	});
	// -fin Aumenta/Reduce Tamaño Texto
	
	
})(jQuery);



	

