/* Copyright 2010 www.Vanylla.com. All rights reserved. */
Array.prototype.foreach=function foreach(f){for(var d=0,e=this.length;d<e;++d){f(this[d])}};String.prototype.trim=function trim(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.pad=function pad(j,h,f){var g=this;if(j&&(j.length==1)&&(h>this.length)){var i=new Array(h-this.length+1).join(j);g=(f?g+i:i+g)}return g};String.prototype.htmlEncode=function htmlEncode(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};String.prototype.stripTags=function stripTags(){return this.replace(/<[^>]+>/g,"")};String.prototype.stripHtml=function stripHtml(){alert("String.prototype.stripHtml is DEPRECATED!")};String.prototype.htmlHint=function htmlHint(f,d){var e=(((this.length>f)&&(f>2))?this.substr(0,f-1).htmlEncode()+"&hellip;":(d?this.pad(" ",f,true).htmlEncode():this));return e.replace(/ /g,"&nbsp;")};String.prototype.trimDomain=function trimDomain(){return((this.indexOf("http://")==0)?this.substr(7+this.substr(7).indexOf("/")+1):Jlib.Error("Invalid input parameter, it's not a valid full domain path format (must start with 'http://')."))};String.prototype.trimFileName=function trimFileName(){return this.substr(0,this.lastIndexOf("/")+1)};String.prototype.trimPath=function trimPath(){return this.substr(this.lastIndexOf("/")+1)};String.prototype.trimFileExtension=function trimFileExtension(){var b=this.lastIndexOf(".");return((b!=-1)?this.substr(0,b):this)};String.prototype.GetFileExtension=function GetFileExtension(){iDotIndex=this.lastIndexOf(".");return(iDotIndex==-1)?"":this.substr(iDotIndex).toLowerCase()};function StyleProperty2PropertyName(f){var h=f.split("-");var g=h.length;if(g==1){return h[0]}var i=((f.charAt(0)=="-")?(h[0].charAt(0).toUpperCase()+h[0].substring(1)):h[0]);for(var j=1;j<g;j++){i+=(h[j].charAt(0).toUpperCase()+h[j].substring(1))}return i}Date.prototype.toDMYYYY=function toDMYYYY(c){var d=c||"/";return this.getDate()+d+(this.getMonth()+1)+d+this.getFullYear()};Date.prototype.toDDMMYYYY=function toDDMMYYYY(c){var d=c||"/";return this.getDate().toString().pad("0",2)+d+(this.getMonth()+1).toString().pad("0",2)+d+this.getFullYear()};Date.prototype.toYYYYMMDD=function toYYYYMMDD(c){var d=c||"/";return this.getFullYear()+d+(this.getMonth()+1).toString().pad("0",2)+d+this.getDate().toString().pad("0",2)};var Jlib={install_folder:"jpl/js/",Error:function Error(h,i,f){var j="ERROR\n\nJAVASCRIPT FILE: "+(!f?"unknown":f)+"\n";j+="FUNCTION: ";if(i){j+i+"\n"}else{if(Jlib.Error.caller){var g=Jlib.Error.caller.toString();i=g.substring(g.indexOf("function")+"function".length,g.indexOf("("));j+=i.trim()+"\n"}}j+="DESCRIPTION: "+(!h?"Unknown error!":h);j+="\n\n\nPlease report this error to: info@vanylla.com";alert(j);return false},HttpGet:function HttpGet(p){this.file_url=p;this.keys=[];var m=[];if(typeof p==="string"){var r,t="",v,q,n=p.indexOf("?");if(n!=-1){this.file_url=p.substring(0,n);t=p.substr(n+1);v=t.split("&");for(r=0;r<v.length;r++){q=v[r].split("=");if(q.length==2){this.keys[r]=q[0];m[r]=q[1]}else{return Jlib.Error("Unable to create HttpGet object, invalid key value pair in encoded_uri input parameter.")}}}}else{return Jlib.Error("Unable to create HttpGet object, invalid/missing encoded_uri input parameter.")}this.ValueOf=function s(b){for(var a=0;a<this.keys.length;a++){if(this.keys[a]==b){return decodeURIComponent(m[a])}}return null};this.AddKey=function i(b,e){var c,a=this.keys.length,d=a;for(c=0;c<a;++c){if(this.keys[c]==b){d=c;break}}this.keys[d]=b;m[d]=encodeURIComponent(e);return this};this.DecodedValues=function o(){return m};this.toString=function u(c){var b,d=this.keys.length,a=this.file_url;if(d){a+="?";for(b=0;b<d;++b){a+=(this.keys[b]+"="+(c?decodeURIComponent(m[b]):m[b])+((b<(d-1))?"&":""))}}return a}}};Jlib.CURRENT_GET=new Jlib.HttpGet(window.location.href);Jlib.CURRENT_DOMAIN="http://"+window.location.hostname+"/";Jlib.CURRENT_FILE_URL=Jlib.CURRENT_GET.file_url;Jlib.CURRENT_FILE_FULL_PATH=Jlib.CURRENT_FILE_URL.trimFileName();Jlib.CURRENT_FILE_PATH=Jlib.CURRENT_FILE_FULL_PATH.trimDomain();Jlib.CURRENT_FILE_NAME=Jlib.CURRENT_FILE_URL.trimPath();Jlib.Util={mailto:function mailto(h,i,f,g){var j="mailto:"+h+"@"+i;if(f){j+=("?subject="+escape(f))}if(g){j+=("&amp;body="+escape(g))}document.location.href=j;return false},documentWriteMailAddress:function documentWriteMailAddress(c,d){document.write(c+"@"+d)},documentWriteMailLink:function documentWriteMailLink(j,k,l,h,m){var n=j+"@"+k;var i="<a"+((m)?(' class="'+m+'"'):"")+' href="#" onclick="return mailto(\''+j+"','"+k+"',"+(l?("'"+l+"'"):(null))+","+(h?("'"+h+"'"):(null))+')">'+n+"</a>";document.write(i)},documentWriteFlashObject:function documentWriteFlashObject(i,m,n,j,l,p){if(arguments.length!=6){return Jlib.Error("Wrong number of arguments!")}var o="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+p+"' width='"+n+"' height='"+j+((m)?("' id='"+m):"")+"'>\n";var k="<embed ";o+="<param name='movie' value='"+i+"'>\n";o+="<param name='quality' value='high'>\n";o+="<param name='menu' value='false'>\n";if(l){o+="<param name='wmode' value='transparent'>\n";k+="wmode='transparent' "}else{o+="<param name='wmode' value='opaque'>\n";k+="wmode='opaque' "}k+="src='"+i+"' menu='false' quality='high' width='"+n+"' height='"+j+((m!=null)?("' name='"+m):"")+"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>";o+=k+"\n";o+="</object>\n";document.write(o);return true},SearchWebsite:function SearchWebsite(f,e,d){if(typeof f=="string"){f=f.trim();if(f){f=f.replace(" ","+");if(!d){d=window.document.location.hostname}switch(e){case"yahoo.com":document.location.href="http://search.yahoo.com/search?p="+f+"+site%3A"+d+"&fr=yfp-t-477&toggle=1&cop=mss&ei=UTF-8&vc=&fp_ip=IT";break;case"yahoo.it":document.location.href="http://it.search.yahoo.com/search?p="+f+"+site%3A"+d+"&fr=yfp-t-501&ei=UTF-8&meta=vl%3D";break;case"google.com":document.location.href="http://www.google.com/search?hl=en&q="+f+"+site%3A"+d;break;default:document.location.href="http://www.google.it/search?hl=it&q="+f+"+site%3A"+d+"&meta="}}}}};var _jsfiles=new Array();function ifndef(c){var d;for(d=0;d<_jsfiles.length;d++){if(_jsfiles[d]==c){return Jlib.Error("This js file was included more than once in this webpage!\n\nLoaded files list:"+_jsfiles+", "+c,null,c)}}_jsfiles[_jsfiles.length]=c}function ifdef(f,d){var e;for(e=0;e<_jsfiles.length;e++){if(_jsfiles[e]==f){return}}Jlib.Error(f+" must be included first",null,d)}Jlib.Browser={engine:"",ie_version:0,language:"",os:"",Screen:{width:0,height:0,colors:0},_Init:function _Init(){if(window.opera){this.engine="OPERA"}else{var f=navigator.userAgent;if(window.attachEvent){this.engine="IE";var e=f.indexOf("MSIE")+5;this.ie_version=parseFloat(f.substring(e,f.indexOf(";",e)))}else{if(f.indexOf("AppleWebKit/")!=-1){this.engine="SAFARI"}else{if(f.indexOf("Gecko/")!=-1){this.engine="GECKO"}}}}if(navigator.platform){var d=navigator.platform;if(d.indexOf("Mac")!=-1){this.os="MAC"}else{if(d.indexOf("Win")!=-1){this.os="WIN"}else{if(d.indexOf("Linux")!=-1){this.os="LINUX"}}}}if(navigator.userLanguage){this.language=navigator.userLanguage}else{if(navigator.language){this.language=navigator.language}}}};Jlib.Browser._Init();Jlib.Webpage={ScrolledLxT:function ScrolledLxT(){return[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop]},VisibleWxH:function VisibleWxH(){var e=self.innerWidth;var d=self.innerHeight;var f=document.compatMode;if((f||(Jlib.Browser.engine=="IE"))&&!(Jlib.Browser.engine=="OPERA")){if(f=="CSS1Compat"){e=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{e=document.body.clientWidth;d=document.body.clientHeight}}return[e,d]},FullWxH:function FullWxH(){return[Math.max((document.body.scrollWidth||0),(document.documentElement.scrollWidth||0),(document.body.offsetWidth||0),(document.body.clientWidth||0),(document.documentElement.clientWidth||0),(self.innerWidth||0)),Math.max((document.body.scrollHeight||0),(document.documentElement.scrollHeight||0),(document.body.offsetHeight||0),(document.body.clientHeight||0),(document.documentElement.clientHeight||0),(self.innerHeight||0))]}};Jlib.StopEvent=function StopEvent(f,d){var e=window;if(arguments.length>1){if(d&&d.document){e=d}else{return Jlib.Error("Invalid input parameter, context is not a window object!")}}if(e.event){e.event.cancelBubble=true;e.event.returnValue=false}else{f.stopPropagation();f.preventDefault()}};Jlib.WhoFiredEvent=function WhoFiredEvent(f,d){var e=window;if(arguments.length>1){if(d&&d.document){e=d}else{return Jlib.Error("Invalid input parameter, context is not a window object!")}}return(e.event?e.event.srcElement:f.target)};Jlib.AppendEvent=function AppendEvent(e,g,h,f){if(e){if(e.attachEvent){return e.attachEvent("on"+g,h)}else{if(e.addEventListener){e.addEventListener(g,h,false);return true}}return Jlib.Error("Neither attachEvent() or addEventListner() methods are defined for the html_element object!")}return Jlib.Error("Invalid input argument: html_element is null!")};Jlib.GetElementXY=function GetElementXY(h){var f=0,g=0;var e;if(h&&h.offsetParent){f=h.offsetLeft;g=h.offsetTop;while(h.offsetParent){h=h.offsetParent;f+=h.offsetLeft;g+=h.offsetTop;if((h.style.position=="absolute")||(h.style.position=="relative")){if(document.defaultView){f+=parseInt(document.defaultView.getComputedStyle(h,null).getPropertyValue("border-left-width"));g+=parseInt(document.defaultView.getComputedStyle(h,null).getPropertyValue("border-top-width"))}else{if((h.style.position=="absolute")&&(typeof h.clientLeft=="number")){f+=h.clientLeft;g+=h.clientTop}}}}}return[f,g]};Jlib.ApplyRollover=function ApplyRollover(f){if(f&&(f.tagName=="IMG")){var d=f.getAttribute("src",2);var e=d.trimFileExtension()+"_over"+d.GetFileExtension();document.write("<img style='display: none; position: absolute; top: 0px; left: 0px;' src='"+e+"'>");Jlib.AppendEvent(f,"mouseover",function(){f.src=e});Jlib.AppendEvent(f,"mouseout",function(){f.src=d});return true}return Jlib.Error("Invalid/Missing input parameter: img_element must be an image element.")};Jlib.ApplyToggle=function ApplyToggle(j,h,f,g,i){if(j&&h&&j.tagName&&h.tagName){if(!f){h.style.display="none";j.className=g}else{h.style.display="";j.className=i}Jlib.AppendEvent(j,"click",function(a){if(h.style.display=="none"){h.style.display="";j.className=i}else{h.style.display="none";j.className=g}Jlib.StopEvent(a)});return true}return Jlib.Error("Invalid/Missing input parameters.")};Jlib.AddClass=function AddClass(c,d){if(!(c&&c.tagName&&(typeof d==="string"))){return Jlib.Error("Invalid/Missing input parameters.")}if(c.className.indexOf(d)!=-1){c.className+=" "+d}};Jlib.RemoveClass=function RemoveClass(d,c){if(!(d&&d.tagName)){return Jlib.Error("Invalid/Missing input parameters.")}if(c&&(typeof c==="string")){d.className.replace(c,"")}else{d.className=""}};VANYLLAJS_PATH=Jlib.install_folder;VANYLLAPHP_PATH="vanyllaphp/";var Client={browser:Jlib.Browser.engine,ie_version:Jlib.Browser.ie_version,language:Jlib.Browser.language,os:Jlib.Browser.OS};function Error(f,d,e){alert("Function Error() is DEPRECATED, use Jlib.Error();")}function DocumentAddOnClickEvent(b){alert("Function DocumentAddOnClickEvent() is DEPRECATED, use Jlib.AppendEvent().")}function WindowAddOnUnloadEvent(b){alert("Function WindowAddOnUnloadEvent() is DEPRECATED, use Jlib.AppendEvent().")}function AppendEvent(e,f,d){alert("Function AppendEvent() is DEPRECATED, use Jlib.AppendEvent().")}function GetAbsolutePosition(b){alert("GetAbsolutePosition() is DEPRECATED, use Jlib.GetElementXY().")}function mailto(){alert("mailto() is DEPRECATED, use Jlib.Util.mailto()")}function mailaddress(){alert("mailaddress() is DEPRECATED, use Jlib.Util.documentWriteMailAddress()")}function maillink(){alert("maillink() is DEPRECATED, use Jlib.Util.documentWriteMailLink()")}function CreateFlashObject(){alert("CreateFlashObject() is DEPRECATED, use Jlib.Util.documentWriteFlashObject()")}function SearchWebsite(){alert("SearchWebsite() is DEPRECATED, use Jlib.Util.SearchWebsite()")}Jlib.Browser.ClientAreaHorizVertScrolls=function(){alert("ClientAreaHorizVertScrolls() is DEPRECATED, use Jlib.Webpage object")};Jlib.Browser.ClientAreaWxH=function(){alert("ClientAreaWxH() is DEPRECATED, use Jlib.Webpage object")};Array.prototype.each=function each(b){alert("Array.prototype.each is DEPRECATED, use Array.prototype.foreach!")};
