var myrules = {
	'input#imageurl' : function(element){
		element.onfocus = function(){
			if ($('imageurl').value == 'http:\/\/') {
				$('imageurl').value = ''
			}
		}
		element.onblur = function(){
			if ($('imageurl').value == '') {
				$('imageurl').value = 'http:\/\/'
			}
		}
	},
	'input#upload' : function(element){
		element.onclick = function(){
			uploadImage(); return false;
		}
	},
	'img#icon' : function(element){
		element.onload = function(){
			Element.hide('loading');
			Element.show('icon');
			Element.show('icon_window');
			Element.hide('uploading');
			Element.hide('loadingbig');
			Element.hide('loadingstartbig');
			new Effect.Appear('startdiv');
			new Effect.Appear('icon_window');
		}
	},
	'img.colorpicker' : function(element){
		element.onclick = function(){
			pickcolor('#'+this.id+'sample', 'backgroundColor', '', this.id+'input', this, 5, 8);
			if (this.id == 'colorpickertextborder') {
				document.colorpickertextbordersample.src='/eljay/iconmaker/images/blank.gif';
			}
		}
	},
	'img.delete' : function(element){
		element.onclick = function(){
			$('colorpickertextborderinput').value='';
			document.colorpickertextbordersample.src='/eljay/iconmaker/images/none.gif';
		}
	},
	'input.colorpickerinput' : function(element){
		element.onchange = function(){
			$(this.id+'_sample').style.background = $(this.id).value;
			if (this.id == 'text_border_color' && $(this.id).value != '#'){
				document.text_border_color_sample.src='/eljay/iconmaker/images/blank.gif';
				
			}
		}
		element.onchange = function(){
			$(this.id+'_sample').style.background = $(this.id).value;
			if (this.id == 'text_border_color' && $(this.id).value != '#'){
				document.text_border_color_sample.src='/eljay/iconmaker/images/blank.gif';
				
			}
		}
	},
	// show or hide redo and undo
	'img#undo' : function(element){
		element.onclick = function(){
			Element.hide('undo');
			new Effect.Appear('redo');
		}
	},
	'img#redo' : function(element){
		element.onclick = function(){
			Element.hide('redo');
			new Effect.Appear('undo');
		}
	},
	'img.button' : function(element){
		element.onclick = function(){
			Element.hide('ColourMod');
			Element.hide('starterdiv');
			Element.hide('cropdiv');
			Element.hide('textdiv');
			Element.hide('borderdiv');
			Element.hide('rotatediv');
			new Effect.BlindDown($(this.id+'div'));
		}
	}
};
Behaviour.register(myrules);

function checkAdsense(){
	if (Element.getHeight('adsense') > 60) {
		$('adsense').style.visibility = 'visible'
	} else {
		$('adsense').style.display = 'none'
	}
}