function falk_old(id){
	var id;
	rdm=Math.random()*10000000+10000000;
	document.write('<img src="http://as1.falkag.de/sel?cmd=ban&dat='+id+'&opt=16&rdm='+rdm+'" width="1" height="1" border=0>');
}

function tradedoubler(id){
	var id;
	var leadNumber = Math.round((new Date().getTime() * Math.random())); 
	var protocol = window.location.protocol; 
	//if (protocol.indexOf(":")) {
	//	protocol = protocol.substring(0,protocol.indexOf(":"));
	//}
	document.write('<img src=http://tbl.tradedoubler.com/report?organization=394991&event='+id+'&leadNumber=' + leadNumber + ' height=1 width=1 border=0>'); 
}

function tradedoubler_sale(id){
	var id;
	var orderNumber = Math.round((new Date().getTime() * Math.random())); 
	var protocol = window.location.protocol; 
		
	document.write('<img src=http://tracker.tradedoubler.com/report?organization=394991&currency=EUR&event='+id+'&orderNumber=' + orderNumber + ' height=1 width=1 border=0>'); 
	

}

function falk(intAdSpotID){
	rdm=Math.random()*10000000+10000000;
	intExpire   = -1;
	var intAdSpotID;
	Ads_doWriteUUTag(intAdSpotID, intExpire, '<img src="http://as1.falkag.de/sel?v=ban;'+intAdSpotID+';;;;;16&rdm='+rdm+'" width="1" height="1" border=0>');

}


//#################From Falk###########################
function fnSearchStrings(strLink, strString)
{
    var arrString, intIndex;
    var bolFound = false;

    if(strString != '')
    {
        arrString = strString.split(';');
        for(intIndex = 0; intIndex < arrString.length; intIndex++)
        {
            if(strLink.indexOf(arrString[intIndex].toLowerCase()) >= 0)
                bolFound = true;
        }
    }

    return bolFound;
}


////
// !Modifies all Href-Urls within the page with a specified additional Url
//
// !param   string      strAdsUrl               AdServer-Url
// !param   integer     intFlags                +1=don't modify links to another host
//                                              +2=modify links with target=_blank
//                                              +4=modify links which starts with the strBaseUrl
//                                              +8=modify links which contains the strKeyUrl (;-separated list)
//                                              +16=don't modify links which contains the strForbiddenUrl (;-separated list)
// !param   string      strBaseUrl              the Url of the link has to start with this characters
// !param   string      strKeyUrl               the Url of the link has to contain this characters
// !param   string      strForbiddenUrl         the Url of the link has not to contain this characters
//
function Ads_doLinkMod(strAdsUrl, intFlags, strBaseUrl, strKeyUrl, strForbiddenUrl)
{
    var intIndex, intIndex2, objLinks, objDocument, bolModify, bolForbidden, arrForbidden;

    objDocument = window.document;
    if((objDocument.links) && (objDocument.links[0]) && (objDocument.links[0].href))
    {
        objLinks  = objDocument.links;
        for(intIndex = 0; intIndex < objLinks.length; intIndex++)
        {
            strLink   = objLinks[intIndex].href;
            strLinkLC = strLink.toLowerCase();

            bolForbidden = fnSearchStrings(strLinkLC, strForbiddenUrl);
            bolAllowed   = fnSearchStrings(strLinkLC, strKeyUrl);

            bolModify = (((intFlags & 4) && (strLinkLC.indexOf(strBaseUrl.toLowerCase()) == 0))
                      || ((intFlags & 8) && (bolAllowed)));

            bolModify = bolModify && ((intFlags & 2)   || (objLinks[intIndex].target.toLowerCase() != '_blank'))
                                  && (!(intFlags & 16) || !bolForbidden)
                                  && (!(intFlags & 1)  || (strLinkLC.indexOf(window.location.host.toLowerCase()) != -1))
                                  && ((strLinkLC.indexOf('#')           == -1)
                                  &&  (strLinkLC.indexOf('javascript:') == -1)
                                  &&  (strLinkLC.indexOf('mailto:')     == -1));

            if(bolModify)
                objLinks[intIndex].href = strAdsUrl + escape(strLink);
        }
    }
}


////
// !Generates the Expire-String for a Cookie
//
// !param   integer     intMinutes              Number of Minutes (-1=Browser-Session)
//
// !returns string                              Expire-String
//
function Ads_fnExpire(intMinutes)
{
    if(intMinutes == -1)
        return '; path=/';

    var dblDatum = new Date();
    dblDatum.setTime(parseInt(dblDatum.getTime(), 10) + 1000 * 60 * parseInt(intMinutes, 10));
    return '; path=/; expires=' + dblDatum.toGMTString();
}


////
// !Writes a Tag only when the user is unique on this spot
//
// !param   integer     intSpotID               ID of the current Spot
// !param   integer     intExpire               Expire-Duration of the Cookie in Minutes (0=browser-session)
// !param   string      strTag                  Tagcode
//
function Ads_doWriteUUTag(intSpotID, intExpire, strTag)
{
    var intIndex, arrCookie, strName, strWert;
    var strCookie  = document.cookie;
    
    if(strCookie.indexOf('IID' + intSpotID + '=1') == -1)
    {
        document.cookie = 'IID' + intSpotID + '=1' + Ads_fnExpire(intExpire);
        document.write(strTag);
    }
}


//#####################################################
