/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function RP_setButton(elementId, lang, hotelId){
    var button = document.getElementById(elementId);

    button.onclick = function (){
       
        var clientWidth  = document.body.clientWidth-200;
        var clientHeight = document.body.clientHeight-80;
        if (parseInt(navigator.appVersion)>3) {
            if (navigator.appName=="Netscape") {
                winW = window.innerWidth;
                clientHeight = window.innerHeight-80;
            }
            if (navigator.appName.indexOf("Microsoft")!=-1) {
                winW = document.body.offsetWidth;
                clientHeight = document.body.offsetHeight-80;
            }
        }


        clientWidth = parseInt(clientWidth);
        if (clientWidth > 900){            
            clientWidth = 900;
        }
        var time = new Date().getTime();
        var left = (document.body.clientWidth - clientWidth)/2;
        var str = '<div style="z-index:100;position: fixed;width:'+clientWidth+'px;left:'+left+'px;height:'+clientHeight+'px;top:50px;border:1px solid gray;background-color:white;">';
        str += '<div style="background-color:white;text-align: right;padding: 5px 15px 5px 5px;"><a href="#8" onclick="RP_close(\'reserv\')"><img border="0" src="http://rezervacijos.reservationpartner.lt/img/close_button.gif" /></a></div>';
        str += '<iframe style="border:none;" border="0" width="'+clientWidth+'px" height="'+(clientHeight-30)+'px" src="http://rezervacijos.reservationpartner.lt/index.php?mode=search&param2=query&lang='+lang+'&hotel_id='+hotelId+'&t='+time+'&currency=LTL"></iframe>';
        str += '</div>';

        var newdiv = document.createElement('div');
        var divIdName = 'reserv';
        newdiv.setAttribute('id',divIdName);
        newdiv.innerHTML = str;
        document.body.appendChild(newdiv);
        
        return false;
    };
}

function RP_close(id){
    document.body.removeChild(document.getElementById(id));
}

