//(c) by philipp staender

loadJQueryLibrary = function() {
    loadJQueryLibrary.getScript("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
    // do stuff when jQuery finishes loading.
    loadJQueryLibrary.tryReady(0);
}

campaignProject = function(left,top,right,bottom) {
	var style = "display:none;position:absolute;z-index:100;";
	var dontReferToPage;
	if (right) style = style + "right:"+right+"px;";
	else {
		if (!left) left = 20;
		style = style + "left:"+left+"px;";
	}
	if (bottom) style = style + "bottom:"+bottom+"px;";
	else {
		if (!top) top = 20;
		style = style + "top:"+top+"px;";
	}
	if (styleCampaignForCSS) style = "";
	var imageURL = "http://www.b-p-p.info/assets/extern/girlfriendsshooting/GirlsFriendsShootingInternet.jpg";
	if (right) style = style + "right:"+right+"px;";
	var htmlContent = '<div id="bppCampaignBannerGFS" style="'+style+'"><div id="bppCampaignClose" style="position: absolute;top:10px;right:10px;background:#000;font-size:12px;font-family:arial; font-weight:bold;padding: 5px 8px;z-index:200;"><a href="javascript:void();" style="color:#fff;text-decoration:none;">x</a></div><img src="'+imageURL+'" border="0" /></div>';
	$("body").append(htmlContent);
	$("#bppCampaignBannerGFS").fadeTo(500,1.0);
	$("#bppCampaignClose").bind('click',function() {
		$("#bppCampaignBannerGFS").fadeTo(300,0, function() {
			$("#bppCampaignBannerGFS").css('display','none');
		});
		dontReferToPage = true;
		});
	$("#bppCampaignBannerGFS").bind('click',function() {
			if ((linkToPage) && (!dontReferToPage)) {
				location.href=linkToPage;
			}
			else {
				$("#bppCampaignBannerGFS").fadeTo(300,0, function() {
					$("#bppCampaignBannerGFS").css('display','none');
				});
			}
	});
}

loadJQueryLibrary.getScript = function(filename) {
    var fileref = document.createElement('script')
    fileref.setAttribute("type","text/javascript")
    fileref.setAttribute("src", filename)
    if (typeof fileref!="undefined")
        document.getElementsByTagName("head")[0].appendChild(fileref)
}
loadJQueryLibrary.tryReady = function(time_elapsed) {
    /* Continually polls for jQuery library. */
    if (typeof $ == "undefined") {
        if (time_elapsed <= 5000) {
            setTimeout("loadJQueryLibrary.tryReady(" + (time_elapsed + 200) + ")", 200);
        } else {
            //alert("Timed out while loading jQuery.")
						return false;
        }
    } else {
    
        // put your usual $().ready() code here!
				campaignProject();
				return true;
        
       
    }
}
