function externalLinks() { 
	if (!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
	}
} 
window.onload = externalLinks;

$(function(){
	$('#header .services li').live('mouseover', function() {
		$(this).children('a').children('img')
			.animate({ "width": "1px" },200)
			.animate({ "width": "110px" },200);
	});
	$('.button').live('mouseover',function() {
		$(this).stop()
			.animate({ 'opacity': 0.8 },50)
			.animate({ 'opacity': 1 },50)
			.animate({ 'opacity': 0.8 },50)
			.animate({ 'opacity': 1 },50)
			.animate({ 'opacity': 0.8 },50)
			.animate({ 'opacity': 1 },50);
	});
	$('input[type="submit"]').live('mouseover',function() {
		$(this).stop()
			.animate({ 'opacity': 0.8 },50)
			.animate({ 'opacity': 1 },50)
			.animate({ 'opacity': 0.8 },50)
			.animate({ 'opacity': 1 },50)
			.animate({ 'opacity': 0.8 },50)
			.animate({ 'opacity': 1 },50);
	});
});

var slidemenu_timeout = 500;
var slidemenu_closetimer = 0;
var slidemenu_item = 0;
function slidemenu_open() {
	slidemenu_canceltimer();
	slidemenu_close();
	slidemenu_item = $(this).find('ul').slideDown('fast');
}
function slidemenu_close() {
	if (slidemenu_item) {
		slidemenu_item.slideUp('fast');
	}
}
function slidemenu_timer() {
	if (slidemenu_item !== $(this)) {
	slidemenu_closetimer = window.setTimeout(slidemenu_close, slidemenu_timeout);
	}
}
function slidemenu_canceltimer() {
	if (slidemenu_closetimer) {
		window.clearTimeout(slidemenu_closetimer);
		slidemenu_closetimer = null;
	}
}

$(function(){
	$('#menu_panel ul li.selection').bind('click', slidemenu_open);
	$('#menu_panel ul li.selection').bind('mouseover', slidemenu_canceltimer);
	$('#menu_panel ul li.selection').bind('mouseout',  slidemenu_timer);
});


//	$('#thumbs li>a').css({opacity:0.7}).live('mouseover',function(){$(this).stop().animate({opacity:1})}).live('mouseout',function(){$(this).stop().animate({opacity:0.7})})

/*
$(function(){
	$.extend($.fx.step,{
		backgroundPosition: function(fx) {
			if (fx.state === 0 && typeof fx.end == 'string') {
				var start = $.curCSS(fx.elem,'backgroundPosition');
				start = toArray(start);
				fx.start = [start[0],start[2]];
				var end = toArray(fx.end);
				fx.end = [end[0],end[2]];
				fx.unit = [end[1],end[3]];
			}
			var nowPosX = [];
			nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
			nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
			fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
			function toArray(strg) {
				strg = strg.replace(/left|top/g,'0px');
				strg = strg.replace(/right|bottom/g,'100%');
				strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
				var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
				return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
			}
		}
	});
});
$(function(){
	$('.button').live('mouseover',function(){
		$(this).stop().animate({
			top: 40px;
//			backgroundPosition: '(140px 0)'
		},100,function(){
			$(this).css({backgroundPosition: '0 0'})
		})
	})
});
*/

/*
function confirmMsg(ID, parm) {
	if (ID) {
		var message = '';
		var link = '';
		switch (ID) {
			case 1:
				message = 'Czy na pewno wyłączyć?';
				link = '?id='+parm+'&cmd=stop&submit=1';
			break;
			case 2:
				message = 'Czy na pewno uruchomić?';
				link = '?id='+parm+'&cmd=start&submit=1';
			break;
			case 3:
				message = 'Czy na pewno usunąć użytkownika?';
				link = '?id='+parm[0]+'&cmd=userdel&submit=1&value='+parm[1];
			break;
			case 4:
				message = 'Czy na pewno uruchomić ponownie serwer?';
				link = '?id='+parm+'&cmd=restart&submit=1';
			break;
			case 5:
				message = 'Czy na pewno usunąć plik?';
				link = '?del='+parm;
			break;
		}
		if (message && link) {
			var response = window.confirm(message);
			if (response) {
				location.href = link;
			}
		}
	}
}
function show_form(formID) {
	if (formID) {
		document.getElementById('form_'+formID).className = 'subform_visible';
	}
}
function hide_form(formID) {
	if (formID) {
		document.getElementById('form_'+formID).className = 'subform_hidden';
	}
}
function showProgress(objID) {
	var countAnchors = 0;
	var anchors = objID.getElementsByTagName('input');
	var testImg = new Image();
	newImg.src = imgSrc;
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute('type') == 'file') {
			if (anchor.value != '') {
				countAnchors = countAnchors + 1;
			}
		}
	}
	if (countAnchors > 0) {
		document.getElementById('progress').className = 'visible';
		this.style.visibility = 'hidden';
	}
	return true;
}
function accordionMenu(objName, openPos) {
	$('#'+objName+' div').hide();
	if (openPos != 'undefined') {
		$('#'+objName+' div:eq('+openPos+')').show();
	}
	$('#'+objName+' li a').click(
		function() {
			var checkElement = $(this).next();
			if((checkElement.is('div')) && (checkElement.is(':visible'))) {
				return false;
			}
			if ((checkElement.is('div')) && (!checkElement.is(':visible'))) {
				$('#'+objName+' div:visible').slideUp('fast');
				checkElement.slideDown('fast');
				return false;
			}
		}
	);
}

function accordionMenu(objName) {
	$('#'+objName+' p').hide();
//	$('#'+objName+' p:first').show();
	$('#'+objName+' li a').click(
		function() {
			var checkElement = $(this).next();
			if((checkElement.is('p')) && (checkElement.is(':visible'))) {
				return false;
			}
			if((checkElement.is('p')) && (!checkElement.is(':visible'))) {
				$('#'+objName+' p:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}
function accordianTable(objName) {
	$('#'+objName+' tr:odd').addClass('master');
	$('#'+objName+' tr:not(.master)').hide();
	$('#'+objName+' tr:first-child').show();
	$('#'+objName+' tr.master').click(
		function(){
			var checkElement = $(this).next('tr:not(.master)');
			if (checkElement.is(':visible')) {
				checkElement.toggle();
				return false;
			}
			if (!checkElement.is(':visible')) {
				$('#'+objName+' tr:not(.master):not(:first-child):visible').toggle();
				checkElement.slideDown('falst');
				return false;
			}
		}
	);
}
// Title: tigra slider control
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_slider_control/
// Version: 1.0.2 (commented source)
// Date: 08/21/2008
// Tech. Support: http://www.softcomplex.com/forum/
// Notes: This script is free. Visit official site for further details.

function slider (a_init, a_tpl) {
	this.f_setValue  = f_sliderSetValue;
	this.f_getPos    = f_sliderGetPos;
	// register in the global collection	
	if (!window.A_SLIDERS) {
		window.A_SLIDERS = [];
	}
	this.n_id = window.A_SLIDERS.length;
	window.A_SLIDERS[this.n_id] = this;
	// save config parameters in the slider object
	var s_key;
	if (a_tpl) {
		for (s_key in a_tpl) {
			this[s_key] = a_tpl[s_key];
		}
	}
	for (s_key in a_init) {
		this[s_key] = a_init[s_key];
	}
	this.n_pix2value = this.n_pathLength / (this.n_maxValue - this.n_minValue);
	if (this.n_value == null) {
		this.n_value = this.n_minValue;
	}
	// generate the control's HTML
	document.write(
		'<div style="width:' + this.n_controlWidth + 'px;height:' + this.n_controlHeight + 'px;border:0; background-image:url(' + this.s_imgControl + ')" id="sl' + this.n_id + 'base">' +
		'<img src="' + this.s_imgSlider + '" width="' + this.n_sliderWidth + '" height="' + this.n_sliderHeight + '" border="0" style="position:relative;left:' + this.n_pathLeft + 'px;top:' + this.n_pathTop + 'px;z-index:' + this.n_zIndex + ';cursor:pointer;visibility:hidden;" name="sl' + this.n_id + 'slider" id="sl' + this.n_id + 'slider" onmousedown="return f_sliderMouseDown(' + this.n_id + ')"/></div>'
	);
	this.e_base   = get_element('sl' + this.n_id + 'base');
	this.e_slider = get_element('sl' + this.n_id + 'slider');
	
	// safely hook document/window events
	if (!window.f_savedMouseMove && document.onmousemove != f_sliderMouseMove) {
		window.f_savedMouseMove = document.onmousemove;
		document.onmousemove = f_sliderMouseMove;
	}
	if (!window.f_savedMouseUp && document.onmouseup != f_sliderMouseUp) {
		window.f_savedMouseUp = document.onmouseup;
		document.onmouseup = f_sliderMouseUp;
	}
	// preset to the value in the input box if available
	var e_input = this.s_form == null
		? get_element(this.s_name)
		: document.forms[this.s_form]
			? document.forms[this.s_form].elements[this.s_name]
			: null;
	this.f_setValue(e_input && e_input.value != '' ? e_input.value : null, 1);
	this.e_slider.style.visibility = 'visible';
}

function f_sliderSetValue (n_value, b_noInputCheck) {
	if (n_value == null) {
		n_value = this.n_value == null ? this.n_minValue : this.n_value;
	}
	if (isNaN(n_value)) {
		return false;
	}
	// round to closest multiple if step is specified
	if (this.n_step) {
		n_value = Math.round((n_value - this.n_minValue) / this.n_step) * this.n_step + this.n_minValue;
	}
	// smooth out the result
	if (n_value % 1) {
		n_value = Math.round(n_value * 1e5) / 1e5;
	}
	if (n_value < this.n_minValue) {
		n_value = this.n_minValue;
	}
	if (n_value > this.n_maxValue) {
		n_value = this.n_maxValue;
	}
	this.n_value = n_value;
	// move the slider
	if (this.b_vertical) {
		this.e_slider.style.top  = (this.n_pathTop + this.n_pathLength - Math.round((n_value - this.n_minValue) * this.n_pix2value)) + 'px';
	} else {
		this.e_slider.style.left = (this.n_pathLeft + Math.round((n_value - this.n_minValue) * this.n_pix2value)) + 'px';
	}
	// save new value
	var e_input;
	if (this.s_form == null) {
		e_input = get_element(this.s_name);
		if (!e_input) {
			return b_noInputCheck ? null : f_sliderError(this.n_id, "Can not find the input with ID='" + this.s_name + "'.");
		}
	} else {
		var e_form = document.forms[this.s_form];
		if (!e_form) {
			return b_noInputCheck ? null : f_sliderError(this.n_id, "Can not find the form with NAME='" + this.s_form + "'.");
		}
		e_input = e_form.elements[this.s_name];
		if (!e_input) {
			return b_noInputCheck ? null : f_sliderError(this.n_id, "Can not find the input with NAME='" + this.s_name + "'.");
		}
	}
	var myArray = ['1', '2', '3', '4', '5', '6', '9', '19', '25'];
	e_input.value = myArray[n_value];
	print_sms_table();
}

// get absolute position of the element in the document
function f_sliderGetPos (b_vertical, b_base) {
	var n_pos = 0, s_coord = (b_vertical ? 'Top' : 'Left');
	var o_elem = o_elem2 = b_base ? this.e_base : this.e_slider;
	while (o_elem) {
		n_pos += o_elem["offset" + s_coord];
		o_elem = o_elem.offsetParent;
	}
	o_elem = o_elem2;
	var n_offset;
	while (o_elem.tagName != "BODY") {
		n_offset = o_elem["scroll" + s_coord];
		if (n_offset) {
			n_pos -= o_elem["scroll" + s_coord];
		}
		o_elem = o_elem.parentNode;
	}
	return n_pos;
}

function f_sliderMouseDown (n_id) {
	window.n_activeSliderId = n_id;
	return false;
}

function f_sliderMouseUp (e_event, b_watching) {
	if (window.n_activeSliderId != null) {
		var o_slider = window.A_SLIDERS[window.n_activeSliderId];
		o_slider.f_setValue(o_slider.n_minValue + (o_slider.b_vertical
			? (o_slider.n_pathLength - parseInt(o_slider.e_slider.style.top) + o_slider.n_pathTop)
			: (parseInt(o_slider.e_slider.style.left) - o_slider.n_pathLeft)) / o_slider.n_pix2value);
		if (b_watching)	return;
		window.n_activeSliderId = null;
	}
	if (window.f_savedMouseUp) {
		return window.f_savedMouseUp(e_event);
	}
}

function f_sliderMouseMove (e_event) {
	if (!e_event && window.event) {
		e_event = window.event;
	}
	// save mouse coordinates
	if (e_event) {
		window.n_mouseX = e_event.clientX + f_scrollLeft();
		window.n_mouseY = e_event.clientY + f_scrollTop();
	}
	// check if in drag mode
	if (window.n_activeSliderId != null) {
		var o_slider = window.A_SLIDERS[window.n_activeSliderId];
		var n_pxOffset;
		if (o_slider.b_vertical) {
			var n_sliderTop = window.n_mouseY - o_slider.n_sliderHeight / 2 - o_slider.f_getPos(1, 1) - 3;
			// limit the slider movement
			if (n_sliderTop < o_slider.n_pathTop) {
				n_sliderTop = o_slider.n_pathTop;
			}
			var n_pxMax = o_slider.n_pathTop + o_slider.n_pathLength;
			if (n_sliderTop > n_pxMax) {
				n_sliderTop = n_pxMax;
			}
			o_slider.e_slider.style.top = n_sliderTop + 'px';
			n_pxOffset = o_slider.n_pathLength - n_sliderTop + o_slider.n_pathTop;
		} else {
			var n_sliderLeft = window.n_mouseX - o_slider.n_sliderWidth / 2 - o_slider.f_getPos(0, 1) - 3;
			// limit the slider movement
			if (n_sliderLeft < o_slider.n_pathLeft) {
				n_sliderLeft = o_slider.n_pathLeft;
			}
			var n_pxMax = o_slider.n_pathLeft + o_slider.n_pathLength;
			if (n_sliderLeft > n_pxMax) {
				n_sliderLeft = n_pxMax;
			}
			o_slider.e_slider.style.left = n_sliderLeft + 'px';
			n_pxOffset = n_sliderLeft - o_slider.n_pathLeft;
		}
		if (o_slider.b_watch) {
			 f_sliderMouseUp(e_event, 1);
		}
		return false;
	}
	if (window.f_savedMouseMove) {
		return window.f_savedMouseMove(e_event);
	}
}

// get the scroller positions of the page
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel))) {
		n_result = n_docel;
	}
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function f_sliderError (n_id, s_message) {
	alert("Slider #" + n_id + " Error:\n" + s_message);
	window.n_activeSliderId = null;
}

get_element = document.all ?
	function (s_id) { return document.all[s_id] } :
	function (s_id) { return document.getElementById(s_id) };

$().ready(function() {
	$('#coda-slider-1').codaSlider({
		dynamicArrows: false,
		dynamicTabs: false,
		autoSlide: true,
		autoSlideInterval: 5000,
		autoSlideStopWhenClicked: true,
		autoHeightEaseDuration: 1000,
		autoHeightEaseFunction: 'easeInOutElastic',
		slideEaseDuration: 1000,
		slideEaseFunction: 'easeInOutElastic'
	});
});

*/

