// @(#) $Id: main.js,v 1.1.1.1 2004/05/07 09:14:29 tom Exp $

// Browser & System detect
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror')) { browser = "Konqueror"; OS = "Linux"; }
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (checkIt('netscape')) browser = "Netscape"
else if (checkIt('gecko')) browser = "Mozilla"
else if (!checkIt('compatible')) { browser = "Netscape Navigator"; version = detect.charAt(8); }
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS) {
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


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


function hiddenEm(name,domain) {
	window.location.href="mailto"+":"+name+"@"+domain;
}

function hiddenTx( str )
{
	str = str.replace( "*", "@" );
	var str_array = str.split("..");
	
	for(i=0;i<str_array.length;i++) document.write( str_array[i]+"<font><\/font>" );
}


// Layer data replace
function layer_data_replace(layer_id,layer_data)
{
	if (browser=='Netscape') {
		document.layers[layer_id].document.open(); 
		document.layers[layer_id].document.write(layer_data); 
		document.layers[layer_id].document.close(); 
	}
	else if (browser=='Internet Explorer') {
		document.all[layer_id].innerHTML=layer_data;
	} else {
		document.getElementById(layer_id).innerHTML=layer_data;
	}
}


function more(id)
{
	//buttdata=document.all[id+'detailsbutt'].innerHTML;
	o=document.getElementById(id);
	obutt=document.getElementById(id+'_morebutt');
	// Buttons HTML code
	butt_more="<a href=\"javascript:void(null)\" class='prodmoredetails' onClick=\"more('"+id+"')\" onMouseOver=\"window.status=''; return(true)\">MORE DETAILS</a>";
	butt_close="<a href=\"javascript:void(null)\" class='prodclosedetails' onClick=\"more('"+id+"')\" onMouseOver=\"window.status=''; return(true)\">CLOSE DETAILS</a>&nbsp;<font class='prodclosedetails'><b>[x]</b></font>";
	// Buttons replace
	if ( o.style.display=="none" )
	{
		o.style.display="block";
		obutt.innerHTML=butt_close;
	}
	else
	{
		o.style.display="none";
		obutt.innerHTML=butt_more;
	}
}


var ImageZoomWindow = null;
function ImageZoom( image_url, title, width, height ) {

	//alert( ImageZoomWindow );
	if( ImageZoomWindow == "[object Window]" || ImageZoomWindow == "[object]" ) ImageZoomWindow.close();
	ImageZoomWindow = window.open('','ImageZoom','status=no,scrollbars=no,width='+(width+20)+',height='+(height+20)+',left=20,top=20');
	code = "<html>";
	code += "<head>";
	code += "<title>"+title+"</title>";
	code += "</head>";
	code += "<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>";
	code += "<table border='0' cellspacing='0' cellpadding='0' width='100%' height='100%' onClick='window.close()' style='cursor:hand'>";
		code += "<tr align='center' valign='middle'>";
			code += "<td>";
				code += "<img src='"+image_url+"'><br>";
			code += "</td>";
		code += "</tr>";
	code += "</table>";
	code += "</body>";
	code += "</html>";
	ImageZoomWindow.document.write(code);
}



/*
	FUNKCJE OSADZAJACE SWF'y NA STRONIE
*/
function title( text01_str, text02_str )
{
	if( !text02_str ) text02_str = "";
	var res = "";
	res += "<div style=\"padding:10px;padding-bottom:10px;padding-right:0px\">";
	res += "<object width=\"550\" height=\"30\" id=\"title01_mc\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">";
		res += "<param name=\"movie\" value=\"lib.flash/title01.swf\">";
		res += "<param name=\"flashvars\" value=\"text01="+text01_str+"&text02="+text02_str+"\">";
		res += "<param name=\"scale\" value=\"NoScale\">";
		res += "<param name=\"salign\" value=\"tl\">";
		res += "<param name=\"quality\" value=\"high\">";
		res += "<param name=\"bgcolor\" value=\"#ffffff\">";
		res += "<param name=\"wmode\" value=\"transparent\">";
		res += "<param name=\"menu\" value=\"false\">";
		res += "<embed src=\"lib.flash/title01.swf\" flashvars=\"text01="+text01_str+"&text02="+text02_str+"\" swliveconnect=\"true\" width=\"550\" height=\"40\" bgcolor=\"#ffffff\" name=\"title01_mc\" wmode=\"transparent\" menu=\"false\" quality=\"high\" scale=\"NoScale\" salign=\"tl\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>";
	res += "</object>";
	res += "</div>";

	document.write( res );
	return;
}



function homebox( title_str, image_url, link_url, link_target )
{
	var res = "";
	res += "<div style=\"padding:10px;padding-bottom:10px;padding-right:0px\">";
	res += "<object width=\"230\" height=\"142\" id=\"title01_mc\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">";
		res += "<param name=\"movie\" value=\"lib.flash/homebox.swf\">";
		res += "<param name=\"flashvars\" value=\"title_str="+title_str+"&image_url="+image_url+"&link_url="+link_url+"&link_target="+link_target+"\">";
		res += "<param name=\"scale\" value=\"NoScale\">";
		res += "<param name=\"salign\" value=\"tl\">";
		res += "<param name=\"quality\" value=\"high\">";
		res += "<param name=\"bgcolor\" value=\"#ffffff\">";
		res += "<param name=\"wmode\" value=\"transparent\">";
		res += "<param name=\"menu\" value=\"false\">";
		res += "<embed src=\"lib.flash/homebox.swf\" flashvars=\"title_str="+title_str+"&image_url="+image_url+"&link_url="+link_url+"&link_target="+link_target+"\" swliveconnect=\"true\" width=\"230\" height=\"142\" bgcolor=\"#ffffff\" name=\"title01_mc\" wmode=\"transparent\" menu=\"false\" quality=\"high\" scale=\"NoScale\" salign=\"tl\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>";
	res += "</object>";
	res += "</div>";

	document.write( res );
	return;
}