function gid(name) {
	return document.getElementById(name);
}

function dirtypop(src,w,h) {
	w=w?w:750;
	h=h?h:550;
	var o=window.open(src, 'img','left='+((screen.width-w)/2)+',top='+((screen.height-h)/2)+',toolbar=0,location=0,scrollbars=0,resizable=yes,width='+w+', height='+h);
	var win=o.document;
	win.write('<!DOCTYPE html PUBLIC \'-//W3C//DTD XHTML 1.0 Strict//EN\' \'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\'>');
	win.write('<html><head>');
	win.write('<style type="text/css">html,body{margin:0;padding:0}</style>');
	win.write('</head><body onclick="self.close();">');
	win.write('<img src="' + src + '" alt="" />');
	win.write('</body></html>');
	win.close();
	if (window.focus) o.focus();
	return false;
}

function openWindow(src,w,h) {
	w=w?w:750;
	h=h?h:550;
	var win = window.open(src, 'img','toolbar=0,location=0,scrollbars=yes,resizable=yes,left='+((screen.width-w)/2)+',top=0width=' + (w + 50) + ', height=' + (h + 150));
	if (window.focus) win.focus();
	return false;
}

function photogallery(src,w,h) {
	w=w?w:840;
	h=h?h:790;
	var win = window.open(src, "img",'left='+((screen.width-w)/2)+',top=0,toolbar=0,scrollbars=yes,resizable=yes,width='+w+',height='+h);
	if (window.focus) win.focus();
	return false;
}

function zmen_platbu( pole ) {
	var platba_text;
	var platba_descr;
	var platba_radio;

	if( pole ){
		for( var i=0; i < document.obj_form.platba.length; i++ ){
			platba_text = gid('name_'+document.obj_form.platba[i].id);
			platba_descr = gid('descr_'+document.obj_form.platba[i].id);
			platba_radio = document.obj_form.platba[i];

			if( platba_radio ) platba_radio.disabled = true;
			if( platba_text ) platba_text.className = 'inactive';
			if( platba_descr ) platba_descr.className = 'inactive';
		}

		for( i=0; i<pole.length; i++ ){
			platba_text = gid('name_platba'+pole[i]);
			platba_descr = gid('descr_platba'+pole[i]);
			platba_radio = gid('platba'+pole[i]);

			if( platba_radio ) platba_radio.disabled = false;
			if( platba_text ) platba_text.className = 'active';
			if( platba_descr ) platba_descr.className = 'active';
		}
	}
}


function check(idForm,language) {

	var inputs = gid(idForm).getElementsByTagName('input');
	var data_ok = true;
	language = language ? language : 'cs';

	if( inputs ) {
		for( i = 0; i < inputs.length; i++ ) {
			if ( /f-req/.test( inputs[i].className )) {
				if( inputs[i].value == '' ) {
					if( gid( inputs[i].id )) {
						gid( inputs[i].id ).className = 'f-req f-empty';
					}
					if ( data_ok ) {
						gid( inputs[i].id ).focus();
					}
					data_ok = false;
				}
				else {
					if( gid( inputs[i].id )) {
						gid( inputs[i].id ).className = 'f-req';
					}
				}
			}
		}
	}

	if( !data_ok ) {
		if( language == 'cs' ) {
			alert( 'Vyplňte prosím všechna povinná pole' );
		}
		else if( language == 'en' ) {
			alert( 'Please fill in all required fields' );
		}
	}

	return data_ok;
}


function mailto_fc( box, domain ) {
 var proto=String.fromCharCode( 109,97,105,108,116,111,58 )
 w=window.open(proto+box+String.fromCharCode(64)+domain);
 if (w!=null) w.close(); //FF
}

function mailto( name, domain, attributes ) {
 if( typeof(attributes)=='undefined' ) attributes = '';
 document.write("<a href=\"javascript:mailto_fc('"+name+"', '"+domain+"')\""+(attributes.length > 0 ? ' ' : '')+attributes+'>'+name+String.fromCharCode(64)+domain+'</a>');
}
