// -------------------------------------------------------------------
// Image Thumbnail Viewer Script- By Dynamic Drive, available at: http://www.dynamicdrive.com
// Last updated: July 7th, 2008- Fixed enlarged image not showing in IE sometimes
// -------------------------------------------------------------------

var loginbox={
enableTitle: true, //Should "title" attribute of link be used as description?
enableAnimation: true, //Enable fading animation?
definefooter: '<div class="footerbar" onClick="loginbox.closeit()" style="background: url('+websiteURL+'images/news.pop.header.jpg) no-repeat;">X</div>', //Define HTML for footer interface
defineLoading: '<div align="center"><img src="'+websiteURL+'images/loading.gif" width="220" /><br /> Se incarca...</div>', //Define HTML for "loading" div

/////////////No need to edit beyond here/////////////////////////

scrollbarwidth: 16,
createloginBox:function(){
//write out HTML for Image Thumbnail Viewer plus loading div
newsHTML = '\
<div align="center" style="height:200px;">\
    <div class="pop_form">\
        <form method="post" action="' + login_url + '#comentarii" name="login" onsubmit="return validate_form(\'login\');">\
            <input type="hidden" name="goLogin" value="1" />\
            <input type="hidden" name="redirect" value="" />\
            <table border="0" cellpadding="0" cellspacing="0" class="user_form padding_4" width="210">\
            <tr>\
                <td align="left"><h2>Autentificare</h2></td>\
            </tr>\
            <tr>\
                <td style="padding-top: 0; padding-bottom: 0;"><div class="error" id="login_err"></div></td>\
            </tr>\
            <tr>\
                <td align="left">\
                    <label for="login_email" id="label_login_email">E-mail</label><br />\
                    <input id="login_email" name="login_email" type="text" class="user_input" title="Introduceti email-ul!" />\
                </td>\
            </tr>\
            <tr>\
                <td align="left">\
                    <label for="login_pass" id="label_login_pass">Parola</label><br />\
                    <input id="login_pass" name="login_pass" type="password" class="user_input" title="Introduceti parola!" />\
                </td>\
            </tr>\
            <tr>\
                <td align="left"><a class="user_link" href="' + websiteURL + 'user/recuperare_parola">Am uitat parola</a></td>\
            </tr>\
            <tr>\
                <td align="left">\
                    <input id="login_submit" class="user_submit hand" type="submit" value="Autentificare" />\
                </td>\
            </tr>\
            </table>\
        </form>\
    </div>\
</div>';
            
document.write('<div id="loginForm">'+this.definefooter+newsHTML+'</div>')
document.write('<div id="loginLoading">'+this.defineLoading+'</div>')
this.loginBox=document.getElementById("loginForm")
this.loginLoading=document.getElementById("loginLoading") //Reference "loading" div that will be shown while image is fetched
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
},


centerDiv:function(divobj){ //Centers a div element on the page
var ie=document.all && !window.opera
var dom=document.getElementById
var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.scrollbarwidth
var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight //Full scroll height of document
var objwidth=divobj.offsetWidth //width of div element
var objheight=divobj.offsetHeight //height of div element
var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" //Vertical position of div element: Either centered, or if element height larger than viewpoint height, 10px from top of viewpoint
divobj.style.left=docwidth/2-objwidth/2+"px" //Center div element horizontally
divobj.style.top=Math.floor(parseInt(topposition))+"px"
divobj.style.visibility="visible"
},

showloginBox:function(){ //Show ThumbBox div
loginbox.loginLoading.style.visibility="hidden" //Hide "loading" div
this.centerDiv(this.loginBox)
//document.getElementById('login_user2').focus();
},


loadimage:function(link){ //Load image function that gets attached to each link on the page with rel="thumbnail"
if (this.loginBox.style.visibility=="visible") //if thumbox is visible on the page already
this.closeit() //Hide it first (not doing so causes triggers some positioning bug in Firefox
this.centerDiv(this.loginLoading) //Center and display "loading" div while we set up the image to be shown
setTimeout("loginbox.showloginBox()",1000);
},

closeit:function(){ //Close "thumbbox" div function
this.loginBox.style.visibility="hidden"
this.loginBox.style.left="-2000px"
this.loginBox.style.top="-2000px"
},

cleanup:function(){ //Clean up routine on page unload
this.loginLoading=null
this.loginBox=null
},

dotask:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

}

loginbox.createloginBox() //Output HTML for the image thumbnail viewer
loginbox.dotask(window, function(){loginbox.cleanup()}, "unload")
