/**
 * @copyright Copyright (C) 2007-2009 Hyh. All rights reserved.
 * @link http://www.hyh.pl
 */


function email(sId, sName, sHost, sSubject)
{
	sEmail = sName + '@' + sHost;
	sHref = 'mailto:' + sEmail + '?subject=' + sSubject;

	eMailTo = document.createElement('a');
	eMailTo.setAttribute('href', sHref);
	eMailTo.innerHTML = sEmail;

	eContact = document.getElementById(sId);
	if(eContact) {
		eContact.innerHTML = '';
		eContact.appendChild(eMailTo);
	}
}


function logotypes()
{
	var boxHeight = $('#logotypes').css('height');
	boxHeight = parseInt(boxHeight.substr(0,boxHeight.indexOf('px')));

	var imgHeight = $('#logotypes img').css('height');
	imgHeight = parseInt(imgHeight.substr(0,imgHeight.indexOf('px')));

	
	if($('#logotypes').scrollTop() + boxHeight >= imgHeight) {
		next = 0;
	} else {
		next = boxHeight + $('#logotypes').scrollTop();
	}

	$('#logotypes img').fadeOut(700, function() { $('#logotypes').scrollTop(next); });
	$('#logotypes img').fadeIn(700);

	setTimeout(logotypes, 4000);
}

// jquery import!
$(function() {
	$('a[rel*=external], a[href^=http://]').click( function() {
		$(this).attr('target','_blank');
	});
	

	$('a[rel=lightbox]').lightBox({
		fixedNavigation: true,
		imageBtnClose: '/web/scripts/jquery-lightbox/images/close.gif',
		imageBtnPrev: '/web/scripts/jquery-lightbox/images/prev.gif',
		imageBtnNext: '/web/scripts/jquery-lightbox/images/next.gif',
		imageLoading: '/web/scripts/jquery-lightbox/images/ico-loading.gif',
		imageBlank: '/web/scripts/jquery-lightbox/images/blank.gif',
		txtImage: '',
		txtOf: '/'
	});

	email('contact', 'kontakt', 'hyh.pl', 'Zapytanie');
	email('contact2', 'kontakt', 'hyh.pl', 'Zapytanie www');
	
	logotypes();
});