﻿function postComment(eventID){
    var w = 335;
    var h = 300;
    var comment = document.getElementById('eventComment').value;
    document.getElementById('postCommentButton').style.display = 'none';
    comment = comment.replace(/\n/g,'|~|');
    var s = new sack();
    var addToURL = 'piece=posteventcomment&id='+eventID+'&comment='+comment
	s.requestFile = '/pieces.aspx';
	s.method = "POST";
	s.element = 'eventCommentWrapper';
	s.w = w;
	s.h = h;
	s.runAJAX(addToURL);
}

function lbi(t, u, w, h){
    if (w==''){w='400'}
    if (h==''){h='500'}
    if(t == 'on'){
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else {
			if( document.documentElement &&
				( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			  myWidth = document.documentElement.clientWidth;
			  myHeight = document.documentElement.clientHeight;
			} else {
			  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			  }
			}
		}
		
		myWidth = (myWidth - w) / 2
		myHeight = (myHeight - h) / 2
		
		var arrayPageSize = getPageSize();
	    var arrayPageScroll = getPageScroll();
	    
	    var objBlockUI = document.getElementById('BlockUI');
	    var objLbMain = document.getElementById('lbMain');
		
		objBlockUI.style.height = (arrayPageSize[1] + 'px');
        objBlockUI.style.display = 'block';
        
        
		objLbMain.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - h) / 2) + 'px');
		            
		objLbMain.style.width = w+'px';
		objLbMain.style.height = h+'px';
		objLbMain.style.left = myWidth+'px';
		objLbMain.style.display = 'block';
	
		var toPut = document.getElementById('lbContent')
		toPut.innerHTML='<a href="#lsRet" onclick="lb(\'off\');"><img src="'+u+'" alt="Photo" /></a>';
    }
}
