/**
 * external client
 * native js , no frameworks
 * @version: 0.96
 * @rcd: 01.09.09
 * @author ps
 **/
// check backlink
function nlcheck(z){
    z++; if ( z <= 10) { window.setTimeout("nlcheck("+z+")", 101); return; }
    var x = document.getElementById('nl_check');
    if (x!=null && x.style.display != 'none') {
        if (!x.hasChildNodes()) {sayfalse(); }
            if (x.getElementsByTagName("a")[0]  == 'http://www.nettolohn.de/' ) {
                if (x.getElementsByTagName("a")[0].firstChild.innerHTML == 'nettolohn.de' ||
                    x.getElementsByTagName("a")[0].firstChild.innerHTML == 'Brutto-Netto-Rechner'
                ) { return ;}
            else { sayfalse(); }
        }else { sayfalse(); }
     }else{ sayfalse(); }
}
// resize div and iframe(index: optional fields,resultpage: bossvalues-div,inputvalues-div)
function rRIF(nl_height,nl_width,result){
    var ifr = document.getElementById("nlRCIF");
    var jsdiv = document.getElementById("__nlextern");
    var cssString = 'clear:both;'; // client floating fix
    if( typeof(jsdiv.style.cssText) == 'string' ) {
      jsdiv.style.cssText = cssString;
    }
    jsdiv.setAttribute('style',cssString);
    ifr.height = nl_height+result;
    //jsdiv.style.height = nl_height+"px";
    ifr.width = nl_width;
    jsdiv.style.width = nl_width+"px";
}
// set iframe visible after loading source and resize to fixed x/y or not
function setvisible(iF,param){ 
    iF.style.visibility = 'visible';
    if(param.type == "simple") { rRIF(1050,490,0);document.getElementById("__nlextern").style.background = "#FFFFFF"; }
}
var script = document.getElementById("__nlscript");
var queryString = (script!=null)? script.src.replace(/^[^\?]+\??/,''):'';
var params = {};
queryString.replace( new RegExp("([^?=&]+)(=([^&]*))?", "g"),function($0, $1, $2, $3) {params[$1] = $3;} );
//build options
// simple version
var nl_opt2 = new Array(); nl_opt2[0] = new Object();nl_opt2[0]["nl_client"] = "nlext_333333333";
var options = (params.type == 'simple')? nl_opt2[0] : nl_opt[0];
options["location"] = window.location.host; options["nl_ref"] = document.URL;
//build parameterstring from clientvalues-array in parentdocument
var optString = '';
for(var item in options){   optString += item+'='+encodeURIComponent(options[item])+'&'; }
// preloader during loading source of iframe nlRCIF
var jsdiv = document.getElementById("__nlextern");
var cssString = 'clear:both;'; // client floating fix
if( typeof(jsdiv.style.cssText) == 'string' ) {
  jsdiv.style.cssText = cssString;
}
jsdiv.setAttribute('style',cssString);
jsdiv.style.height = "200px";
jsdiv.style.background = "url(http://www.nettolohn.de/public/images/preloader/preloader6.gif) no-repeat center 90%";
// write iframe to document
document.write('<iframe width="0" height="0" frameborder="0" marginheight="0" marginwidth="0" visibility="hidden" scrolling="no" id="nlRCIF" name="nlRCIF" onload="setvisible(this,params);"></iframe>');
// set iframe source ,append parameterstring
document.getElementById("nlRCIF").src='http://www.nettolohn.de/api/iframe.php?'+optString.substring(0,(optString.length-1));
nlcheck(0);function sayfalse(){ rRIF(200,490,0);document.getElementById("nlRCIF").src = 'http://www.nettolohn.de/api/iframeerror.html';}
