document.observe("dom:loaded", function() {
	$$('#check').each(function (el) {
  		el.checked = false;
		Event.observe(el, "click", function(event) {		
			if ($('pass').style.display == 'none'){
				$('pass').show();
			} else {
				$('pass').hide();
			}
		});
	});

	$$('#nelk').each(function (el) { 
		var link = document.getElementById('nelk').href;

		if (document.getElementById('nelk')) {
		    if (navigator.appName !== 'Microsoft Internet Explorer') {
			var imageButton = document.createElement('img');
			document.getElementById('copytoclipboard').innerHTML = '';
			document.getElementById('copytoclipboard').appendChild(imageButton);
			imageButton.setAttribute('src','/images/save-small.jpg');
			imageButton.setAttribute('id','clipboardbutton');
			document.getElementById('copytoclipboard').innerHTML = document.getElementById('copytoclipboard').innerHTML + ' link to clipboard';
			var clip = new ZeroClipboard.Client;
			clip.setHandCursor(false);
			clip.setText(link);
			clip.addEventListener('complete', function() {
				alert('New link was succesfully copied to clipboard.');
			});
			clip.addEventListener('onMouseOver', function() {
				//document.getElementById('copytoclipboard').src = 'images/make-spotify-over.jpg';
			});
			clip.addEventListener('onMouseOut', function() {
				//document.getElementById('copytoclipboard').src = 'images/make-spotify.jpg';
			});
			clip.glue('clipboardbutton');
		    } else {
			window.clipboardData.setData("Text", link);
		    }
		}
	});
	$$('#sendmail').each(function (el) { 
		el.value="code";
	});
	$$('#pswd').each(function (el) {
		el.value = '';
	});
});

function inputEnter(element, val, leave) {
	if (leave == undefined) 
		leave = '';
	if (element.value == val) {
		element.value = leave;
	}
}

function inputLeave(element, val, leave) {
	if (leave == undefined) 
		leave = '';
	if (element.value == leave) {
		element.value = val;
	} else if (element.value == '') {
		element.value = val;
	}
}

function bar(url){
	wasOpen  = false;
    win = window.open(url);    
    return (typeof(win)=='object')?true:false;
}