var k_button = {
	"ff_link": document.getElementById("kampylink"),
	"close_button": document.getElementById("k_close_button"),
	"extra_params": null,
	"newwindow": '',

	"popitup": function(url) {
		if (!this.newwindow.closed && this.newwindow.location) 
		{
			this.newwindow.location.href = url;
		}
		else 
		{
			this.newwindow=window.open(url, 'kampyle_ff','left='+((window.screenX||window.screenLeft)+10)+',top='+((window.screenY||window.screenTop)+10)+',height=502px,width=440px,resizable=false');
			if (!this.newwindow.opener) this.newwindow.opener = self;
		}
		if (window.focus) 
		{
			this.newwindow.focus()
		}
		return false;
	},
	"open_ff": function(ff_params, url)
	{
		var url2send = url || window.location.href;
		if (!ff_params)
		{
			var ff_url = k_button.ff_link.href;
		}
		else
		{
			var ff_url = 'http://www.kampyle.com/feedback_form/ff-feedback-form.php?'+ff_params
		}
		if (this.extra_params)
		{
			var extra_params = this.make_query_string(this.extra_params);
			ff_url = ff_url + '&'+extra_params;
			
		}
		this.popitup(ff_url+'&url=' + encodeURIComponent(url2send));
		//window.open(ff_url+'&url=' + encodeURIComponent(url2send), 'kampyle_ff','left='+((window.screenX||window.screenLeft)+10)+',top='+((window.screenY||window.screenTop)+10)+',height=502px,width=440px,resizable=false');
		
	},
	"hide_button": function()
	{
		k_button.ff_link.style.display="none";
		k_button.close_button.style.display="none";
	},
	"make_query_string": function(params)
	{
		var query_string = '';
		var params_tmp = [];
		for (var s in params)
		{
			params_tmp.push(s + '=' + encodeURIComponent(params[s]));
		}
		query_string = params_tmp.join('&');
		return query_string;
	},
	
	"addCss": function(path)
	{
		var fileref=document.createElement("link")
		fileref.setAttribute("rel", "stylesheet")
		fileref.setAttribute("type", "text/css")
		fileref.setAttribute("href", path)	
		if (typeof fileref!="undefined")
		{
			document.getElementsByTagName("head")[0].appendChild(fileref)
		}
	}
}

if (((screen.width<=800) && (screen.height<=600))  && (k_button.ff_link.className != 'k_static'))
{
	k_button.close_button.onclick = k_button.hide_button;
	k_button.close_button.innerHTML = 'X';
	k_button.close_button.style.display="block";
}
