
function PosElement(id, x, y) {
	if(id && x) {
		document.getElementById(id).style.left = x + 'px';;
	}
	if(id && y) {
		document.getElementById(id).style.top = y + 'px';;
	}
}

function showIFrame(url, titel, language)
{
	var content = "<div id=\"iframewindow\" style=\"display: block;\">\n";
	content+= "	<div id=\"iframewindowtitle\">\n";
	content+= "		<div id=\"iframewindowtitle_text\">"+titel+"</div>\n";
	content+= "		<div id=\"iframewindowtitle_logo\" style=\"text-align:left;\"><img alt=\"Robert Kunzmann GmbH &amp; Co.KG\" src=\"http://kontakt.kunzmann.de/img/div/logo_de2.gif\"/></div>\n";
	content+= "	</div>\n";
	content+= "	<div id=\"iframeborder\">\n";
	content+= "			<iframe id=\"iframe\" frameborder=\"0\"  src=\""+url+"\" style=\"display: block;\" ></iframe>\n";
	content+= "	</div>\n";
	content+= "	<div id=\"iframewindowfooter\" text-align:left;\">\n";
	if(language=='de')
	{
		content+= "		<a class=\"none-underline\" style=\"margin-right: 10px; cursor:pointer; float: left;\" onclick=\"javascript: opener.location='/shop/"+language+"/infocenter/bestellservice/agb.htm'\">&nbsp;agb&nbsp;</a>\n";
		content+= "		<a class=\"none-underline\" style=\"margin-right: 10px; cursor:pointer; float: left;\" onclick=\"javascript: opener.location='/shop/"+language+"/infocenter/bestellservice/impressum.htm'\"> |&nbsp;&nbsp;&nbsp;impressum</a>\n";
		content+= "		<a class=\"none-underline\" style=\"margin-right: 10px; cursor:pointer; float: left;\" onclick=\"javascript: opener.location='/shop/"+language+"/infocenter/bestellservice/datenschutz.htm'\"> |&nbsp;&nbsp;&nbsp;datenschutz</a>\n";
		content+= "		<a class=\"none-underline\" style=\"margin-right: 50px; float: right;\" href=\"javascript:window.close();\"> [x] Fenster schliessen</a>\n";
	}
	if(language=='en')
	{
		content+= "		<a class=\"none-underline\" style=\"margin-right: 10px; cursor:pointer; float: left;\" onclick=\"javascript: opener.location='/shop/"+language+"/infocenter/orderservice/terms-and-conditions.htm'\">&nbsp;terms and conditions of use &nbsp;</a>\n";
		content+= "		<a class=\"none-underline\" style=\"margin-right: 10px; cursor:pointer; float: left;\" onclick=\"javascript: opener.location='/shop/"+language+"/infocenter/orderservice/imprint.htm'\"> |&nbsp;&nbsp;&nbsp;imprint</a>\n";
		content+= "		<a class=\"none-underline\" style=\"margin-right: 10px; cursor:pointer; float: left;\" onclick=\"javascript: opener.location='/shop/"+language+"/infocenter/orderservice/privacy-protection.htm'\"> |&nbsp;&nbsp;&nbsp;legal</a>\n";
		content+= "		<a class=\"none-underline\" style=\"margin-right: 50px; float: right;\" href=\"javascript:window.close();\"> [x] Close window</a>\n";
	}
	content+= "	</div>\n";
	content+= "</div>\n";

	var p = window.open(url, titel.replace(/ /g,'_'), "width=637, height=637");
	p.document.open("text/html")
	p.document.write("<html><head><title></title>");
	p.document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"http://kontakt.kunzmann.de/css/main.css\">");
	p.document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"http://kontakt.kunzmann.de/css/core/base.css\">");
	p.document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"http://kontakt.kunzmann.de/css/screen/content.css\">");
	p.document.write("</head><body style='background:black;'>");
	p.document.write(content);
	p.document.write("</body></html>");
	p.document.close();
	p.focus();
}
/*
function showIFrame(url, titel)
{
	PosElement('iframewindow',200,100) ;


	document.getElementById('iframe').style.display = 'block';
    document.getElementById('iframe').src=url;
	document.getElementById('iframewindow').style.display = 'block';
	document.getElementById('iframewindowtitle_text').innerHTML = titel;

}*/

function hideIFrame()
{
	document.getElementById('iframe').style.display = 'none';
	document.getElementById('iframewindow').style.display = 'none';
}

var attrib = new Array();

/* Warenkorb hinzufuegen */
function BasketAdd(formid,attrib) {
 var selects = $$('.attribut-select');
 var errors = 0;

selects.each(function(element)
 {
	eid = element.id + '_error';
	if($(eid)){
		$(eid).remove();
 	}

        if(element.selectedIndex == 0){

              //  Choosetext = "Bitte " + attrib[eid] + " ausw&auml;hlen."
 		html = '&nbsp;&nbsp;<span class="error" id="' + eid + '"><br class="quarter"/>' + 'Bitte ' + attrib[eid] + ' ausw&auml;hlen.' + '<br/></span>';
		new Insertion.After(element.id, html);
 		errors++;
 	}
 });
 if(errors == 0){
 	$(formid).submit();
 }
 return false;
};

function reset_errors()
{
    jQuery('div.box6_top span.error').each(
           function(){jQuery(this).remove();}
           );
}

//maxpage ist im homelayout ganz oben im <head> tag definiert
jQuery(document).ready(function(){

	if(typeof(page)=="undefined"){page=1;}
	if(typeof(lang)=="undefined"){lang='de';}
	
	if(typeof(url)=="undefined"){url = "/shop/"+lang+"/home/top_angebote?page=";}

	jQuery('div.angebote-scroller span#forward').click(function()
		{
			if(page==maxpage) { page = 1;}
			else		{ page +=1; }
			jQuery('div#scroll_area').load(url+page);
		})
	jQuery('div.angebote-scroller span#back').click(function()
		{
			if(page==1)	{ page = maxpage;}
			else		{ page -=1; }
			jQuery('div#scroll_area').load(url+page);
		})

})
