// -------------------------------------------------------------------------------
// Flags
// generuje liste flag
// -------------------------------------------------------------------------------
function flags( flags_array, selected_country )
{
	var res = "";
	var flag_no;
	for( flag_no = 0; flag_no < flags_array.length; flag_no++ )
	{
		var flag = flags_array[flag_no];
		if( flag["url"].length == 0 ) flag["url"] = "javascript:alert('"+flags_array["unavailable"]+"')";
		if( flag["symbol"] != selected_country ) {
			res += "<a href=\""+flag["url"]+"\">";
			res += "<img src=\"flags/"+flag["symbol"]+"-off.gif\" title=\""+flag["name"]+"\" alt=\""+flag["name"]+"\" onmouseover=\"javascript: this.src='flags/"+flag["symbol"]+".gif'\" onmouseout=\"javascript: this.src='flags/"+flag["symbol"]+"-off.gif'\" style=\"margin:2px;margin-top:5px\">";
			res += "</a>\n";
		} else {
			res += "<a href=\""+flag["url"]+"\">";
			res += "<img src=\"flags/"+flag["symbol"]+".gif\" title=\""+flag["name"]+"\" alt=\""+flag["name"]+"\" style=\"margin:2px;margin-top:5px\">";
			res += "</a>\n";
		}
	}
	res = "<table width=\"760px\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tr>\n<td align=\"right\">\n"+res+"</td></tr></table>";
	document.write( res );
}


// -------------------------------------------------------------------------------
// Title
// wstawia tytul flashowy na strone
// -------------------------------------------------------------------------------
function title( title_str, width, height, rtl )
{
	if( title_str == undefined ) title_str = "";
	if( rtl == undefined ) rtl = "";
	if( width == undefined ) width = 500;
	if( height == undefined ) height = 45;
	//title_str = "<a href='123'>132</a>";
	//alert( 'title_str='+title_str+'&rtl='+rtl+'&swf_width='+width+'&swf_height='+height );
	var swf_object = '';
	swf_object += '<object width="'+width+'" height="'+height+'" id="title" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">';
	swf_object += '<param name="movie" value="flash/title/title.swf">';
	swf_object += '<param name="flashvars" value="title_str='+title_str+'&rtl='+rtl+'&swf_width='+width+'&swf_height='+height+'">';
	swf_object += '<param name="scale" value="NoScale">';
	swf_object += '<param name="salign" value="tl">';
	swf_object += '<param name="quality" value="high">';
	swf_object += '<param name="bgcolor" value="#ffffff">';
	swf_object += '<param name="wmode" value="transparent">';
	swf_object += '<param name="menu" value="false">';
	swf_object += '<embed src="flash/title/title.swf" flashvars="title_str='+title_str+'&rtl='+rtl+'&swf_width='+width+'&swf_height='+height+'" name="title" swliveconnect="true" width="'+width+'" height="'+height+'" bgcolor="#ffffff" wmode="transparent" menu="false" quality="high" scale="NoScale" salign="tl" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	swf_object += '</object><br>';
	document.write( swf_object );
}


// -------------------------------------------------------------------------------
// Input Default
// wstawia defaultowe napisy do <input>
// -------------------------------------------------------------------------------
var input_default_array = Array();
function input_default( object, focus )
{
	var actual_value = object.value;
	if( !input_default_array[object.name] ) input_default_array[object.name] = actual_value;
	var default_value = input_default_array[object.name];

	if( focus )
	{
		if( actual_value == default_value ) object.value = "";
		object.className = "TextTyped";
	}
	else
	{
		if( actual_value == default_value || actual_value == "" )
		{
			object.value = default_value;
			object.className = "TextDefault";
		}
		else
		{
			object.className = "TextTyped";
		}
	}
}


// -------------------------------------------------------------------------------
// Strefy
// generuje liste Therapeutic indications (strefy i zakresy dziaania)
// -------------------------------------------------------------------------------
function strefy() {

	zdjecia_preload_html = "<div style='visibility:hidden'>";
	strefy_html = "<table style='padding:5px;padding-bottom:10px' border='0' cellspacin='0' cellpadding='0' width='600'>";
	for( dolegliwosc_no = 0; dolegliwosc_no < doleg.length; dolegliwosc_no++ ) {

		if ( doleg[dolegliwosc_no]['dolegli'].length > 0 ) {

			zdjecia_preload_html += "<img src='img/strefy/230/"+(dolegliwosc_no+1)+".jpg' width='0' height='0'>";

			mouse_out = "onMouseOut='strefy_glow("+dolegliwosc_no+",0);'";
			mouse_over = "onMouseOver='strefy_glow("+dolegliwosc_no+",1);'";
			mouse_click = "onClick='strefy_glow("+dolegliwosc_no+",2);'";

			strefy_html += "<tr valign='top'>";
			strefy_html += "<td>";
				strefy_html += "<table border='0' cellspacing='0' cellpadding='0'>";
				strefy_html += "<tr valign='top'>";
				strefy_html += "<td><div class='dolegliwoscTitle0' id='dolegliwosclinktxt"+dolegliwosc_no+"' "+mouse_over+" "+mouse_out+" "+mouse_click+">"+(dolegliwosc_no+1)+".  "+doleg[dolegliwosc_no]['dolegli']+"</div></td>";
				strefy_html += "<td style='padding:5px;cursor:hand'><img src='img/strefy/medolight_more0.gif' border='0' name='dolegliwosclinkimg"+dolegliwosc_no+"' "+mouse_over+" "+mouse_out+" "+mouse_click+"></td>";
				strefy_html += "</tr>";
				strefy_html += "</table>";
			strefy_html += "</td>";
			strefy_html += "</tr>";
			strefy_html += "<tr valign='top'>";
			strefy_html += "<td>";

				strefy_html += "<div id='dolegliwosc"+dolegliwosc_no+"' style='display:none'>";
				strefy_html += "<table border='0' cellspacing='0' cellpadding='0' style='border:dotted 1px #c0c0c0'>";
				strefy_html += "<tr valign='middle'>";
				strefy_html += "<td class='dolegliwoscTitle' width='100%'>"+doleg["application_zones"]+"</td>";
				strefy_html += "<td class='dolegliwoscTitle'>"+doleg["time"]+"</td>";
				strefy_html += "<td class='dolegliwoscTitle'>"+doleg["program"]+"</td>";
				strefy_html += "<td class='dolegliwoscTitle'>"+doleg["daily_applications"]+"</td>";
				strefy_html += "<td class='dolegliwoscTitle'>"+doleg["cycle_length"]+"</td>";
				strefy_html += "<td class='dolegliwoscTitle'>"+doleg["draw"]+"</td>";
				strefy_html += "</tr>";
				strefy_html += "<tr align='center' valign='middle'>";
				strefy_html += "<td class='dolegliwoscBody' align='left' valign='top'>"+doleg[dolegliwosc_no]['strfyap']+"</td>";
				strefy_html += "<td class='dolegliwoscBody' nowrap>"+doleg[dolegliwosc_no]['czas']+"</td>";
				strefy_html += "<td class='dolegliwoscBody'>"+doleg[dolegliwosc_no]['program']+"</td>";
				strefy_html += "<td class='dolegliwoscBody'>"+doleg[dolegliwosc_no]['liczbas']+"</td>";
				strefy_html += "<td class='dolegliwoscBody'>"+doleg[dolegliwosc_no]['dlcyklu']+"</td>";
				strefy_html += "<td class='dolegliwoscBody'><img src='img/strefy/230/"+(dolegliwosc_no+1)+".jpg' class='dolegliwoscImage'></td>";
				strefy_html += "</tr>";
				strefy_html += "<tr>";
				strefy_html += "<td class='dolegliwoscHide' align='right' colspan='6'>";
				strefy_html += "<a href='javascript:strefy_pokaz("+dolegliwosc_no+")' class='dolegliwoscShowHide'><img src='img/strefy/medolight_close.gif' border='0'>  "+doleg["close"]+"</a>";
				strefy_html += "</td>";
				strefy_html += "</tr>";
				strefy_html += "</table>";
				strefy_html += "</div>";

			strefy_html += "</td>";
			strefy_html += "</tr>";

		}
	}
	strefy_html += "</table>";
	zdjecia_preload_html += "</div>";

	//document.write(zdjecia_preload_html);
	document.write(strefy_html);
}


function strefy_pokaz(id) {

	odolegliwosc=document.getElementById('dolegliwosc'+id);
	if (odolegliwosc.style.display == 'none') {

		// dolegliwosc - pokaz
		odolegliwosc.style.display="block";

	} else {

		// dolegliwosc - ukryj
		odolegliwosc.style.display="none";

	}

}


function strefy_glow(id,mouse_state) {

	odolegliwosclinktxt=document.getElementById('dolegliwosclinktxt'+id);

	if ( mouse_state == 0 ) {
		odolegliwosclinktxt.className='dolegliwoscTitle0';
		document['dolegliwosclinkimg'+id].src='img/strefy/medolight_more0.gif';
	} else if ( mouse_state == 1 ) {
		odolegliwosclinktxt.className='dolegliwoscTitle1';
		document['dolegliwosclinkimg'+id].src='img/strefy/medolight_more1.gif';
	} else if ( mouse_state == 2 ) {
		strefy_pokaz(id);
	}
}

function WOpen(name, url, w, h, s, r) {
	return (window.open(name, url, "toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars="+s+",resizable="+r+",fullscreen=no,channelmod=no,width="+w+",height="+h));
}

