	function cancelEvent(e){
		if(navigator.userAgent.indexOf("msie")!=-1){
			e.returnValue=false;	
		}
		if(navigator.userAgent.indexOf("Gecko")!=-1){
			e.preventDefault();	
		}
	
	}
	function open_window( name, page, params ) {
		window.open( page, 'window' + name, params );
	}

	function rollOver( object, className ) {
		object.className			= className;
	}

	function uploadImage( type ) {
		open_window( 'image', 'upload_image.php?type=' + type, 'top=200, width=640, height=110, resizable=yes, scrollbars=yes, status=yes' );
	}
	
	function uploadBannerImage(pos) {
		open_window( 'image', 'upload_banner_image.php?pos='+pos, 'top=200, width=640, height=110, resizable=yes, scrollbars=yes, status=yes' );
	}
	
	function validateUser( ) {
		if ( document.login.username.value.length && document.login.password.value.length ) {
			document.login.submit();
		}
	}
	function validateBlogUser( ) {
		if ( document.login.username.value.length && document.login.password.value.length ) {
			document.login.submit();
		}
	}

	function setOrder( id, current, direction ) {
		document.form.method			= 'GET';
		document.form.pos.value			= current;
		document.form.move.value		= direction;
		document.form.id.value			= id;
		document.form.exec.value		= 'set_order';
		document.form.submit();
	}
	function setMenuOrder(id,idMenu, idPlato, current, direction ) {
		document.form.method='POST';
		document.form.pos.value			= current;
		document.form.move.value		= direction;
		document.form.idMenu.value		= idMenu;
		document.form.idPlato.value		= idPlato;
		document.form.id.value			= id;
		document.form.exec.value		= 'set_menu_order';
		document.form.submit();
	}

	function setProductOrder( id, current, direction,idCat ) {
		document.form.pos.value			= current;
		document.form.move.value		= direction;
		document.form.id.value			= id;
		document.form.idCat.value		= idCat;
		document.form.exec.value		= 'set_order';
		document.form.submit();
	}
	
	
	function setSubcategoryOrder( id, current, direction,idCat ) {
		document.form.pos.value			= current;
		document.form.move.value		= direction;
		document.form.id.value			= id;
		document.form.id_cat.value		= idCat;
		document.form.exec.value		= 'set_order';
		document.form.submit();
	}


	function editRecord( id ) {
		document.form.method			= 'POST';
		document.form.exec.value		= 'edit';
		document.form.id.value			= id;
		document.form.submit();
	}
	
	function orderMenu( id ){
		document.form.method			= 'POST';
		document.form.exec.value		= 'set_menu_order';
		document.form.idMenu.value			= id;
		document.form.submit();
	}

	function newRecord( ) {
		editRecord( 0 );
	}

	function changeStatus( id ) {
		document.form.exec.value		= 'status';
		document.form.id.value			= id;
		document.form.submit();
	}

	function changeNextStatus( id ) {
		document.form.exec.value		= 'next_status';
		document.form.id.value			= id;
		document.form.submit();
	}

	function changeOrderStatus( id, status ) {
		document.form.exec.value		= 'order_status';
		document.form.pos.value			= status;
		document.form.id.value			= id;
		document.form.submit();
	}

	function changeHighlight( id ) {
		document.form.exec.value		= 'highlight';
		document.form.id.value			= id;
		document.form.submit();
	}

	function changeWineOfTheMonth( id ) {
		document.form.exec.value		= 'wine_of_the_month';
		document.form.id.value			= id;
		document.form.submit();
	}

	function confirmDrop( id, confirmed ) {
		if ( confirm( 'Está seguro que desea eliminar el contenido seleccionado?' ) ) {
			document.form.exec.value	= 'drop';
			document.form.confirm.value	= 1;
			document.form.id.value		= id;
			document.form.submit();
		}
	}
	
	function confirmCategoryDrop( id, confirmed ) {
		if ( confirm( 'Está seguro que desea eliminar la categoría seleccionada?.\nSe elmininarán también todos las tópicos asociados a la misma.' ) ) {
			document.form.exec.value	= 'drop';
			document.form.confirm.value	= 1;
			document.form.id.value		= id;
			document.form.submit();
		}
	}

	function confirmSubcategoryDrop( id, confirmed ) {
		if ( confirm( 'Está seguro que desea eliminar la subcategoría seleccionada?.\nSe elmininarán también todos los productos asociados a la misma.' ) ) {
			document.form.exec.value	= 'drop';
			document.form.confirm.value	= 1;
			document.form.id.value		= id;
			document.form.submit();
		}
	}

	function confirmImageDrop( image ) {
		if ( confirm( 'Está seguro que desea eliminar la imagen seleccionada?' ) ) {
			document.form.exec.value	= 'drop_image';
			document.form.image.value	= image;
			document.form.submit();
		}
	}

	function showReplies( id ) {
		document.form.action='respuestas.php';
		document.form.method='post';
		document.form.exec.value	= 'show_replies';
		document.form.idTopico.value	= id;
		document.form.submit();
		
	}

	function acceptContent( ) {
		document.form.exec.value		= 'save';
		document.form.submit();
	}

	function setViewStatus( ) {
		document.form.submit();
	}

	function updateCurrencies( ) {
		document.form.exec.value		= 'update_currencies';
		document.form.submit();
	}

	function cancelContent( ) {
		window.location.href			= self.location;
	}

	function checkTextLength(l){
		aux=new String();
		aux=event.srcElement.value;
		if(aux.length>=l){
			event.returnValue=false;
		}
	}
