global_site_path = "http://www.affiliate-marketing.de/rating/";

function open_window(iframe_src) {

	var IE6=navigator.appVersion.indexOf("MSIE 6")!=-1;

	// build "link" tag for css
	var css_link = document.createElement("link");
	css_link.rel = "stylesheet";
	css_link.type = "text/css";
	css_link.href = global_site_path + "css/style.css";

	//------------------------------------------

	document.getElementsByTagName('head')[0].appendChild(css_link);

	//build a form
	var center_div = document.createElement("div");
	center_div.id = 'center_widget_aff_mark';
	center_div.style.display = 'none';

	var link_close = document.createElement("a");
	link_close.className = "link_close_aff_mark";
	link_close.href = '#';
	link_close.innerHTML = '[Fenster schliessen]';
	link_close.onclick=function() {
		hide_form();
		return false;
	}

	var img = document.createElement("img");
	img.src = global_site_path + "media/widget/logo.jpg";
	img.alt = "Logo";

	var br = document.createElement("br");

	var iframe = document.createElement("iframe");
	iframe.src = "http://www.affiliate-marketing.de/merchantcode." + iframe_src;
	iframe.frameBorder = '0';
	iframe.align = 'center';
	iframe.scrolling = 'no';

	center_div.appendChild(link_close);
	/*center_div.appendChild(img);*/
	center_div.appendChild(br);
	center_div.appendChild(iframe);

	//document.getElementById('affiliate_marketing_main_widget_container').parentNode.appendChild(center_div);
	window.document.body.appendChild(center_div);
	//------------------------------

	//build a block div
	var block_div = document.createElement("div");
	block_div.id = 'block_content_aff_mark';
	block_div.className = '';
	block_div.style.height = '';
	//document.getElementById('affiliate_marketing_main_widget_container').parentNode.appendChild(block_div);
	window.document.body.appendChild(block_div);

	if (IE6) {
		iframe.height = "630px";
	}

	//------------------------------
	show_form();
	return false;
}

function show_form() {

	var IE6=navigator.appVersion.indexOf("MSIE 6")!=-1;
	//block access to content of page
	document.getElementById('block_content_aff_mark').className = 'block_content_aff_mark';
	document.getElementById('center_widget_aff_mark').style.display = 'block';
}

function hide_form() {
	//unblock access to content of page
	document.getElementById('block_content_aff_mark').className = '';
	document.getElementById('center_widget_aff_mark').style.display = 'none';
}
