
function ks_FormularzDomyslnaWartosc(id,value)
{
	var obj=new Object();
	obj.id=id;
	obj.value;

	if (!document.getElementById(obj.id))
		return obj;

	obj.getValue = function()
	{
		return document.getElementById(obj.id).value;
	}

	obj.setValue = function(wart)
	{
		document.getElementById(obj.id).value=wart;
	}

	if (!value)
	{
		obj.value=obj.getValue();
	}
	else
	{
		obj.value=value;
	}

	document.getElementById(obj.id).onblur = function()
	{
		if (obj.getValue()=='')
			obj.setValue(obj.value);
	}

	document.getElementById(obj.id).onfocus = function()
	{
		if (obj.getValue()==obj.value)
			obj.setValue('');
	}

	return obj;
}

var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name){
  if (document.getElementById) {
  	this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
  }  else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
  } else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
  }
}

function hideDiv() {
	if (!DHTML) return;
	var x = new getObj('toplayer');
	x.style.visibility = 'hidden'
}

function centerDiv() {
	if (!DHTML) return;
	var x = new getObj('toplayer');
	x.style.top='100px';
}


$('.ajax').live('click',function(){
	$.ajax({
		dataType:'json',
		url:$(this).attr('href'),
		success:function(d)
		{
			$('#popup').remove();
			$('body').append(d.sHtml);
			if (d.linkSwf)
			{
				var flashvars={};
				flashvars.film=d.linkSwf;
				swfobject.embedSWF("/swf/apexnet_player_www.swf", "player", "640", "480", "9.0.0", "/swf/expressInstall.swf",flashvars);
			}
		}
	});
	return false;
});


$('#close').live('click',function(){
	$('#popup').remove();
	return false;
});
