<!-- 
// **********************************************************************************************
//
// file			: applick.js
// Author		: Giovambattista Fazioli (e-lementi.com)
// Web			: http://e-lementi.com
// E-mail		: info (at) e-lementi (dot) (com)
// Created		: 09/08/2006 9.49
// Modified		: 28/10/2006 14.21
//
// Copyright (C) 2002-2006 e-lementi
//
// DESCRIPTION
//	File Javascript principale con i prototipi delle funzioni base
//
// **********************************************************************************************

// do it - ie only
window.defaultStatus = "applick.com - Make your Web Simple & Easy";

/*  Prototype JavaScript framework, version 1.5.0_rc0
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/
var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0; i < iterable.length; i++)
      results.push(iterable[i]);
    return results;
  }
}

Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() { return __method.apply(object, args.concat($A(arguments)));  }
}

// extension
String.prototype.addslashed = function() {
	var s = this.replace(/[\"]/g,'\\"');
	return( s.replace(/[\']/g,"\\'") );
}

String.prototype.getHTML = function() { return( this.replace(/[\"]/g,"&quot;") ); }

// Liberamente ispirato da prototype.js ( (c) 2005 Sam Stephenson <sam@conio.net> ) sostituisce
// il document.getElementById(). Questo nuovo metodo, a differenza del classico getElementById()
// può ritornare un array di elementi, in base ai parametri passati negli INPUTS.
// Si può utilizzare in alternativa la ultrarapida $G() definita più sotto.
//
// see also: $G()
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string') element = document.getElementById(element);
		if (arguments.length == 1)  return ( element );
		elements.push(element);
	}
	return ( elements );
}
// fast
function $G() { return( document.getElementById(arguments[0])); }

// Simile a $() e $G() ma opera sulle FORM.
function $F() { return( document.forms[arguments[0]] ); }
function $GF() {return($F("scoform_"+arguments[0]))}
// TO DO
function rnd(m,mx) { return (Math.floor(Math.random() * (mx - m + 1) + m) ); }

// Queste tre funzioni non hanno bisogno di molte spiegazioni. Esse permettono di leggere
// scrivere ed eliminare cookie.
function scoGetCookie(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return(null); 
   if (start == -1) return(null); 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length; 
   return(unescape(document.cookie.substring(len,end)) ); 
} 
// set
function scoSetCookie(name, value, expires, path, domain, secure) { 
    var cookieString = name + "=" +escape(value) + 
       ( (expires) ? ";expires=" + expires.toGMTString() : "") + 
       ( (path) ? ";path=" + path : "") + 
       ( (domain) ? ";domain=" + domain : "") + 
       ( (secure) ? ";secure" : ""); 
    document.cookie = cookieString; 
} 
// delete
function scoDeleteCookie(name,path,domain) { 
   if (Get_Cookie(name)) document.cookie = name + "=" + 
      ( (path) ? ";path=" + path : "") + 
      ( (domain) ? ";domain=" + domain : "") + 
      ";expires=Thu, 01-Jan-70 00:00:01 GMT"; 
}
// Patch per IE sui filmati flash
function insertFlashClock() {
	document.write('<div id="cscoSWFInfo">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="64" height="64">');
	document.write('<param name="movie" value="flash/info.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="flash/info.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="64" height="64"></embed>');
	document.write('</object>');
	document.write('</div>');
}

//-->