function arrowOver(pSrc, pType) {
  if (pType == 'up') {
    pSrc.style.background = 'url(\'img/arrows/gray/arrow_up_green.gif\') center top no-repeat';
  } else if (pType == 'down') {
    pSrc.style.background = 'url(\'img/arrows/gray/arrow_down_green.gif\') center bottom no-repeat';
  } else if (pType == 'left') {
    pSrc.src = 'img/arrows/gray/arrow_left_green.gif';
  } else if (pType == 'right') {
    pSrc.src = 'img/arrows/gray/arrow_right_green.gif';
  }

  pSrc.style.cursor = 'pointer';
}


function arrowOut(pSrc, pType) {
  if (pType == 'up') {
    pSrc.style.background = 'url(\'img/arrows/gray/arrow_up.gif\') center top no-repeat';
  } else if (pType == 'down') {
    pSrc.style.background = 'url(\'img/arrows/gray/arrow_down.gif\') center bottom no-repeat';
  } else if (pType == 'left') {
    pSrc.src = 'img/arrows/gray/arrow_left.gif';
  } else if (pType == 'right') {
    pSrc.src = 'img/arrows/gray/arrow_right.gif';
  }

  pSrc.style.cursor = 'default';
}


function showLangButton(pSrc) {
  if (pSrc == 'lng_pl') {
    $('#lng_pl').attr('src', 'img/lang_pl_pl.gif');
    $('#lng_en').attr('src', 'img/lang_pl_en.gif');
    $('#lng_nl').attr('src', 'img/lang_pl_nl.gif');
  } else if (pSrc == 'lng_en') {
    $('#lng_pl').attr('src', 'img/lang_en_pl.gif');
    $('#lng_en').attr('src', 'img/lang_en_en.gif');
    $('#lng_nl').attr('src', 'img/lang_en_nl.gif');
  } else if (pSrc == 'lng_nl') {
    $('#lng_pl').attr('src', 'img/lang_nl_pl.gif');
    $('#lng_en').attr('src', 'img/lang_nl_en.gif');
    $('#lng_nl').attr('src', 'img/lang_nl_nl.gif');
  }
}


function markProjectThumbnail(pSrc, pAction) {
  if (pAction == 1) {
    $('#' + pSrc).css('border', '#04c2b5 1px solid');
  } else {
    if (pSrc != act) {
      $('#' + pSrc).css('border', 'none');
    }
  }
}


function changeProjectThumbnail(pSrc, pIndex) {
	var tmp = act;

	act = pSrc;
	markProjectThumbnail(tmp, 0);
	markProjectThumbnail(pSrc, 1);
	act = pSrc;

	return false;
}


function showProjectPhoto(pId) {
	$('#project_slideshow img').css('display', 'none');
	$('#slideshow_' + pId).css('display', 'block');

	if (el2 != null) {
		el1 = el2;
		el2 = pId;
	} else {
		el2 = pId;
	}

	changeProjectThumbnail('projectThumb' + pId, pId);
	$('#project_slideshow').innerfade({ speed: 'slow', timeout: 500, type: 'pair', containerheight: '491px', item_first: el1, item_second: el2 });
}


function showProjectPhotoByClick(pId) {
	//clearTimeout(tout);
	
	showProjectPhoto(pId);

	//tout = setTimeout("showRandomProjectPhoto(" + pId + ")", 10000);
}


function showRandomProjectPhoto(pEl) {
	var rnd = 1;

	do {
		rnd = Math.floor(Math.random() * max_photos) + 1;
	} while (rnd <= 1 || rnd >= max_photos || rnd == pEl || rnd == 0);
	
	//alert(rnd);

	//if (rnd == 0) rnd = 1;
	//if (rnd > max_photos) rnd = max_photos;

	showProjectPhoto(rnd);
	tout = setTimeout("showRandomProjectPhoto(" + rnd + ")", 10000);
}


function activateScroll() {
	$(function()
		{
			$('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 17});
		});
}


$(document).ready(function($) {
	//$('a[rel*=facebox]').facebox()
})
