function getObject(id){
	return document.getElementById(id);
}

function showhide(id){
	var el = document.getElementById(id);
	if(el){
		if(el.style.display == 'none')
			el.style.display = 'block';
		else 
			el.style.display = 'none';
	}
}

function show(id){
	var el = document.getElementById(id);
	if(el)
		el.style.display = 'block';
}

function hide(id){
	var el = document.getElementById(id);
	if(el)
		el.style.display = 'none';
}

function onfoc(obj,txt){
	if(typeof obj == 'object'){
		if(obj.value == txt)
			obj.value = '';
	}
}
function onblr(obj,txt){
	if(typeof obj == 'object'){
		if(obj.value == txt || obj.value == '')
			obj.value = txt;
	}
}

function removeElement(id){
	if(!id)
		return false;
	var el = getObject(id);
	if(!el)
		return false;
	el.parentNode.removeChild(el);
}

function popup(mod,url,w,h){
	switch (mod){
		case 'image':
			window.open(url,'','menubar=no,location=no,resizable=yes,scrollbars=yes,status=no, width=500px, height=100px');
			break;
	}
}


function addBookmark(title,url){
	if(window.sidebar){ 
		window.sidebar.addPanel(title, url,"");  
	}else if(document.all){
		window.external.AddFavorite(url,title);
	}else if(window.opera && window.print){
		return true;
	}               
}

function Datetime(id){
	var obj;
	var clock;
	var dat;
	var date = new Date();
	
	obj = document.getElementById(id);
	
	this.clock = document.createElement('div');
	this.clock.id = 'js_clock_div';
	
	this.dat = document.createElement('div');
	this.dat.id = 'js_dat_div';
	
	obj.appendChild(this.dat); 
	obj.appendChild(this.clock); 
	
	function getDate(sep){
		var year = date.getFullYear();
		var month = date.getMonth();
		var day = date.getDate();
		month++;
		sep = (sep? sep:'.');
		month = (month < 10? "0"+month:month);
		day = (day < 10? "0"+day:day);
		this.dat.innerHTML = day+sep+month+sep+year;
	}
	this.getDate = getDate;
	
	function getTime(sep){
		var date = new Date();
		var clock = document.getElementById('js_clock_div');
		var hours = date.getHours()
		var minutes = date.getMinutes();
		var seconds = date.getSeconds();
		hours = (hours < 10? '0'+hours:hours);
		minutes = (minutes < 10? '0'+minutes:minutes);
		seconds = (seconds < 10? '0'+seconds:seconds);
		sep = (sep? sep:':');
		clock.innerHTML = hours+sep+minutes+sep+seconds;
	}
	this.getTime = getTime;
	
	function getClock(){
		setInterval(function(){getTime()},500);
	}
	this.getClock = getClock;
}