/* $Id: funcs.js,v 1.16.2.18 2008-06-26 08:14:50 bnoordhuis Exp $ */
var bMacMSIE = ((navigator.appVersion.indexOf('MSIE 5') > 0) &&
                (navigator.appVersion.indexOf('Mac') > 0));

// Global variable container
var M_oGlobal = new Object();
M_oGlobal.oWinPop = new Array(); // list of popup window handles
M_oGlobal.oImgs = new Object();  // list of pre-loaded images

function M_quickLinks(oMenu) {
    var idx = oMenu.selectedIndex;
    if (! idx) return;
    oMenu.selectedIndex = 0;
    if (oMenu.options[idx].text.indexOf('---') == 0) return;
    var base = document.getElementsByTagName('base');
    base = (base.length) ? base[0].href.replace(/http:\/\/([^\/]+).*/, 'http://$1') : '';
    M_xRef(base + oMenu.options[idx].value, "ql"); // record clickIn event
};

// normalize search query
function M_searchBox(fm) {
    var s = fm.elements['q'].value;
    s = s.replace(/^\s+/, '').replace(/\s+$/, '').replace(/\s{2,}/g, ' ');
    fm.elements['q'].value = s;
    if (s == '') {
        window.alert('Geeft eerst een zoekopdracht...');
        fm.elements['q'].focus();
        return false;
    }
    return true;
};

function M_searchAction(sel) {
    var fm = sel.form;
    var ac = sel.options[sel.selectedIndex].value;
    fm.action = fm.action.replace(/[^\/]+$/, ac);
};

/** popup window launcher.
* Close a window by the same name before opening a new one.
* Includes some trickery for Mac MSIE 5.x
* @param String url; the location to load
* @param int w, h; the width and height in pixels, of the inner area of the popup window.
* @param Boolean scroll; if true, enables scrollbar widgets on the popup window, 
*        when the content is larger than the area defined by w, h
* @param String strName; the window.name property (default <code>nl_homepopup</code>)
*
* Limitations:<br/>
* Javascript is not able to track the windows by name, so we can not close open windows
* after the main browser window has been refreshed or navigated away (that is,
* after the popup's window object gets lost).
*
* <p>Example:
* <code>&lt;a href="javascript:void(0);" 
* onclick="M_popUp('video.ram', 400, 350, false, 'nl_homevideo');"&gt;</code>
* </p>
*
*/
function M_popUp(url, w, h, scroll, strName) {
    if (! strName) strName = 'nl_homepopup';
    if (bMacMSIE) {
        w += 28;
        h += 10;
    }
    var leftPos = (screen.width && screen.width > w) ? (screen.width - w)/2 : 0; 
    var topPos = (screen.height && screen.height > h) ? (screen.height - h)/2 : 0; 
    try {
        if (M_oGlobal.oWinPop[strName]) M_oGlobal.oWinPop[strName].close();
    }
    catch (e) {
        // window.alert('Exception ' + e.name + ': ' + e.message + ' ' + e.toString());
    };
    var props = 'width=' + w + ',height=' + h + ',scrollbars=';
    props += ((scroll) ? 'yes' : 'no');
    props += ',left=' + leftPos + ',top=' + topPos;
    M_oGlobal.oWinPop[strName] = window.open(url, strName, props);
    M_oGlobal.oWinPop[strName].focus();
};

/** 
* Displays message on window status bar. Typically assigned to a 
* <code>onmouseover</code> handler on a link.
* If the second parameters is passed, set the <code>onmouseout</code>
* handler to clear the status message again.
* <p>Example:
* <code>&lt;a onmouseover="return M_rollOver('Mesage text', this)" ...&gt;</code>
* </p>
* @param String strMsg, literal message text
* @param Object oElt, (optional) the link element on which the onmouseover handler is set
* @return Boolean true
*/
function M_rollOver(strMsg, oElt) {
    try {
        if (typeof(oElt) == "object") {
            if (! oElt.onmouseout) oElt.onmouseout = function() { window.status = ""; };
        }
        window.status = strMsg;
    }
    catch (e) {
        // fail silently
    };
    return true;
};

/**
* Sets the name property of the current window.
* @param String strName (only used if not empty)
* @return String the current window name.
*/
function M_winName(strName) {
    if (strName) window.name = strName;
    return window.name;
};

/**
* Sets the current window name to <code>nl_homecontent</code>.
* Intended for the main portal pages.
* @param String strName (only used if not empty)
*/
function M_homeInit() {
  M_winName('nl_homecontent');
};

/**
* Focus the window.
*/
function M_homeExit() {
    window.focus();
};

/**
* appends javascript code to the window.onload handling function.
* This allows one to override existing onload functionality or 
* to append extra functionality to an existing eventhandler.
* @param String strCode; javascript code.
* <p>Example
* <code>M_appendOnLoad('M_winName("unique_name")');</code>
* This executes all previously defined onload functionality and finally calls 
* <code>M_winName()</code>, overriding the effects of a possible earlier call.
*</p>
*/
function M_appendOnLoad(strCode) {
    if (window.onload) {
        var str = (window.onload).toString();
        if (str.indexOf('function') < 5) {
            var l = str.indexOf('{');
            var r = str.lastIndexOf('}');
            str = str.substring(l+1, r);
        }
        str += ';' + strCode;
        window.onload = new Function('', str);
    } else {
        window.onload = new Function('', strCode);
    }
};

/**
* Pre-load an image to the browser cache by creating a new Image object and
* assigning the desired URL to it's source attribute.
*
*<p>Example:
* <code>M_imgPreload("/hi/but.jpg");</code>
*</p>
*/
function M_imgPreload(src) {
    if (typeof(M_oGlobal.oImgs[src]) == null) return;
    M_oGlobal.oImgs[src] = new Image();
    M_oGlobal.oImgs[src].src = src;
};

/**
* Mimic button behaviour by dynamic source swapping on mouse events.
* This function should be called from an image's onload event.
* It creates two additional methods which are hooked to the onmouseover
* and onmouseout events respectively.
*
*<p>Prerequisites: image swapping is based on similar source attributes,
* with only one distinct path component - /hi/ and /lo/ respectively.
* <br/>
* The initial image denotes a button's neutral state and must have an URL like
* <pre>..../lo/imagename.jpg.</pre>
* The pending state counterpart must have an URL like
* <pre>..../hi/imagename.jpg.</pre>
* The pending state image is pre-loaded by calling M_imgPreload().
*</p>
*<p>Example:
* <code>&lt;img src="/lo/but.jpg" onload="M_enableButton(this);" /&gt;</code>
*</p>
*/
function M_enableButton(image) {
    image.onload = function() { };
    M_imgPreload( image.src.replace(/\/lo[\/]/, '/hi/') );
    image.onmouseover = function() { this.src = this.src.replace(/\/lo[\/]/, '/hi/'); };
    image.onmouseout = function() { this.src = this.src.replace(/\/hi[\/]/, '/lo/'); };
};

var M_monthNames = new Array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december');

function M_debug(strMsg, ex) {
    msg = ((strMsg)?strMsg+"\n":"");
    if (ex) {
        msg += "Exception: "+((ex.message)?ex.message:ex.toString());
    };
    // var dummy = new Image();
    // dummy.src = "http://www.home.nl/JS_ERROR/"+escape(msg);
};

/**
 * Constants specify logging level for page view logging functions
 *
 */
var M_NEVER = 0;
var M_ADHOC = 1;
var M_ALWAYS = 2;

/**
* Record a click-in/out event for a new location (URL),
* optionally navigating to this new location.
* Use the redirect option only if the new location is to be opened in the same window.
*
* @param String url; location to navigate to
* @param Boolean redirect; record a hit only (false) or navigate there (true)
* @param String displayUrl; use this for logging purposes
*/
// depends on obdefs.js and initialized M_pageView object in variable M_oPV
// single arg. version in games channel, left menu
function M_clickLog(url, redirect, displayUrl) {
    var oCO = new M_Click();
    if (typeof(M_oPV) == "object") oCO.setPath(M_oPV.getPath());
    oCO.setClickTo(url);
    // oCO.debug = true; // DEBUGGING
    displayUrl && oCO.setLogUrl(displayUrl);
    (redirect) ? oCO.redirect() :  oCO.pageView();
};

/**
* Navigate to a new location (URL), optionally logging it as a click-out event.
* The last parameter loads the new URL in the current window if true, otherwise a 
* specific other window (named nl_homegateway) is used. This window is raised to
* the top as soon as the URL is assigned.
* @return Boolean false - this function always returns false as a convenience
* when calling it from an onclick event.
*
* @param String URL, the location of the document to load
* @param int logging level (optional, default: no logging)
* @param Boolean keepInside (optional) if true, don't open the gateway window,
* but rather recycle the current window.
* @param String displayUrl (optional), a different url to use for logging purposes only
*
* <p>Loggin levels (Constants defined elsewhere)
* <ul>
*   <li>M_NEVER (false or undefined): never record the event
*   <li>M_ADHOC: assigned TRUE or FALSE on an ad-hoc basis in this javascript library</li>
*   <li>M_ALWAYS: always record the clickout event.</li>
*  </ul></p>
*/
// depends on obdefs.js and initialized M_pageView object in variable M_oPV
function M_goLoc(url, logging, keepInside, displayUrl) {
    if (! url) return true;
    var oCO = new M_Click();
    if (typeof(M_oPV) == "object") oCO.setPath(M_oPV.getPath());
    // oCO.debug = true; // DEBUGGING
    oCO.setClickTo(url);
    oCO.setLogging(logging && parseInt(logging) > M_ADHOC);
    displayUrl && oCO.setLogUrl(displayUrl);
    (keepInside) ? oCO.redirect() : oCO.openWin();
    return false;
};

/**
* Navigate to a new location (URL) and record a "click in" for this event.
* This is typically used to track clicks on specific links within the site.
*
* <p>Example:
* <code>&lt;a href="/path/page.html" onclick="return M_xRef(this.href, 'home/teaser_2');"&gt;</code>
* </p>
*
* @return Boolean false - this function always returns false as a convenience
* when calling it from an onclick event.
*
* @param String URL, the location of the document to load
* @param String tag, a symbolic name to identify the measured click
*/
// depends on obdefs.js and initialized M_pageView object in variable M_oPV
function M_xRef(url, tag) {
    if (! url) return true;
    var oCO = new M_Click();
    if (typeof(M_oPV) == "object") oCO.setPath(M_oPV.getPath());
    // oCO.debug = true; // DEBUGGING
    oCO.setClickTo(url);
    oCO.setPrefix("clickin"); // see M_pageView documentation
    oCO.setClickTag(tag); // see M_pageView documentation
    oCO.redirect();
    return false;
};


/**
* Record a page view event through a logging service.
* The optional parameter URL can be used to distinguish the event from the current page;
* if this parameter is omitted, the current page will be used.
* 
* @param String strUrl; the url of the page to be logged;
* relative urls are calculated as expected.
*/
// depends on obdefs.js and initialized M_pageView object in variable M_oPV
// single arg. version in flash applet Weather NL/Europe
function M_pingLog(strUrl, dummy, dummy) {
    if (! strUrl) strUrl = window.location.href;
    var oPV = new M_PageView();
    if (typeof(M_oPV) == "object") oPV.setPath(M_oPV.getPath());
    // oPV.debug = true; // DEBUGGING
    oPV.updatePath(strUrl);
    oPV.pageView();
};

/**
* Record a page view without actually redirecting a user to a new page
*/
function M_xRef_pingLog(url, tag) {
    if (! url) return true;
    var oCO = new M_Click();
    if (typeof(M_oPV) == "object") oCO.setPath(M_oPV.getPath());
    oCO.setClickTo(url);
    oCO.setPrefix("clickin"); // see M_pageView documentation
    oCO.setClickTag(tag); // see M_pageView documentation
    oCO.pageView();
    return false;
};

// default implementation of ftv function
// should be overridden when http://www.ftv.nl/ftvpopup.js is included on a page
function ftvlaunch(video,quality,pid) {
    LeftPosition = (screen.width) ? (screen.width-665)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-430)/2 : 0;
    popwin = window.open('http://www.ftv.nl/videoplayer/index.cfm?id='+video+'&mode=normal&quality='+ quality +'&pid='+ pid,'MTV6_window','toolbar=no,width=665,height=430,top='+TopPosition+',left='+LeftPosition+',directories=no,status=no,scrollbars=yes,resizable=no,menubar=no');
    popwin.focus();
};


// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
function addEvent(elm, evType, fn, useCapture) {
    if (elm.addEventListener) {
        elm.addEventListener(evType, fn, useCapture);
        return true;
    }
    else if (elm.attachEvent) {
        var r = elm.attachEvent('on' + evType, fn);
        return r;
    }
    else {
        elm['on' + evType] = fn;
    }
}

function getEventEl(e) {
    var el;
    if (window.event && window.event.srcElement)
        el = window.event.srcElement;
    if (e && e.target)
        el = e.target;
    return el;
}

function getEventTo(e) {
    var el;
    if (window.event && window.event.toElement)
        el = window.event.toElement;
    if (e && e.relatedTarget)
        el = e.relatedTarget;
    return el;
}

// class name functions
function addClassName(el,c){
  if(!checkClassName(el,c)){el.className+=el.className?" "+c:c;}
}

function swapClassName(el,c1,c2){
  el.className=!checkClassName(el,c1)?el.className.replace(c2,c1): el.className.replace(c1,c2);
}

function removeClassName(el,c){
	if( el)
	{
  var cr=el.className.match(" "+c)?" "+c:c;
  el.className=el.className.replace(cr, "");
	}
}

function checkClassName(el,c){
  return new RegExp("\\b"+c+"\\b").test(el.className);
}

// tab navigation
var activeTab;
var hoverTab;
var hoverTabParent;
var activeSub;
var tabTimer;
var tabDelay=100;

function addTabNavListeners(nav, hasSub) {
  var navRoot = document.getElementById(nav);
  var picRoot = document.getElementById('header');
  if (!navRoot) return;
  for (i=0; i<navRoot.childNodes.length; i++) {
    var node = navRoot.childNodes[i];
    if (node.tagName=="LI") {
      addEvent(node, 'mouseover', delayTabOver, false);
      if (checkClassName(node,"active")){
        activeTab=node;
        document.getElementById(node.getElementsByTagName('A')[0].id+'_pic').style.top = '74px';
      }
    }
  }
  /*var kids = picRoot.getElementsByTagName('DIV');
  for (x=0; x<kids.length; x++) {
    if (kids[x].className == 'bigbutton') {
      addEvent(node, 'mouseout', delayTabOut, false);
    }
  }*/
  if (activeTab){
    activeSub = activeTab.getElementsByTagName("UL")[0];
  }
}

function delayTabOver(e){
  clearTimeout(tabTimer);
  var tab=getTab(e);
  if (tab!=hoverTab)tabTimer = setTimeout(function() {tabOver(tab);}, tabDelay);
}

function delayTabOut(e){
  clearTimeout(tabTimer);
  //var to = getEventTo(e);
  tabTimer = setTimeout(function() {restoreTabs();}, tabDelay);
}

function tabOver(tab) {
  var picid = tab.lang;
  var activepicid = activeTab ? activeTab.lang : null;
  if (hoverTab && hoverTab!=tab){
    removeClassName(hoverTab,"hover");
    var hoverpicid = hoverTab.lang;
    document.getElementById(hoverpicid+'_pic').style.top ='-100px';
    hoverTab=null;
  }
  if (tab!=hoverTab && tab!=activeTab){
    hoverTab = tab;
    var hoverpicid = hoverTab.getElementsByTagName('A')[0].id;
    hoverTabParent = tab.parentNode;
    document.getElementById(picid+'_pic').style.top = '74px';
    addClassName(tab,"hover");
    //removeClassName(activeTab, 'active');
    if (activeSub) activeSub.style.display="none";
    if (activepicid) document.getElementById(activepicid+'_pic').style.top = '-100px';
  }
  if (tab==activeTab && activeSub){
    document.getElementById(picid+'_pic').style.top = '74px';
    if (activepicid) document.getElementById(activepicid+'_pic').style.top = '-100px';
    activeSub.style.display="block";
  }
  if (tab==activeTab) {
    document.getElementById(picid+'_pic').style.top = '74px';
    addClassName(activeTab, "active");
  }  
}

function restoreTabs(to){
 // alert('hoverTab?'+hoverTab+'_activeTab'+activeTab);
  try {
	var activepicid = activeTab.getElementsByTagName('A')[0].id;
	}
	catch(e) {};
  //if (!inTabArea(to)){
  if (hoverTab){
    var hoverpicid = hoverTab.getElementsByTagName('A')[0].id;
    removeClassName(hoverTab,"hover");
    document.getElementById(hoverpicid+'_pic').style.top = '-100px';
  }
  if (activeTab) {
    addClassName(activeTab, "active");
    document.getElementById(activepicid+'_pic').style.top = '74px';
  }
  if (activeSub) {
    activeSub.style.display="block";
  }
  hoverTab=null;
  //}
}




function getTab(e){
  var tab;
  var node=getEventEl(e);
  while (!(node.id&&node.id=="navmain")){
    if(node.tagName=="LI"){tab=node;}
    node = node.parentNode;
  }
  return tab;
}

function inTabArea(el){
  var inTabArea=0;
  if (!el)return false;
  var node=el;
  while (node.parentNode){
    if(node==hoverTabParent){inTabArea=1;break;}
    node = node.parentNode;
  }
  return inTabArea;
}

function initTabs(){
   addTabNavListeners("nav");
}

addEvent(window, 'load', initTabs, false);

// reposition the body
function rePosition( min_screen_width) 
{
    var w = 0;
    if (document.compatMode && document.compatMode != "BackCompat") {
        w = document.documentElement.clientWidth;
    } else {
        w = document.body.clientWidth;
    }

    if( w >= min_screen_width)
    {
        document.getElementsByTagName("body")[0].style.textAlign = "left";
	var pg = document.getElementById("page");
	w = Math.round((w - 782 - 120)/2);
	pg.style.marginLeft = ((w > 0) ? w : 0) + "px";
	pg.style.position = "relative";
    }
}


function getElementsByClass(elem, classname) {
    // find all elements of a given class
    classes = new Array();
    alltags = document.getElementsByTagName(elem);
    for (i=0; i<alltags.length; i++)
        if (alltags[i].className == classname)
            classes[classes.length] = alltags[i];
    return classes;
}

function HideIfTooNarrow( div_class, min_screen_width)
{
    var width;
    if (document.compatMode && document.compatMode != "BackCompat") {
        width = document.documentElement.clientWidth;
    } else {
       width = document.body.clientWidth;
    } 

    if( width < min_screen_width)
    {
	// find the requested div
	var aryElem = getElementsByClass( "div", div_class);
	for( i=0; i<aryElem.length;i++)
	{
		var theDiv = aryElem[i];
		theDiv.style.display="none";
	}
    }
}

// does opposite of HideIfTooNarrow, for body.onresize events
function ShowIfLarge( div_class, min_screen_width)
{
    var width;
    if (document.compatMode && document.compatMode != "BackCompat") {
        width = document.documentElement.clientWidth;
    } else {
       width = document.body.clientWidth;
    } 

    if( width >= min_screen_width)
    {
	// find the requested div
	var aryElem = getElementsByClass( "div", div_class);
	for( i=0; i<aryElem.length;i++)
	{
		var theDiv = aryElem[i];
		theDiv.style.display="block";
	}
    }
}

function do_hide_and_repos()
{
  rePosition(920);
  HideIfTooNarrow("ad_skyscraper_side", '920');
  ShowIfLarge("ad_skyscraper_side", '920');
}

function showPopup(e,id){
  var pop = document.getElementById(id);
  var pop_clone;
  if (pop.getAttribute('clone') == 'yes') {
    pop_clone = pop;
  }
  else {
    var popTekst = pop.innerHTML;
    var pop_clone = pop.cloneNode(true);
    var pa = pop.parentNode;
    pa.removeChild(pop);
    document.body.appendChild(pop_clone);
    pop_clone.setAttribute('clone','yes');
    var boven = '<div class="mod_popup"><div class="top"><div class="cnt"><div class="knop" onclick="resetPopup(event)">&#160;</div></div></div><div class="middle"><div class="cnt">';
    var onder = '</div></div><div class="bottom"><div class="cnt">&#160;</div></div></div>'
    pop_clone.innerHTML = boven+popTekst+onder;
  }
  var xMuis = mouseX(e);
  var yMuis = mouseY(e);
  var bodyW = document.body.clientWidth;
  pop_clone.style.display='block';
  var pHeight = pop_clone.clientHeight;
  var pTop = parseInt(yMuis) - parseInt(pHeight);
  if (pTop < 20) pTop = 20;
  var pLeft = parseInt(xMuis);
  if (xMuis + 640 > bodyW) pLeft = bodyW - 640;
  pop_clone.style.top = pTop+'px';
  pop_clone.style.left = pLeft+'px';
}

function resetPopup(e) {
  var obj;
  if (e.target) obj = e.target;
  else obj = window.event.srcElement;
  pId = obj.parentNode.parentNode.parentNode.parentNode.id;
  document.getElementById(pId).style.display = 'none';
  /*var html = obj.parentNode.parentNode.nextSibling.firstChild.innerHTML;
  document.getElementById(pId).innerHTML = html;
  document.getElementById(pId).style.display = "none"; */
}

function mouseX(evt) {
  if (evt.pageX) return evt.pageX;
  else if (evt.clientX)
  return evt.clientX + (document.documentElement.scrollLeft ?
  document.documentElement.scrollLeft :
  document.body.scrollLeft);
  else return null;
}

function mouseY(evt) {
  if (evt.pageY) return evt.pageY;
  else if (evt.clientY)
  return evt.clientY + (document.documentElement.scrollTop ?
  document.documentElement.scrollTop :
  document.body.scrollTop);
  else return null;
}

function setFAQ(o) {
  if (o.className == 'dicht') o.className = 'open';
  else o.className = 'dicht';
}

function setFocusNaarEersteVeld() {
     var isSet = -1;
     if (document.forms.length>0) {
            //alert('total <form> elements in page:\n' + document.forms.length);
            for (j=0;j<document.forms.length;j++) {
                if (isSet == 1) { 
                  //alert('isSet is set to true, so whe where able to set a focus on a form element');
                  break; 
                }
                //alert('entering the ' + (j+1) + 'th form');
                var field= document.forms[j];
                //alert('field length is ' + field.length);
                if (field.length <= 0) { return false; }
                //alert(field.length);
                
		for (i=0;i<field.length;i++) {
                     if ((field.elements[i].type=="text")||
                         (field.elements[i].type=="textarea")||
                         (field.elements[i].type=="checkbox")||
                         (field.elements[i].type=="radio")) {
                              //alert('field ' + (i+1) + ' is of type: ' + field.elements[i].type);
                              var isVisible = 1;
                              try{
                                    //alert('trying to set the focus on!!\nelement name = ' + field.elements[i].name + '\nelement value = ' + field.elements[i].value);
                                    field.elements[i].focus();
                              }
                              catch(e){
                                    //alert('failure to communicate!!\n' + e.message + '\n' + e.name);
                                    isVisible = -1;
                              }
                              if (isVisible == 1) {
                                      //alert('elements name to set the focus on:\n' + field.elements[i].name);
                                      isSet = 1;
                                      break;
                              }
                      }
                }
            }
    }
}
//Event.observe(window, 'load', function() {                                                                          
//    Sortable.create('landingspagina', {tag: 'div', constraint: '', onStart: showBreaks});
//});  
function showBreaks() {
    alert('started');
    $$('.break').each(function(_br) {
        _br.style.backgroundColor = '#000';
    });
}

function kleurenkiezer(radios) {
	var styleSheet = 0;
	for (var radio, i = 0; radio = radios[i]; ++i) {
		if (radio.checked) {
			styleSheet = radio.value;
			break;
		}
	}
	var tellers = ['random','cyaan','magenta','groen','oranje','turquoise'];
	ath_softclick({a:{}, name:'kleurenkiezer/' + tellers[styleSheet], type:'noredirectinsite'});
	var expires;
	if (styleSheet != 0) {
		expires = (new Date(2036, 1, 1)).toUTCString();
	} else {
		styleSheet = 1 + Math.floor(4 * Math.random());
	}
	var cookie = "styleSheet=" + styleSheet + "; path=/; domain=.ziggo.nl";
	if (expires) {
		cookie += "; expires=" + expires;
	}
	document.cookie = cookie;
	window.location.reload(true);
}

function showEro(s) {
	var index = document.cookie.indexOf('Filter');
	if (index < 0 || !(parseInt(document.cookie.charAt(index + 7 /* 'Filter='.length */) & 2))) {
		document.write(s);
	}
}