function RollUpRollDown(id) {
	if (Element.empty(id)) {
	
	} else {
		new Effect[Element.visible(id) ? 'BlindUp' : 'BlindDown'](id, {duration: 0.5});
	}
}

function RollUp(id){
	if(Element.visible(id))
	{
		Effect['BlindUp'](id, {duration: 0.5});
	}
}

function RollDown(id){
	if(!Element.visible(id))
	{
		Effect['BlindDown'](id, {duration: 0.5});
	}
}

function Comment(where){
	$(where).style.display == 'inline' ? $(where).setStyle({display: 'none'}) : $(where).setStyle({display: 'inline'});
	
}

function OpenComment(where){
	if(document.getElementById(where).style.display == 'inline'){
		document.getElementById(where).style.display = 'none';
	} else {
		document.getElementById(where).style.display = 'inline';
	}
}

/* hacked - checks for jquery instead of prototype for map page */
function Open(id){	
	if (!$('#'+id)) $(id).style.display = 'inline';    
	else $('#'+id).css({"display":"inline"})
}
/* hacked - checks for jquery instead of prototype for map page */
function Close(id){	
	if (!$('#'+id)) $(id).style.display = 'none';    
	else $('#'+id).css({"display":"none"})
}

function PopUp(url)
{
	popupwin = window.open(url , "","");
}

function setStyle(id, style)
{
	$(id).style.bgcolor = style;
}

function RollAjax(id, url) 
{
	if (Element.empty(id)) 
	{
		Open('loadstatus');
		new Ajax.Updater(id, url, 
		{
			method:     'get',
			onFailure:  function() {Element.classNames(id).add('failure')},
			onComplete: function() {new Effect.BlindDown(id, {duration: 0.5});Close('loadstatus');}
		});
	} else
	{
		new Effect[Element.visible(id) ? 'BlindUp' : 'BlindDown'](id, {duration: 0.5});
	}
}

function OpenAjax(id, url)
{
	if (Element.empty(id)) 
	{
		Open('loadstatus');
		new Ajax.Updater(id, url, 
		{
			method:     'get',
			onFailure:  function() {Element.classNames(id).add('failure')},
			onComplete: function() {Open(id);Close('loadstatus')}
		});
	}else
	{
		Open(id);
	}
}

function validate_field(id, erid)
{
	if($(id).value == '')
	{
		RollUpRollDown(id);
		Modalbox.resizeToInclude(erid, {afterResize: function(){new Effect.Appear(erid);}});
		setTimeout('RollUpRollDown(\''+erid+'\')', 1500);
		return false;
	}else
		return true;
}

function ProductArrows(id)
{
	$(id).src == 'http://vintage.local/public/images/admin/macplus.png' ? $(id).src = 'http://vintage.local/public/images/admin/macminus.png' : $(id).src = 'http://vintage.local/public/images/admin/macplus.png';
}




	function imgOver(id)
	{
		$(id).setStyle({border: '4px', borderStyle: 'solid', borderColor: '#EBA727'});
	}
	
	function imgOut(id)
	{
		$(id).setStyle({border: '0px', margin: '4px', padding: '1px'});
	}

	function SetImg(id, src)
	{
		$(id).src = $(src).src;
		$('hide_img').show();
		$('content_image').value = $(src).src;
	}
	
	function noImg()
	{
		$('content_header').src = '';
		$('hide_img').hide();
		$('content_image').value = '';
	}	
	
	
	
	
	function noImgBig()
	{
		//$('src_service_image').src = '';
		$('src_service_image').setStyle({backgroundImage: ''});
		$('hide_img_big').hide();
		$('service_image').value = '';
	}	
		
	function SetServiceImgBig(src)
	{
		//$('src_service_image').src = $(src).src;
		$('src_service_image').setStyle({background: "url('" + src + "')"});
		$('hide_img_big').show();
		$('service_image').value = src;
	}
	
	function noServiceImgBig()
	{
		//$('src_service_image').src = '';
		$('src_service_image').setStyle({backgroundImage: ''});
		$('hide_img_big').hide();
		$('service_image').value = '';
	}	
	
	function setColorBig(color){
		$('urlservprev').setStyle({backgroundColor: $(color).value});
	}	
	
	
	function noImgSmall()
	{
		$('src_service_image_small').src = '';
		$('hide_img_small').hide();
		$('service_image_small').value = '';
	}	
		
	function SetServiceImgSmall(src)
	{
		$('src_service_image_small').src = src;
		$('hide_img_small').show();
		$('service_image_small').value = src;
	}
	
	function noServiceImgSmall()
	{
		$('src_service_image_small').src = '';
		$('hide_img_small').hide();
		$('service_image_small').value = '';
	}	
	
	function SetNewsImage(src)
	{
		$('news_image_src').src = src;
		$('news_image').value = src;
	}
	
	
	