function printSelection(node)
{
	var content=node.innerHTML
	var pwin=window.open('','print_content','width=100,height=100');

	pwin.document.open();
	pwin.document.write("<html><head><title>avidento.de</title><link rel='stylesheet' type='text/css' href='/tpl/de/layout/Standard_2/plenty.css'/><body style='background:white;' onload='window.print()'><p><img src='/images/gallery/gfx/logo4.jpg?x=a'><hr size='1' color='black'><div style='background:white;margin:10px;'>"+content+"</div></body></html>");
	pwin.document.close();

	setTimeout(function(){pwin.close();},1000);

	return FALSE;
}

function paypalpopup()
{
	window.open('https://www.paypal.com/de/cgi-bin/webscr?cmd=xpt/cps/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');
	return FALSE;
}

// xmas
function openKlapp()
{
	document.getElementById('liveshopping_real').style.display="block";
	document.getElementById('tor').style.display="none";
}

// Bewertungen:
var ratingsLoaded=0;
function toggleRatings(artid)
{
	if (document.getElementById("article_rating_box").style.display=="block")
	{
		document.getElementById("article_rating_box").style.display="none";
		document.getElementById("show_ratings").innerHTML="Bewertungen anzeigen...";
	}
	else
	{
		document.getElementById("show_ratings").innerHTML="Bewertungen verstecken...";

		if (ratingsLoaded==0)
		{
			plentyAjaxRequest("/WebAjaxBase.php?Object=article@ArticleRating&ArticleID="+artid);
			ratingsLoaded=1;
		}

		document.getElementById("article_rating_box").style.display="block";
	}

	return false;
}

function loadRatings(artid)
{
	if (ratingsLoaded==0)
	{
		plentyAjaxRequest("/WebAjaxBase.php?Object=article@ArticleRating&ArticleID="+artid);
		ratingsLoaded=1;
	}
}

// http://godbit.com/article/axah-crawl-before-you-ajax 

function getAXAH(url,elementContainer)
{
	getAXAH(url,elementContainer,0);
}

function getAXAH(url,elementContainer, fadingTime){
    var theHttpRequest = getNewHttpObject();
    theHttpRequest.onreadystatechange = function() {processAXAH(elementContainer);};
    theHttpRequest.open("GET", url);
    theHttpRequest.send(false);

        function processAXAH(elementContainer){
           if (theHttpRequest.readyState == 4) {
               if ( (theHttpRequest.status == 200) || (theHttpRequest.statusText == "OK") ) {
                   document.getElementById(elementContainer).innerHTML = theHttpRequest.responseText;
               } else {
                   //document.getElementById(elementContainer).innerHTML="<span style='color:gray;'>Error!<\/span> HTTP request return the following status message: " + theHttpRequest.statusText + " " + theHttpRequest.status +"<\/span>";
               }
			   document.getElementById(elementContainer).style.display="block";			   
           }
        }
}

function getNewHttpObject() {
    var objType = false;
    try {
        objType = new ActiveXObject('Msxml2.XMLHTTP');
    } catch(e) {
        try {
            objType = new ActiveXObject('Microsoft.XMLHTTP');
        } catch(e) {
            objType = new XMLHttpRequest();
        }
    }
    return objType;
}

function GetRandom( min, max )
{
	return( min + parseInt( Math.random() * ( max-min+1 ) ) );
}

var lastBanner=GetRandom(1,5);

function changeBanners()
{
	if (document.getElementById("banner_div")!=null)
	{
		lastBanner++;
		if (lastBanner>5)
		{
			lastBanner=1;
		}

		getAXAH("/layout/extra/banner/banner"+lastBanner+".html","banner_div");

		window.setTimeout("changeBanners()",15000);
	}
}

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

function postLoad()
{
	// Banner anzeigen:
	changeBanners();

				   
	// Post-Load
	getAXAH("/layout/extra/postload1.html","links_platzhalter1");
	getAXAH("/layout/extra/postload2.html","links_platzhalter2");
	
	var thawtheSSL=document.getElementById("thawthe_ssl");
	if (thawtheSSL)
	{
		thawtheSSL.innerHTML="<iframe src='/layout/extra/thawthe.html' style='border:0px;width:100px;height:100px;'></iframe>";
	}

	if (document.getElementById("specialoffers"))
	{
		ladeangebot();
	}
	
	// Ecke:
	try
	{  
		var winWidth=window.innerWidth;
		if (winWidth>990)
		{
			writeObjects();
		}
	}
	catch(err)
	{
		// 
	}
	
	try 
	{
		var pageTracker = _gat._getTracker("UA-2859645-1");
		pageTracker._trackPageview();
	} 
	catch(err)
	{
		//
	}
}
