function submitOver(id){
	document.getElementById(id).style.backgroundColor='#89B4DA';
	document.getElementById(id).style.borderColor='#4A8CC6';
}
function submitOut(id){
	document.getElementById(id).style.backgroundColor='#4A8CC6';
	document.getElementById(id).style.borderColor='#30699C';
}

function galImgOver(id){
	document.getElementById(id).style.color='#000000';
}
function galImgOut(id){
	document.getElementById(id).style.color='#466481';
}


function liOver(id){
	document.getElementById(id).style.backgroundColor='#FBFDFF';
	document.getElementById(id).style.borderBottom='1px solid #C3E2FF';
	document.getElementById(id).style.borderTop='1px solid #C3E2FF';
}

function liOut(id){
	document.getElementById(id).style.background='none';
	document.getElementById(id).style.borderBottom='1px solid #FFFFFF';
	document.getElementById(id).style.borderTop='1px solid #FFFFFF';
}

function openWindow(url, width, height){
	
	screenWidth = screen.availWidth;
	screenHeight = screen.availHeight;
	
	leftWindow = Math.round((screenWidth - width)/2.0);
	topWindow = Math.round((screenHeight - height)/2.0);
	var newWindow = window.open(url,'_blank','scrollbars=yes, width='+width+', height='+height+',top='+topWindow+',left='+leftWindow);
	newWindow.focus();
}

function openWindowImagesFiles(url, width, height, fieldName){
	
	screenWidth = screen.availWidth;
	screenHeight = screen.availHeight;
	
	urlFile = document.getElementById(fieldName).value;
	url += '&url='+urlFile;
	
	leftWindow = Math.round((screenWidth - width)/2.0);
	topWindow = Math.round((screenHeight - height)/2.0);
	var newWindow = window.open(url,'_blank','scrollbars=yes, width='+width+', height='+height+',top='+topWindow+',left='+leftWindow);
	newWindow.focus();
}

function sendPost(tab, action){

	var form = document.createElement("form");
	form.name = 'temp_form';
	form.action = (action == undefined) ? '' : action;
	form.method = 'post';
	
	for ( name in tab ){
		var inp = document.createElement("input");
		inp.type = 'hidden';
		inp.name = name;
		inp.value = tab[name];
		
		form.appendChild(inp);
	}
	
	document.body.appendChild(form);
	
	form.submit();
}


function changeToHTML(form, field_1, field_2){
	html = document.forms[form].elements[field_1].value;
	
	html = html.replace(/\s{1,}/g,'_');
	html = html.replace(/[ąĄ±ˇ]/g,'a');
	html = html.replace(/[śŚ¶¦]/g,'s');
	html = html.replace(/[żŻĽ¬]/g,'z');
	html = html.replace(/[ćĆ]/g,'c');
	html = html.replace(/[ńŃ]/g,'n');
	html = html.replace(/[łŁ]/g,'l');
	html = html.replace(/[ęĘ]/g,'e');
	html = html.replace(/[óÓ]/g,'o');
	html = html.replace(/[^a-z,^0-9,^A-Z,^_]/g,'');
	html = html.toLowerCase();
	document.forms[form].elements[field_2].value = html;
}


function blurTags() {
	var links = document.getElementsByTagName('a');
	for (var i=0;i<links.length;i++){
		links[i].onfocus = blurme;
  	}
}

function blurme(){
	this.blur();
}


var imgLayoutDir = 'images_layout/';

function imgOver(id, img, imgDir){
	imgDir = (imgDir == undefined) ? imgLayoutDir : imgDir;
	document.getElementById(id).src = imgDir + img;
}

function imgOut(id, img, imgDir){
	imgDir = (imgDir == undefined) ? imgLayoutDir : imgDir;
	document.getElementById(id).src = imgDir + img;
}

function preloadImages(arrImagesOut, arrImagesOver, imgDir){
	imgDir = (imgDir == undefined) ? 'images_layout/' : imgDir;
	
	arrImgOut = new Array();
	for ( i=0;i<arrImagesOut.length;i++ ){
		arrImgOut[i] = new Image();
		arrImgOut[i].src = imgDir + arrImagesOut[i];
	}
	
	if ( arrImagesOver != undefined ){
		arrImgOver = new Array();
		for ( i=0;i<arrImagesOver.length;i++ ){
			arrImgOver[i] = new Image();
			arrImgOver[i].src = imgDir + arrImagesOver[i];
		}
	}
}
