$(function(){
	$('.port_img_cont').mouseenter(function(){
		$(this).stop().animate({height:$(this).find('.port_img').css('height') , marginTop:'-165px'},500);
		$(this).find('.port_btn').hide();

	});
	$('.port_img_cont').mouseleave(function(){
		$(this).stop().animate({height:'50px', marginTop:'10px'},500);
		$(this).find('.port_btn').show();
	});


	/*jQuery('.carousel').jcarousel({
		/*btnNext: ".next",
		btnPrev: ".prev",
		visible: 1*/
/*		itemLoadCallback: itemLoadCallbackFunction*/
	//});

/*	$(".carousel").jCarouselLite({
		
	});**/

	$('#navigation>li>a').append('<span class="jhoverer"></span>');
	$('#navigation>li>a').hover(function() {        
	$('.jhoverer', this).stop().animate( { 'opacity': 1 }, 700, 'easeOutSine');
	},
	function(){
		$('.jhoverer', this).stop().animate( { 'opacity': 0 }, 700, 'easeOutQuad');
	});
});

function mycarousel_itemLoadCallback(carousel, state)
{
		jQuery.get(
        '_special/getClients.php',
        {'first':carousel.first},
        function(text) {
					mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, text);
        },
        'text'
    );
};

function mycarousel_itemAddCallback(carousel, first, last, text)
{
	var items = (text.split(','));
  //carousel.size(parseInt(items[0]));
  carousel.add(first, mycarousel_getItemHTML(items[1],items[2]));
};

function mycarousel_getItemHTML(url,linki)
{
    return '<a href="'+linki+'" target="_blank"><img src="' + url + '" width="336" height="78" alt="" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        // itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
				scroll : 1,
				size	:client_num,
				wrap: 'circular',
				start	: Math.floor(Math.random() * (client_num - 0 + 1)) + 0,
        itemLoadCallback: mycarousel_itemLoadCallback
    });
});


var selectWidth = "316";
var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;

 $(function() {
			$("a.lightbox").lightbox({
			fitToScreen: true
		});
});


