myUtils = {
	makeFrame:function( json ){
		myElmnt = new Element( json.htmlelmt );
		if( json.attributes != null )
			myElmnt.writeAttribute( json.attributes );
		if( json.txtContent != null )
			myElmnt.update( json.txtContent );
		
		return myElmnt; 
	},
	createFrame:function( element , json ){
		myElmnt = myUtils.makeFrame( json );
		element.insert( myElmnt );
		return myElmnt; 
	},
	updateFrame:function( element , json ){
		myElmnt = myUtils.makeFrame( json );
		element.update( myElmnt );
		return myElmnt; 
	}
};

Element.addMethods( myUtils );

function isSet( mixed ){ return ( typeof( mixed ) != 'undefined' && !isNull( mixed ) ); }
function isNull( mixed ){ return ( mixed == null ); }

Array.prototype.in_array = function(valeur) {
	for (var i in this) { if (this[i] == valeur) return true;}
	return false;
}

function is_array(input){ return typeof( input ) == 'object' && ( input instanceof Array ); }

String.prototype.verifemail = function(){
	var rv = true;
	var emailFormat = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-zA-Z]{2,6}(\.[a-zA-Z]{2})?$/i;
	if( this.search( emailFormat ) == -1 ){
		rv = false;
	}
	return rv;
}

String.prototype.trim = function() {
    return this.replace( /^\s+/, '' ).replace( /\s+$/, '' );
}
    
function firstVP( url ){
	var popVP = new popupVF( url );
	popVP.firstVP();
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
					((expires) ? "; expires=" + d.toGMTString() : "") +
					((path) ? "; path=" + path : "") +
					((domain) ? "; domain=" + domain : "") +
					((secure) ? "; secure" : "");

	document.cookie = curCookie;
}

function setCookieLong(name, value, path, domain, secure, duration) {
	var d = new Date();
	d.setTime(d.getTime() + duration*1000);
	var curCookie = name + "=" + escape(value) +
					((d) ? "; expires=" + d.toGMTString() : "") +
					((path) ? "; path=" + path : "") +
					((domain) ? "; domain=" + domain : "") +
					((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function switch_visibility(valeur,div_a_masquer) {
	div = $(div_a_masquer);
	div.style.display = valeur;
}

function cutAndPaste( content ){
	if( isSet( $('pasteItFromDestroyed' ) ) ){
		$('pasteItFromDestroyed').update( content.innerHTML );
	}
}

function switch_input_value_vip(inputamodif,valeur) {
	if( $(inputamodif).value == valeur )
		$(inputamodif).value = '';
}

function switch_input_value( inputamodif ){
	$( inputamodif ).value = '';
}