// General functions used in Componennts

arr_escape={
"ă":"%C4%83",
"Ă":"%C4%82",
"î":"%C3%AE",
"Î":"%C3%8E",
"â":"%C3%A2",
"Â":"%C3%82",
"ş":"%C5%9F",
"Ş":"%C5%9E",
"ţ":"%C5%A3",
"Ţ":"%C5%A2",
"Ţ":"%C5%A2",
"+":"%2B",
"/":"%2F"
};

function rawurlencode(str){
	var result="";
	for(var i=0;i<str.length;i++){
		var chr=str.charAt(i);
		if(arr_escape[chr]!=undefined){
			result+=arr_escape[chr];
		}else{
			result+=escape(chr);
		}
	}
	return result;
}

function rawurldecode(str){
	for(var i in arr_escape){
		str=str.replace(new RegExp(arr_escape[i],"g"),i);
	}
	return unescape(str);
}

function setAlpha(obj,value){
	if(nav==1){
		if(obj.filters.alpha){
			obj.filters.alpha.opacity=value;
		}else{
			obj.style.filter+=" alpha(opacity="+value+")";
		}
	}else{
		obj.style.opacity=value/100;
	}
}

function checkKey(evt,str){
	var e=evt ? evt : event;
	if(e.altKey || e.ctrlKey){
		return true;
	}else{
		var charCode = (evt.which) ? evt.which : event.keyCode
		var re=new RegExp("^["+str+"]$");
		return charCode<31 || re.test(chr(charCode));
	}
}

function getAbsX(obj){
	var result = 0;
	while(obj!=null){
		result+=obj.offsetLeft;
		obj=obj.offsetParent;
	}
	return result;
}

function getAbsY(obj){
	var result = 0;
	while(obj!=null){
		result+=obj.offsetTop;
		obj=obj.offsetParent;
	}
	return result;
}

function adddate(date,days,months,years){
	zile_in_luna=[0,31,28,31,30,31,30,31,31,30,31,30,31];

	if(days==null){
		days=0;
	}
	if(months==null){
		months=0;
	}
	if(years==null){
		years=0;
	}
	year=Number(date[0]);
	mon=Number(date[1]);
	mday=Number(date[2]);

	year+=years;

	mon+=months;
	year+=Math.floor((mon-1)/12);
	mon=(mon-1)%12+1;
	if(mon<=0){
		mon=12+mon;
	}

	zile_in_luna[2] = ((year%4==0 && year%100!=0) || year%400==0) ? 29 : 28;
	if(days==0){
		mday=Math.min(mday,zile_in_luna[mon]);
	}else{
		mday+=days;
		while(mday>zile_in_luna[mon] || mday<=0){
			if(mday<=0){
	            mon--;
	            year+=Math.floor((mon-1)/12);
	            mon=(mon-1)%12+1;
	            if(mon<=0){
	                mon=12+mon;
	            }
	            zile_in_luna[2] = ((year%4==0 && year%100!=0) || year%400==0) ? 29 : 28;
	            mday+=zile_in_luna[mon];
			}else{
	            mday-=zile_in_luna[mon];
	            mon++;
	            year+=Math.floor((mon-1)/12);
	            mon=(mon-1)%12+1;
			}
            zile_in_luna[2] = ((year%4==0 && year%100!=0) || year%400==0) ? 29 : 28;
		}
	}

	return [year,mon,mday];
}

//SSToolTip Component
//created by Sebastian Serban, v3.0 (12.09.2007)
function SSToolTip(obj,title,content,width,fixed,padding){
	if(typeof(SSTT)=='undefined'){
		SSTT=document.createElement('div');
		document.body.appendChild(SSTT);
		SSTT.id='SSToolTip';
		SSTT.style.display="none";
		SSTT.style.position="absolute";
		SSTT.style.zIndex=10010;
		SSTT.style.left=0;
		SSTT.style.top=0;
		SSTT.padding=padding==null ? "4px" : padding;
		document.onmousemove = function(e){
			if(SSTT_move){
				if(e=e ? e : window.event){
					var x=e.pageX ? e.pageX : e.x+document.body.scrollLeft;
					var y=e.pageY ? e.pageY : e.y+document.body.scrollTop;
					x+=20;
					y+=20;
					var tipWidth=document.getElementById("tooltiptable").clientWidth+4;
					if(x+tipWidth>document.body.clientWidth){
						x=document.body.clientWidth-tipWidth;
					}
					if(y+SSTT.clientHeight>document.body.scrollTop+document.body.clientHeight){
						y=document.body.scrollTop+document.body.clientHeight-SSTT.clientHeight;
						if(y<document.body.scrollTop){
							y=document.body.scrollTop;
						}
					}
					SSTT.style.left = x;
					SSTT.style.top = y;
					if(SSTT_stopafterfirst){
						SSTT_move=0;
					}
				}
			}
		}
		SSTT.hide=function(){
			this.style.display='none';
			SSTT_move=0;
		}
	}
	title=rawurldecode(title);
	if(content==undefined){
		SSTT.innerHTML='<table id="tooltiptable" cellPadding="0" cellSpacing="0"><tr><td style="padding:0 4px">'+title+'</td></tr></table>';
	}else{
		content=rawurldecode(content);
		if(width==undefined){
			width="";
		}
		SSTT.innerHTML='<!--[if IE]><iframe id="SSTT_iframe" style="position:absolute;z-index:-100;filter:\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\';"></iframe><![endif]--><table style="border:solid 1px #36c;background:#fff;opacity:0.90;filter:alpha(opacity=90) progid:DXImageTransform.Microsoft.Shadow(color=#333333,direction=135,strength=2,enabled=true);width:'+width+';" id="tooltiptable" cellpadding="1" cellspacing="0">'+(title!="" ? '<tr><td style="background:#36c;color:#fff;padding:'+SSTT.padding+';"><b>'+title+'</b></td></tr>' : '')+'<tr valign=top><td style="padding:'+SSTT.padding+';">'+content+'</td></tr></table>';
	}
	SSTT.style.display = "";
	var iframe=document.getElementById('SSTT_iframe');
	if(iframe!=null){
		iframe.style.width=SSTT.offsetWidth;
		iframe.style.height=SSTT.offsetHeight;
	}
	obj.onmouseout=function(){
		SSTT.hide();
	}
	SSTT_move=1;
	SSTT_stopafterfirst=fixed;
	document.onmousemove();
}

function xmlRemoveWhiteSpace(xml){
	if(xml.hasChildNodes()){
		for(i=0;i<xml.childNodes.length;i++){
			if(xml.childNodes[i].nodeType==1){
				xmlRemoveWhiteSpace(xml.childNodes[i]);
			}else{
				if(xml.childNodes[i].nodeName=="#text" || xml.childNodes[i].nodeType==7){
					xml.removeChild(xml.childNodes[i]);
				}
			}
		}
	}
	return xml;
}

//XMLHTTP OBject
var xmlhttp=false;
/*@cc_on @*/
/*@if(@_jscript_version>=5)
//JScript gives us Conditional compilation, we can cope with old IE versions.
//and security blocked creation of the objects.
try{
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
	try{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}catch(E){
		xmlhttp=false;
	}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

sendAndLoad=function(url,callback,method,extra){
	// method=GET,POST,HEAD
	// extra=true or false for method GET or POST if XML neede in return, header property if HEAD
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if(@_jscript_version>=5)
	//JScript gives us Conditional compilation, we can cope with old IE versions.
	//and security blocked creation of the objects.
	try{
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp=false;
		}
	}
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined'){
		try{
			xmlhttp=new XMLHttpRequest();
		}catch(e){
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest){
		try{
			xmlhttp=window.createRequest();
		}catch(e){
			xmlhttp=false;
		}
	}
	if(xmlhttp){
		if(method==null){
			method="GET";
		}
		try{
			xmlhttp.open(method,url,true);
			if(callback){
				xmlhttp.onreadystatechange=function(){
					if(xmlhttp.readyState==4){
						if(xmlhttp.status==200){
							if(method=="HEAD"){
								var value=extra==null ? xmlhttp.getAllResponseHeaders() : xmlhttp.getResponseHeader(extra);
							}else{
								var value=extra ? xmlRemoveWhiteSpace(xmlhttp.responseXML) : xmlhttp.responseText;
							}
							callback(value);
						}else{
							callback(false);
						}
					}
				}
			}
			xmlhttp.send(null);
		}catch(e){
		}
	}
}


//SSColorPicker Component
//created by Sebastian Serban, v1.1 (24.10.2007)
function SSColorPicker(obj,color,callback){
	if(typeof(SSCP)=='undefined'){
		SSCP_in=0;
		SSCP_intID=0;
		SSCP_alpha=100;
		SSCP=document.createElement('div');
		document.body.appendChild(SSCP);
		SSCP.id='SSColorPicker';
		SSCP.style.visibility="hidden";
		SSCP.style.position="absolute";
		SSCP.style.zIndex=10001;
		SSCP.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#333333,direction=135,strength=2,enabled=true);";
		SSCP.style.left=0;
		SSCP.style.top=0;
		var html='<!--[if IE]><iframe id="SSCP_iframe" style="position:absolute;z-index:-100;filter:(opacity=0);"></iframe><![endif]--><table cellpadding=0 cellspacing=0 border=1 bordercolor=1 style="border:solid 1px #000000;border-collapse:collapse;background:#000;filter:alpha(opacity=100);" onmouseover="SSCP_in=1" onmouseout="SSCP_in=0"><tr><td colspan=18><div id="SSCP_preview" style="cursor:pointer;width:50px;height:19px;background-color:#fff;float:left;" onclick="SSCP.setColor(document.getElementById(\'SSCP_value\').value)"></div><span style="color:#fff;margin-left:10px">#</span><input id=SSCP_value maxlength=6 value="ffffff" style="width:60px;height:19px;margin-left:1px;" onblur="this.value=this.value.replace(/[^0-9a-fA-F]/g,\'\');" onkeypress="if(document.all ? (window.event.keyCode==13) : (arguments[0].which==13)){SSCP.setColor(this.value)};return checkKey(event,\'0-9a-fA-F\')" onkeyup="SSCP.previewColor(this.value,1)"></td></tr>';
		for(var i=0;i<12;i++){
			html+='<tr>';
			for(var j=0;j<18;j++){
				var c=(0x330000*(Math.floor(j/6))+(0x3300*(j%6))+0x33*(i%6)+(i>=6 ? 0x990000 : 0)).toString(16).toUpperCase();
				while(c.length<6){
					c="0"+c;
				}
				html+='<td style="border:solid 1px #000000;padding-left:13px;height:13px;background-color:#'+c+'" onmouseover="SSCP.previewColor(\''+c+'\');" onclick="SSCP.setColor(\''+c+'\')"></td>';
			}
			html+='</tr>';
		}
		html+='<tr>';
		var custom=[0xff0000,0x00ff00,0x0000ff,0xffff00,0xff00ff,0x00ffff,0x333333,0x444444,0x555555,0x666666,0x777777,0x888888,0x999999,0xaaaaaa,0xbbbbbb,0xcccccc,0xdddddd,0xeeeeee];
		for(i=0;i<custom.length;i++){
			c=custom[i].toString(16).toUpperCase();
			while(c.length<6){
				c="0"+c;
			}
			html+='<td style="border:solid 1px #000000;padding-left:13px;height:13px;background-color:#'+c+'" onmouseover="SSCP.previewColor(\''+c+'\');" onclick="SSCP.setColor(\''+c+'\')"></td>';
		}
		html+='</tr>';
		html+='</table>';
		setTimeout(function(){
			var iframe=document.getElementById('SSCP_iframe');
			if(iframe!=null){
				iframe.style.width=SSCP.offsetWidth;
				iframe.style.height=SSCP.offsetHeight;
			}
			SSCP.style.visibility="visible";
			SSCP.style.display="none";
		},1);
		SSCP.innerHTML=html;
		SSCP.hide=function(){
			clearInterval(SSCP_intID);
			SSCP_intID=setInterval(function(){
				SSCP_alpha-=20;
				setAlpha(SSCP,SSCP_alpha);
				if(SSCP_alpha<=0){
					SSCP.style.display="none";
					clearInterval(SSCP_intID);
				}
			},50)
		}
		SSCP.previewColor=function(value,skipInput){
			value=value.replace(/#/g,'');
			while(value.length<6){
				value="0"+value;
			}
			document.getElementById('SSCP_preview').style.backgroundColor="#"+value;
			if(!skipInput){
				document.getElementById('SSCP_value').value=value;
			}
		}
		SSCP.setColor=function(value){
			value=value.replace(/#/g,'');
			while(value.length<6){
				value="0"+value;
			}
			this.hide();
			SSCP.callback(value.toUpperCase());
		}
		var ex_mouseup=document.onmouseup;
		document.onmouseup=function(){
			try{
				ex_mouseup();
			}catch(e){
			}
			if(!SSCP_in){
				SSCP.hide();
			}
		}
		var ex_resize=document.onresize;
		window.onresize=function(){
			try{
				ex_resize();
			}catch(e){
			}
			if(SSCP.style.display==""){
				SSCP.hide();
			}
		}
	}

	setTimeout(function(){
		SSCP_alpha=0;
		setAlpha(SSCP,SSCP_alpha);
		SSCP.style.display='';
		SSCP.callback=callback;
		var x=getAbsX(obj)+obj.clientWidth;
		var y=getAbsY(obj);
		var w=SSCP.clientWidth+2;
		if(x+w>document.body.clientWidth){
			x=document.body.clientWidth-w;
		}
		if(y+SSCP.clientHeight>document.body.scrollTop+document.body.clientHeight){
			y=document.body.scrollTop+document.body.clientHeight-SSCP.clientHeight;
			if(y<document.body.scrollTop){
				y=document.body.scrollTop;
			}
		}
		SSCP.style.left=x
		SSCP.style.top=y
		SSCP.previewColor(color);
		clearInterval(SSCP_intID);
		SSCP_intID=setInterval(function(){
			SSCP_alpha+=20;
			setAlpha(SSCP,SSCP_alpha);
			if(SSCP_alpha>=100){
				clearInterval(SSCP_intID);
			}
		},50)
	},10);
}

//SSDate Component
//created by Sebastian Serban, v1.1 (24.10.2007)
function SSDatePicker(obj,value,minYear,maxYear,callback,language){
	if(typeof(SSD)=='undefined'){
		SSD_in=0;
		SSD_intID=0;
		SSD_alpha=100;
		SSD=document.createElement('div');
		document.body.appendChild(SSD);
		SSD.language=language==null ? 1 : Number(language);
		if(SSD.language==0){
			SSD.months=["","ianuarie","februarie","martie","aprilie","mai","iunie","iulie","august","septembrie","octombrie","noiembrie","decembrie"];
			SSD.days=["","L","M","M","J","V","S","D"];
		}else{
			SSD.months=["","january","february","march","april","may","june","july","august","september","october","november","december"];
			SSD.days=["S","M","T","W","T","F","S"];
		}
		SSD.minYear=minYear;
		SSD.maxYear=maxYear;
		SSD.id='SSDatePicker';
		SSD.style.visibility="hidden";
		SSD.style.position="absolute";
		SSD.style.zIndex=10002;
		SSD.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#333333,direction=135,strength=2,enabled=true);";
		SSD.style.width=200;
		SSD.style.left=0;
		SSD.style.top=0;
		var html='<!--[if IE]><iframe id="SSD_iframe" style="position:absolute;z-index:-100;filter:(opacity=0);"></iframe><![endif]--><table width="100%" cellpadding=0 cellspacing=0 border=1 bordercolor=1 style="border:solid 1px #000;border-collapse:collapse;background:#fffee9;filter:alpha(opacity=100);cursor:default;" onmouseover="SSD_in=1" onmouseout="SSD_in=0" onmousewheel="SSD.onWheel(event)"><tr><td><input id=SSD_prev type=button value="&laquo;" style=width:30px onclick="SSD.prevMonth()"></td><td id=SSD_location align="center" width=100%></td><td><input id=SSD_next type=button value="&raquo;" style=width:30px onclick="SSD.nextMonth()"></td></tr><tr><td colspan=3><table id=SSD_days border=1 bordercolor=#cccccc style="border:solid 1px #ccc;border-collapse:collapse;background:#fff;" width=100%><tr style="background:#000;color:#fff">';
		for(var i=0;i<7;i++){
			html+='<td align=center width=14%>'+SSD.days[SSD.language==0 ? i+1 : i]+'</td>';
		}
		html+='</tr>';
		for(var i=0;i<6;i++){
			html+='<tr>';
			for(var j=0;j<7;j++){
				html+='<td align=right onmouseover="SSD.rollOver(this)" onmouseout="SSD.rollOut(this)" onclick="SSD.click(this)" style=padding-right:2px>&nbsp;</td>';
			}
			html+='</tr>';
		}
		html+='</table></td></tr><tr><td colspan=3 style="padding:2px;text-align:center;font-size:9px">'+(SSD.language==0 ? 'Foloseşte rotiţa mouse-ului sau săgeţile pentru a schimba luna' : 'Use mouse wheel or arrows to change month')+'</td></tr></table>';
		SSD.updateIframe=function(){
			var iframe=document.getElementById('SSD_iframe');
			if(iframe!=null){
				iframe.style.width=SSD.offsetWidth;
				iframe.style.height=SSD.offsetHeight;
			}
		}
		setTimeout(function(){
			SSD.updateIframe();
			SSD.style.visibility="visible";
			SSD.style.display="none";
		},1);
		SSD.innerHTML=html;
		SSD.hide=function(){
			clearInterval(SSD_intID);
			SSD_intID=setInterval(function(){
				SSD_alpha-=25;
				setAlpha(SSD,SSD_alpha);
				if(SSD_alpha<=0){
					SSD.style.display="none";
					clearInterval(SSD_intID);
				}
			},50)
		}
		SSD.nextMonth=function(){
			var next_date=adddate([this.year,this.month,1],0,1);
			this.browseTo(next_date);
		}
		SSD.prevMonth=function(){
			var next_date=adddate([this.year,this.month,1],0,-1);
			this.browseTo(next_date);
		}
		SSD.browseTo=function(value){
			value[0]=Number(value[0]);
			if(value[0]>=this.minYear && value[0]<=this.maxYear){
				this.year=value[0];
				this.month=Number(value[1]);
				document.getElementById("SSD_prev").disabled=this.year==this.minYear && this.month==1;
				document.getElementById("SSD_next").disabled=this.year==this.maxYear && this.month==12;
				document.getElementById("SSD_location").innerHTML=this.months[this.month]+" "+this.year;
				var table=document.getElementById("SSD_days");
				var d=new Date();
				d.setFullYear(this.year,this.month-1,1);
				var wday=d.getDay();
				var ndays=[0,31,28,31,30,31,30,31,31,30,31,30,31][this.month];
				if(this.month==2 && (this.year%4==0 && this.year%100!=0) || this.year%400==0){
					ndays=29;
				}
				for(var i=1;i<=6;i++){
					table.rows[i].style.display="";
					for(var j=0;j<7;j++){
						table.rows[i].cells[j].innerHTML="";
						table.rows[i].cells[j].style.background="transparent";
						table.rows[i].cells[j].style.color="#000";
					}
				}
				var day=1;
				if(this.language==0){
					i=wday==0 ? 6 : wday-1;
				}else{
					i=wday;
				}
				var line=i==0 ? 0 : 1;
				while(day<=ndays){
					if(i%7==0){
						line++;
					}
					table.rows[line].cells[i%7].innerHTML=day;
					i++;
					day++;
				}
				for(i=line+1;i<table.rows.length;i++){
					table.rows[i].style.display="none";
				}
				SSD.updateIframe();
			}
		}
		SSD.rollOver=function(cell){
			if(cell.innerHTML!=""){
				cell.style.background="#4B5F6D";
				cell.style.color="#fff";
			}
		}
		SSD.rollOut=function(cell){
			if(cell.innerHTML!=""){
				cell.style.background="transparent";
				cell.style.color="#000";
			}
		}
		SSD.click=function(cell){
			if(cell.innerHTML!=""){
				this.setValue(cell.innerHTML);
			}
		}
		SSD.setValue=function(value){
			this.hide();
			SSD.callback([this.year,this.month,value]);
		}
		var ex_mouseup=document.onmouseup;
		document.onmouseup=function(){
			try{
				ex_mouseup();
			}catch(e){
			}
			if(!SSD_in){
				SSD.hide();
			}
		}
		var ex_resize=document.onresize;
		window.onresize=function(){
			try{
				ex_resize();
			}catch(e){
			}
			if(SSD.style.display==""){
				SSD.hide();
			}
		}
		SSD.onWheel=function(event){
			if(event.detail){
				var delta=-event.detail;
			}else{
				var delta=event.wheelDelta;
			}
			if(delta>0){
				SSD.nextMonth();
			}else{
				SSD.prevMonth();
			}
		}
		if(SSD.addEventListener){
			SSD.addEventListener('DOMMouseScroll',SSD.onWheel,false)
		}
	}

	setTimeout(function(){
		SSD_alpha=0;
		setAlpha(SSD,SSD_alpha);
		SSD.style.display='';
		SSD.callback=callback;
		var table=document.getElementById("SSD_days");
		for(var i=1;i<=6;i++){
			table.rows[i].style.display="";
			for(var j=0;j<7;j++){
				table.rows[i].cells[j].innerHTML="&nbsp;";
			}
		}
		var x=getAbsX(obj)+obj.clientWidth;
		var y=getAbsY(obj);
		var w=SSD.clientWidth+2;
		if(x+w>document.body.clientWidth){
			x=document.body.clientWidth-w;
		}
		if(y+SSD.clientHeight>document.body.scrollTop+document.body.clientHeight){
			y=document.body.scrollTop+document.body.clientHeight-SSD.clientHeight;
			if(y<document.body.scrollTop){
				y=document.body.scrollTop;
			}
		}
		SSD.style.left=x
		SSD.style.top=y
		SSD.browseTo(value);
		clearInterval(SSD_intID);
		SSD_intID=setInterval(function(){
			SSD_alpha+=33;
			setAlpha(SSD,SSD_alpha);
			if(SSD_alpha>=100){
				clearInterval(SSD_intID);
			}
		},50)
	},10);
}

//Grid initialization
function setGrid(grid,colorOver,colorSelected,cellPos,onChangeSelection){
	grid.gridOver=function(obj){
		obj.bgColor=colorOver;
	}
	grid.gridOut=function(obj){
		obj.bgColor=cellPos!=null && obj.cells[cellPos].firstChild.checked ? colorSelected : obj.color;
	}
	grid.gridClick=function(obj,state){
		if(state==null){
			state=!obj.cells[cellPos].firstChild.checked;
		}
		obj.cells[cellPos].firstChild.checked=state;
		obj.bgColor=state ? colorSelected : obj.color;
		if(arguments.length==1){
			grid.sync();
		}
	}
	grid.gridSelectAll=function(state){
		for(var i=1;i<grid.rows.length;i++){
			this.gridClick(grid.rows[i],state);
		}
		grid.sync();
	}
	grid.sync=function(){
		var sel=1;
		var count=0;
		for(var i=1;i<this.rows.length;i++){
			if(grid.rows[i].cells[cellPos].firstChild.checked){
				count++;
			}else{
				sel=0;
			}
		}
		if(onChangeSelection!=null){
			onChangeSelection(count);
		}
		grid.rows[0].cells[cellPos].firstChild.checked=sel;
	}
	for(var i=1;i<grid.rows.length;i++){
		var obj=grid.rows[i];
		obj.color=obj.bgColor;
		obj.onmouseover=function(){
			grid.gridOver(this);
		}
		obj.onmouseout=function(){
			grid.gridOut(this);
		}
		if(cellPos!=null){
			obj.onclick=function(){
				grid.gridClick(this);
			}
			obj.cells[cellPos].firstChild.onclick=function(){
				grid.gridClick(this.parentNode.parentNode);
			}
			if(obj.cells[cellPos].firstChild.checked){
				grid.gridClick(obj,1);
			}
			grid.sync();
		}
	}
	if(cellPos!=null){
		grid.rows[0].cells[cellPos].firstChild.onclick=function(){
			grid.gridSelectAll(this.checked);
		}
	}
}