//jCalix -- © 2010 Marc-Emmanuel Ramage & NVN STUDIOS
//jCalix sections
/*...............Specific.................*/

var base_url = 'http://www.mfilomeno.com/';

/*...............Core.................*/

var isIE = jCalix_checkNav('msie');
var isIE6 = jCalix_checkNav('msie 6');
var isIE7 = jCalix_checkNav('msie 7');
var isIE8 = jCalix_checkNav('msie 8');
var isChrome = jCalix_checkNav('chrome');
var isSafari = jCalix_checkNav('safari');
var isIphone = jCalix_checkNav('iphone');
var isIpad = jCalix_checkNav('ipad');
var isff = navigator.userAgent.toLowerCase().indexOf('firefox') + 1;
var isChromeMac = function() {
    var mac = jCalix_checkNav('macintosh');
    var chrome = jCalix_checkNav('chrome');
    if (mac != 0 && chrome != 0)
    return true;
    else
    return false;
}

//var onloadlist = new Array();
var histo = new Array();
var hashIndex = 0;
var ajax = false;
var currentHashIndex = 0;
var current_hash;
var fr = null;
var htmlpage = null;
var htmlbody = null;
var ajaxtimer = null;
var ajaxtimertick = 600;
var jCalix = new _$();


function _$(obj, options) {
    this.obj = obj;
    this.isArray = false;
    this.onloadlist = new Array();
    this.init = false;
    this.isEmpty = true;
    this.animate = false;
    if(this.obj)
    this.isEmpty = false;
    this.getObject = function(i) {
    	if (i === 0) i = '0';
        if (i != null && this.obj.length > 1)
        return this.obj[i];
        else
        return this.obj;
    }
    this.exists = function(){
    	if(this.obj)
    		return true;
    	else
    		return false;		
    }    
    this.get = function(i){
    	if(this.obj == null)
    	return null;
    	if (i === 0) i = '0';
    	if(this.isArray)
    	return this.obj[i];
    	else
    	return this.obj;
    }
    this.html = function(h) {

        if (h != null)
        this.obj.innerHTML = h;
        else
        return this.obj.innerHTML;
    }
 
    this.Display = function(d) {
        if (d)
        this.obj.style.display = d;
        else {
            var sty = this.Attributes('style');
            if(isIE7)
            return sty.display;
            if (sty) {
                if (sty.toLowerCase().indexOf('display: none') != -1)
                return 'none';
                else
                if (sty.toLowerCase().indexOf('display: block') != -1)
                return 'block';
                else
                if (sty.toLowerCase().indexOf('display: fixed') != -1)
                return 'fixed';
                else
                if (sty.toLowerCase().indexOf('display: inherited'))
                return 'inherited';
                else
                return null;
            } else
            return null;
        }
    }
    this.append = function(n) {
        this.obj.appendChild(n);
    }
    this.val = function(v) {
        if (v)
        this.Attributes('value', v);
        else
        return this.Attributes('value');
    }
    this.Attributes = function(n, v) {
        if (v)
        jCalix_setAttributes(this.obj, n, v);
        else
        return this.obj.getAttribute(n);
    }
    this.RemoveAttributes = function(n) {
    	if(isIE7 && n == 'class')
    	this.obj.removeAttribute('className');
    	else
        this.obj.removeAttribute(n);
    }   
    this.RemoveClass = function(c) {
    	if(isIE7)
	    this.obj.removeAttribute('className');
	    else
	    this.obj.removeAttribute('class');
    }     
    this.Class = function(c) {
        if (c)
        jCalix_setClass(this.obj, c);
        else
        return jCalix_getClass(this.obj);
    }
    this.Id = function(id) {
        if (id)
        jCalix_setId(this.obj, id);
        else
        return jCalix_getId(this.obj);
    }
    this.Click = function(val){
        this.obj.onclick = val;	
    }
    this.Change = function(val){
    	if(val)
        this.obj.onchange = val;	
        else
        return this.obj.onchange;
    }        
    this.Mouseover = function(val){
    	if(val)
        this.obj.onmouseover = val;	
        else
        return this.obj.onmouseover;
    }    
    this.Mouseout = function(val){
    	if(val)
        this.obj.onmouseout = val;	
        else
        return this.obj.onmouseout;
    }    
    this.Mousedown = function(val){
    	if(val)
        this.obj.onmousedown = val;	
        else
        return this.obj.onmousedown;
    }   
    this.Mouseup = function(val){
    	if(val)
        this.obj.onmouseup = val;	
        else
        return this.obj.onmouseup;
    }   
    this.Mousemove = function(val){
    	if(val)
        this.obj.onmousemove = val;	
        else
        return this.obj.onmousemove;
    }   
    this.Keydown = function(val){
    	if(val)
        this.obj.onkeydown = val;	
        else
        return this.obj.onkeydown;
    } 
    this.Keyup = function(val){
    	if(val)
        this.obj.onkeyup = val;	
        else
        return this.obj.onkeyup;
    }   
    this.Keypress = function(val){
    	if(val)
        this.obj.onkeypress = val;	
        else
        return this.obj.onkeypress;
    }    
    this.Load = function(val){
        this.obj.onload = val;	
    }    
    this.Href = function(){
    	return this.obj.href;	
    }    
    this.Length = function() {
        return this.obj.length;
    }
    this.Style = function() {
        return this.obj.style;
    }
    this.getStyle = function() {
        return jCalix_getStyle(this.obj);
    }
    this.getPosition = function() {
        return jCalix_getPosition(this.obj);
    }
    this.getRelativePosition = function(){
    	
    	return jCalix_getRelativePosition(this.obj);
    }
    this.setPosition = function(coord) {
        var pos = jCalix_getPosition(this.obj);
        if(coord.x != null)
         this.obj.style.left = pos.x+coord.x+'px';
        if(coord.y != null)
         this.obj.style.top = pos.y+coord.x+'px';         
    } 
    
    this.setRelativePosition = function(coord) {
    	
        if(coord.x != null)	
         this.obj.style.left = coord.x+'px';

        if(coord.y != null)
         this.obj.style.top = coord.y+'px'; 
        
    }       
    this.getWidth = function() {
        return this.obj.offsetWidth;
    }
    this.getHeight = function() {
        return this.obj.offsetHeight;
    }
    this.setWidth = function(w){
    	
    	this.obj.style.width = w+'px';	
    }
    this.setPadding = function(p){
    	
    	this.obj.style.padding = p+'px';	
    }   
    this.setHeight = function(h){
    	
    	this.obj.style.height = h+'px';	
    } 
    this.setOverflow = function(o,opt){
    	if(opt){
    		this.obj.overflowX = opt.x;
    		this.obj.overflowY = opt.y;
    	}else
    	this.obj.style.overflow = o;
    }        
    this.Opacity = function(v) {
    	if (v === 0) v = '0';
        if (v)
        jCalix_setOpacity(this.obj, v);
        else
        return jCalix_getOpacity(this.obj);
    }
    this.Clone = function(){
    	return new _$(this.obj);
    }
    this.Append = function(node){
    	this.obj.appendChild(node.getObject());
    }
    this.Delete = function(){
    

    	this.obj.parentNode.removeChild(this.obj);
    }
    this.Animate = function(op){
    	
    	jCalix_animate(this,op);
    
    }
        
    if (typeof _$.initialized == 'undefined') {
        _$.prototype.addOnLoad = function(callback) {
            this.onloadlist[this.onloadlist.length] = callback;
        }
        _$.prototype.onLoad = function() {

            jCalix_loadEvent(this.onloadlist);
        }
        _$.prototype.toArray = function(tab) {
            return jCalix_toArray(tab);
        }
        _$.prototype.strContains = function(s1, s2) {
            return jCalix_containsString(s1, s2);
        }
        _$.prototype.setCookie = function(n, v, d) {
            jCalix_setCookie(n, v, d);
        }
        _$.prototype.getCookie = function(n) {
            return jCalix_getCook(n);
        }
        _$.prototype.checkNavigator = function(n) {
            return jCalix_checkNav(n);
        }
        _$.prototype.ajaxRequest = function(u, p, po, c) {
            return jCalix_ajax_request(u, p, po, c);
        }
        _$.prototype.ajaxSetLinks = function(options) {
            if (options == null)
            options = {
                callback_before: null,
                callback_in: null,
                callback_after: null
            };
            jCalix_setup_ajax_links(options.callback_before, options.callback_in, options.callback_after);
        }
        _$.prototype.initAjax = function() {
            jCalix_init_ajax();
        }
        _$.prototype.initAjaxHistory = function() {
            jCalix_init_history();
        }
        _$.prototype.addHistoryEntry = function(u, p) {
            jCalix_add_history_entry(u, p);
        }
        _$.prototype.CreateElement = function(n) {
            return new _$(document.createElement(n));
        }        
        _$.initialized = true;
    }
    if (obj) {
        var ret;
        if (typeof obj == 'object' || typeof obj == 'function')
        return this;        
        else {
            this.init = true;
            if (options == null)
            options = {
                node: null,
                index1: null,
                index2: null
            };
            if (obj.charAt(0) == ':') {
                obj = obj.split(':');
                obj = obj[1];
                if (options.node) {
                    if (options.index1 != null) {
                        this.obj = options.node.getElementsByTagName(obj)[options.index1];
                        return new _$(this.obj);
                    }
                    else {
                        this.obj = options.node.getElementsByTagName(obj);
                        if (this.obj)
                        if (this.obj.length == 1)
                        return new _$(this.obj[0]);
                        return jCalix_build_object_list(this.obj);
                    }
                } else {
                    if (options.index1 != null) {
                        this.obj = document.getElementsByTagName(obj)[options.index1];
                        return new _$(this.obj);
                    }
                    else {
                        this.obj = document.getElementsByTagName(obj);
                        if (this.obj)
                        if (this.obj.length == 1)
                        return new _$(this.obj[0]);
                        return jCalix_build_object_list(this.obj);
                    }
                }
            }
            if (obj.indexOf('#') != -1) {
                if (obj.indexOf(':') != -1) {
                    obj = obj.split(':');
                    if (document.getElementById(obj[0].substr(1)) == null) {
                        this.obj = null;
                        return new _$(this.obj);
                    }
                    if (options.index1 != null) {
                        if (options.node != null) {
                            this.obj = options.node.getElementById(obj[0].substr(1)).getElementsByTagName(obj[1])[options.index1];
                            return new _$(this.obj);
                        }
                        else {
                            this.obj = document.getElementById(obj[0].substr(1)).getElementsByTagName(obj[1])[options.index1];
                            return new _$(this.obj);
                        }
                    }
                    else {
                        if (options.node != null) {
                            this.obj = options.node.getElementById(obj[0].substr(1)).getElementsByTagName(obj[1]);
                            if (this.obj)
                            if (this.obj.length == 1)
                            return new _$(this.obj[0]);
                            return jCalix_build_object_list(this.obj);
                        }
                        else {
                            this.obj = document.getElementById(obj[0].substr(1)).getElementsByTagName(obj[1]);
                            if (this.obj)
                            if (this.obj.length == 1)
                            return new _$(this.obj[0]);
                            return jCalix_build_object_list(this.obj);
                        }
                    }
                } else
                if (options.node != null) {
                    this.obj = options.node.getElementById(obj.substr(1));
                    return new _$(this.obj);
                }
                else {
                    this.obj = document.getElementById(obj.substr(1));
                    return new _$(this.obj);
                }
            }
            else {
                if (options.index1 != null) {
                    if (obj.indexOf(':') != -1) {
                        obj = obj.split(':');
                        if (options.index2 != null) {
                            if (options.node != null) {
                                ret = jCalix_getElementsByClass(obj[0].substr(1), options.node);
                                if (ret != null) {
                                    if (ret[options.index1] == null)
                                    return new _$(null);
                                    this.obj = ret[options.index1].getElementsByTagName(obj[1])[options.index2];
                                    return new _$(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                            else {
                                ret = jCalix_getElementsByClass(obj[0].substr(1));
                                if (ret != null) {
                                    if (ret[options.index1] == null)
                                    return new _$(null);
                                    this.obj = ret[options.index1].getElementsByTagName(obj[1])[options.index2];
                                    return new _$(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                        } else {
                            if (options.node != null) {
                                ret = jCalix_getElementsByClass(obj[0].substr(1), options.node);
                                if (ret != null) {
                                    if (ret[options.index1] == null)
                                    return new _$(null);
                                    this.obj = ret[options.index1].getElementsByTagName(obj[1]);
                                    if (this.obj.length == 1)
                                    return new _$(this.obj[0]);
                                    return jCalix_build_object_list(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                            else {
                                ret = jCalix_getElementsByClass(obj[0].substr(1));
                                if (ret != null) {
                                    if (ret[options.index1] == null)
                                    return new _$(null);
                                    this.obj = ret[options.index1].getElementsByTagName(obj[1]);
                                    if (this.obj.length == 1)
                                    return new _$(this.obj[0]);
                                    return jCalix_build_object_list(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                        }
                    } else {
                        if (options.node != null) {
                            ret = jCalix_getElementsByClass(obj.substr(1), options.node);
                            if (ret != null) {
                                this.obj = ret[options.index1];
                                return new _$(this.obj);
                            }
                            else {
                                this.obj = null;
                                return new _$(this.obj);
                            }
                        }
                        else {
                            ret = jCalix_getElementsByClass(obj.substr(1));
                            if (ret != null) {
                                this.obj = ret[options.index1];
                                return new _$(this.obj);
                            }
                            else {
                                this.obj = null;
                                return new _$(this.obj);
                            }
                        }
                    }
                }
                else {
                    if (obj.indexOf(':') != -1) {
                        obj = obj.split(':');
                        if (options.index2 != null) {
                            if (options.node != null) {
                                ret = jCalix_getElementsByClass(obj[0].substr(1), options.node);
                                if (ret != null) {
                                    if (ret[0] == null)
                                    return new _$(null);
                                    this.obj = ret[0].getElementsByTagName(obj[1])[options.index2];
                                    return new _$(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                            else {
                                ret = jCalix_getElementsByClass(obj[0].substr(1));
                                if (ret != null) {
                                    if (ret[0] == null)
                                    return new _$(null);
                                    this.obj = ret[0].getElementsByTagName(obj[1])[options.index2];
                                    return new _$(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                        } else {
                            if (options.node != null) {
                                ret = jCalix_getElementsByClass(obj[0].substr(1), options.node);
                                if (ret != null) {
                                    if (ret[0] == null)
                                    return new _$(null);
                                    this.obj = ret[0].getElementsByTagName(obj[1]);
                                    if (this.obj.length == 1)
                                    return new _$(this.obj[0]);
                                    return jCalix_build_object_list(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                            else {
                                ret = jCalix_getElementsByClass(obj[0].substr(1));
                                if (ret != null) {
                                    if (ret[0] == null)
                                    return new _$(null);
                                    this.obj = ret[0].getElementsByTagName(obj[1]);
                                    if (this.obj.length == 1)
                                    return new _$(this.obj[0]);
                                    return jCalix_build_object_list(this.obj);
                                }
                                else {
                                    this.obj = null;
                                    return new _$(this.obj);
                                }
                            }
                        }
                    } else {
                        if (options.node != null) {
                            this.obj = jCalix_getElementsByClass(obj.substr(1), options.node);
                            if (this.obj)
                            if (this.obj.length == 1)
                            return new _$(this.obj[0]);
                            return jCalix_build_object_list(this.obj);
                        }
                        else {
                            this.obj = jCalix_getElementsByClass(obj.substr(1));
                            if (this.obj)
                            if (this.obj.length == 1)
                            return new _$(this.obj[0]);
                            return jCalix_build_object_list(this.obj);
                        }
                    }
                }
            }
        }
    }
}

function jCalix_build_object_list(list){
	if(list == null)
	return new _$(null);
	var array = new Array(list.length);
	for(var i = 0;i<list.length;i++)
		array[i] = new _$(list[i]);
	var nobj = new _$(array);
	nobj.isArray = true;
	return nobj;	

}

function jCalix_getElementsByClass(searchClass, domNode, tagName) {
    if (domNode == null) domNode = document;
    if (tagName == null) tagName = '*';
    var el = new Array();
    var tags = domNode.getElementsByTagName(tagName);
    var tcl = ' ' + searchClass + ' ';
    for (i = 0, j = 0; i < tags.length; i++) {
        var test = ' ' + tags[i].className + ' ';
        if (test.indexOf(tcl) != -1)
        el[j++] = tags[i];
    }
    if (el.length == 0)
    return null;
    else
    return el;
}


function jCalix_do_onload(callback) {
    onloadlist[onloadlist.length] = callback;
}


function jCalix_loadEvent(l) {
    window.onload = function() {
        for (var i = 0; i < l.length; i++)
        l[i]();
        return true;
    }
}


/*...............End..Core.................*/

/*...............animate...................*/



function jCalix_slideshow(contain,options){	
	var container = _$(contain);
	var elemtype = 'li';
	var slider = true;
	var slidesize = 468;
	var bigimg = false;
	var horiz = true;
	var speed = 300;
	var effect = 'translation';
	var top = 0;
	var left = 0;
	var fading = false;
	var cycle = false;
	var interval = 2000;
	var prev = '#prevslide';
	var next = '#nextslide';

if(options){
	if(options.slidesize)
		slidesize = options.slidesize;
	if(options.bigimg)
		bigimg = _$(options.bigimg);
	if(options.speed)
		speed = options.speed;
	if(options.effect){
		effect = options.effect;
		top = options.effect.top;
		left = options.effect.left;
		fading = options.effect.fading;
	}
	if(options.cycle)
		cycle = options.cycle;
	if(options.interval)
		interval = options.interval;
	if(options.prev)
		prev = options.prev;
	if(options.next)
		next = options.next;	
	if(options.elemtype)
		elemtype = options.elemtype;		
}
if(bigimg.exists()){	
	var imgs = bigimg.getListByTag('img');
	for(var i = 1; i < imgs.Length(); i++)
		imgs.get(i).Display('none');	
}
if(slider){
container.Parent().setOverflow('hidden');	
container.Parent().setWidth(slidesize);	
container.setWidth(10000);
container.setPadding(0);
var parentsize = container.Parent().getWidth();
var childs = container.getListByTag(elemtype);

for(var i = 0; i < childs.Length(); i++){	
	if(horiz)	
		childs.get(i).Display('inline');
		if(bigimg.exists()){
		childs.get(i).getObject().src = i;		
		childs.get(i).Click(function(){
	if(fading)
		jCalix.Animate(bigimg,{effect:{fading:'fadeout'},speed:100,after:function(){jCalix.Animate(bigimg,{effect:{fading:'fadein'},speed:100});}});			
	for(var j = 0; j < imgs.Length(); j++){
		if(j == this.src){			
			imgs.get(j).Display('block');			
		}
		else{
			imgs.get(j).Display('none');
		}
	}			
			});
		}
}
if(next){
	 _$(next).Click(function(){jCalix.Animate(container,{speed:speed,effect:{name:'translation',left:'-380'}});return false;});	
}

if(prev){	
	 _$(prev).Click(function(){jCalix.Animate(container,{speed:speed,effect:{name:'translation',left:'0'}});return false;});	
}
}
	return false;	
}



function jCalix_animate(elem,options){

var speed = 300;
var effect = '';
var fading = null;
var orgtop = elem.getRelativePosition().y;
orgtop = Math.round(orgtop*100)/100;
var orgleft = elem.getRelativePosition().x;
orgleft = Math.round(orgleft*100)/100;
var top = '0';
var left = '0';
var after = null;
var before = null;
if(options){  	
  if(options.speed)
  	speed = options.speed;  	
  if(options.effect){
  	if(options.effect.name)
  		effect = options.effect.name; 
  	if(options.effect.left)
  		left = options.effect.left;
  	if(options.effect.top)
  		top = options.effect.top;
  	if(options.effect.fading)
  		fading = options.effect.fading;  
  	if(options.after)
  	if(options.before)
  		before = options.before;   	
  		after = options.after;	
  	if(options.orgleft){
  		orgleft = options.orgleft;
  		elem.setRelativePosition({x:orgleft,y:'0'});
  		}				 
  }  	
}
left = Math.round(left*100)/100;
top = Math.round(top*100)/100;

var fadeoutfunction = function(){jCalix_fade(elem,true,speed,{after:after,before:before});}
var fadeinfunction = function(){jCalix_fade(elem,false,speed,{after:after,before:before});}
var translatefunction = null;
if(fading)
translatefunction = function(){jCalix_translate(elem,speed,left,top,{orgtop:orgtop,orgleft:orgleft});}
else
translatefunction = function(){jCalix_translate(elem,speed,left,top,{after:after,before:before,orgtop:orgtop,orgleft:orgleft});}
if(fading == 'fadein')
	setTimeout(fadeinfunction,0);
else
if(fading == 'fadeout')
	setTimeout(fadeoutfunction,0);	
if(options){
	if(effect == 'translation'){
		setTimeout(translatefunction,0);
}	
}	
}


function jCalix_fade(element,out,speed,options){

if(options && ((element.Opacity() <= 0 && out) || (element.Opacity() >= 1 && !out)))
  if(options)
  	if(options.before){
		options.before();
		options.before = null;
	}
var time = 10;
var step = (1/speed)*10;
step = Math.round(step*100)/100;
if((element.Opacity() >= 1 && !out) || (element.Opacity() <= 0 && out)){
	if(options)
	if(options.after){
		options.after();	
		options.after = null;
	}
	return false;	
}
	if(out){
	if(element.Opacity()-step >= 0)
	element.Opacity(element.Opacity()-step);
	else
	element.Opacity(0);
	}
	else{
	if(parseFloat(parseFloat(element.Opacity())+step) <= 1)
	element.Opacity(parseFloat(parseFloat(element.Opacity())+step));
	else
	element.Opacity(1);
	}
	setTimeout(function(){jCalix_fade(element,out,speed,options)},time);
}


function jCalix_translate(element,speed,left,top,options){
  if(options)
  	if(options.before){
		options.before();
		options.before = null;
	}
var orgtop = '0';
var orgleft = '0';
if(options){
if(options.orgtop)
	orgtop = options.orgtop;
if(options.orgleft)
	orgleft = options.orgleft;
}

var relx = Math.round(element.getRelativePosition().x*100)/100;	
var rely = Math.round(element.getRelativePosition().y*100)/100;
var absleft = Math.abs(left);
var abstop = Math.abs(top);
var tmpx = 0;
var tmpy = 0;
if(left - orgleft < 0)
tmpx = parseFloat(left-orgleft);
else
tmpx = Math.abs(parseFloat(left-orgleft));
if(top - orgtop < 0)
tmpy = parseFloat(top-orgtop);
else
tmpy = Math.abs(parseFloat(top-orgtop));
/*
if( ((left - orgleft < 0) && (Math.abs(relx) >= absleft)) || ((top - orgtop < 0) && (Math.abs(rely) >= abstop)))
		return false;
*/

if(orgleft - left > 0){
if(relx <= left && rely <= top){
	if(options)
	if(options.after){
		options.after();	
		options.after = null;
	}
	
	return false;
}
}else{
if(relx >= left && rely >= top){
	if(options)
	if(options.after){
		options.after();	
		options.after = null;
	}
	
	return false;
}
}
var transstepleft = parseFloat(tmpx/(speed/10));
transstepleft = Math.round(transstepleft*100)/100;
var transsteptop = parseFloat(tmpy/(speed/10));
transsteptop = Math.round(transsteptop*100)/100;
var transpeed = 10;	
element.getObject().style.position = 'relative';
var posx = parseFloat(parseFloat(relx)+transstepleft);
var posy = parseFloat(parseFloat(rely)+transsteptop);
posx = Math.ceil(posx*100)/100;
posy = Math.round(posy*100)/100;


if(posx < left && left - orgleft < 0 && posx != left)
	posx = left;
else
	if(posx > left && left - orgleft > 0 && posx != left)
		posx = left;		
if(posy < top && top - orgtop < 0 && posy != top)
	posy = top;
else
	if(posy > top && top - orgtop > 0 && posy != top)
		posy = top;
element.setRelativePosition({x:posx,y:posy});
setTimeout(function(){jCalix_translate(element,speed,left,top,options);},transpeed);
}


/*...............End animate.............*/

/*...............Utility.................*/


function jCalix_setAttributes(obj, n, v) {
    obj.setAttribute(n, v);
}


function jCalix_getClass(obj) {
    if (isIE7)
    return obj.getAttribute('className');
    else
    return obj.getAttribute('class');
}


function jCalix_setClass(obj, clas, add) {
    if (isIE7) {
        if (add)
        obj.setAttribute('className', jCalix_getClass(obj) + ' ' + clas);
        else
        obj.setAttribute('className', clas);
    } else {
        if (add)
        obj.setAttribute('class', jCalix_getClass(obj) + ' ' + clas);
        else
        obj.setAttribute('class', clas);
    }
}


function jCalix_getId(obj) {
    return obj.getAttribute('id');
}


function jCalix_setId(obj, ids) {
    obj.setAttribute('id', ids);
}


function jCalix_getStyle(obj) {
    return obj.getAttribute('style');
}


function jCalix_containsString(string1, string2) {
    if (string1 == null) return false;
    var ind = string1.indexOf(string2);
    if (ind != -1)
    return true;
    else
    return false;
}


function jCalix_setOpacity(obj, value) {
    if (isIE)
        obj.style["filter"] = "alpha(opacity="+(value * 100)+")";
    else
    obj.style.opacity = value;
}


function jCalix_getOpacity(obj) {
    if (obj.getAttribute('style') == null) {
        return 1;
    }
    if (isIE) {
        if (isIE7 && !isIE8) {
            if (obj.getAttribute('style').filter == '')
            return 1;
        } else
        if (obj.getAttribute('style').toLowerCase().indexOf('opacity') == -1)
        return 1;
        var opacit = obj.style.filter;
        opacit = opacit.split('=');
        if(opacit[1] == null)
        	return 1;
        opacit = opacit[1].split(')');
        return (opacit[0] / 100);
    } else {
    	
        if (obj.getAttribute('style').indexOf('opacity') == -1)
        return 1;
        else
        if(obj.style.opacity == '')
        return 1;        
        return obj.style.opacity;
    }
}


function jCalix_setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
    ((expiredays == null) ? "": ";expires=" + exdate.toGMTString());
}


function jCalix_getCook(nom) {
    deb = document.cookie.indexOf(nom + "=")
    if (deb >= 0) {
        deb += nom.length + 1
        fin = document.cookie.indexOf(";", deb)
        if (fin < 0) fin = document.cookie.length
        return unescape(document.cookie.substring(deb, fin))
    }
    return null;
}


function jCalix_checkNav(string) {
    place = navigator.appVersion.toLowerCase().indexOf(string) + 1;
    thestring = string;
    return place;
}


function jCalix_getPosition(e) {
    var left = 0;
    var top = 0;
    if (e != null) {
        while (e.offsetParent) {
            left += e.offsetLeft;
            top += e.offsetTop;
            e = e.offsetParent;
        }
        left += e.offsetLeft;
        top += e.offsetTop;
    }
    return {
        x: left,
        y: top
    };
}


function jCalix_getRelativePosition(e){
	
	var x = 0;
	var y = 0;
	
	   if(e.style){
	   	
	   	  if(e.style.left)
	   	  	x = e.style.left.replace('px','');
	   	  if(e.style.top)
	   	  	y = e.style.top.replace('px','');	   	  
	   	  	
	    return {
        x: x,
        y: y
    };	   	  	
	   	  		
	   	
	   }
	   else	   	
	    return {
        x: x,
        y: y
    };
	
}

function jCalix_toArray(tab) {
    var array = new Array();
    for (var i = 0; i < tab.Length(); i++)
    array[i] = tab.get(i).getObject();
    return array;
}

/*...............End..Utility.................*/


/*...............Ajax.................*/


var hash = '';
var parameters = '';


function jCalix_ajax_request(url, parameters, post, callback) {
    http_request = true;
    if (window.XMLHttpRequest) {
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) {
        try {
            http_request = new ActiveXObject("MSXML2.XMLHTTP.3.0");
        } catch(e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {}
        }
    }
    if (!http_request) {
        alert('Cannot create XMLHTTP instance');
        return false;
    }
    if (post == false) {
        http_request.open('GET', url, true);
        http_request.send(null);
    }
    else {
        http_request.open('POST', url, true);
        //http_request.setRequestHeader("Content-length", parameters.length);
        http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        if (!isSafari)
        http_request.setRequestHeader("Connection", "close");
        http_request.send(parameters);
    }
    http_request.onreadystatechange = function() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                hash = url.replace(base_url, '');
                if (parameters)
                hash += '?' + parameters;
                hash = '/' + hash;
                if(callback)
                callback(url, parameters);
            }
        }
    }
    return http_request;
}


function jCalix_setup_ajax_links(callback_before, callback_in, callback_after) {
    if (callback_before)
    callback_before();
    //website specific
    var doc_links = _$(':a');
    for (var i = 0; i < doc_links.Length(); i++) {
        if (jCalix_containsString(doc_links.get(i).Class(), 'n1') || jCalix_containsString(doc_links.get(i).Class(), 'n2') || jCalix_containsString(doc_links.get(i).Class(), 'p1') || jCalix_containsString(doc_links.get(i).Class(), 'p2') || doc_links.get(i).Attributes('onclick'))
        continue;
        var l = doc_links.get(i).Href();
        var splitlink = l.split('?');
        if (doc_links.get(i).Id() == 'albumleft') {        	
            if (!jCalix_containsString(_$('#bodyclass').html(), 'contact') && !jCalix_containsString(_$('#bodyclass').html(), 'creations') && !jCalix_containsString(_$('#bodyclass').html(), 'dotslide'))
            doc_links.get(i).Click(slideleft);
            else
            doc_links.get(i).Click(previmg);
        } else
        if (doc_links.get(i).Id() == 'albumright') {
            if (!jCalix_containsString(_$('#bodyclass').html(), 'contact') && !jCalix_containsString(_$('#bodyclass').html(), 'creations') && !jCalix_containsString(_$('#bodyclass').html(), 'dotslide'))
            doc_links.get(i).Click(slideright);
            else
            doc_links.get(i).Click(nextimg);            
        }
        else {
            doc_links.get(i).Click(function() {
                if (!enableclick || ajax)
                return false;
                ajax = true;
                //website specific	
                if (jCalix_getClass(this)) {
                    if (jCalix_getClass(this).indexOf('lang') != -1) {
                        var langid = this.id;
                        jCalix_setCookie('lang', langid, 365);
                    }
                }
                jCalix_ajax_request(this.href.split('?')[0], this.href.split('?')[1], true, callback_in);
                return false;
            });

        }
    }
    if (callback_after)
    callback_after();
    ajax = false;
    return false;
}


function jCalix_init_ajax() {
    var cont = document.createElement('div');
    jCalix_setId(cont, 'content-receiver');
    jCalix_setClass(cont, 'ajaxbuffer');
    _$(':body', {
        index1: 0
    }).append(cont);
}

/*...............End..Ajax.................*/


/*...............Ajax History.................*/


function jCalix_init_history() {
    if (isIE7) {
        fr = document.createElement('iframe');
        fr.setAttribute('name', 'histoframe');
        fr.setAttribute('id', 'histoframe');
        fr.setAttribute('src', base_url);
        fr.style.display = 'none';
        fr.style.visibility = 'hidden';
        fr.style.width = '0';
        fr.style.height = '0';
    }
    var h = document.createElement('div');
    h.setAttribute('id', 'historyindex');
    h.innerHTML = '0';
    _$(':body', {
        index1: 0
    }).append(h);
    histo = new Array();
    htmlpage = _$('#ajax');
    htmlbody = _$(':body', {
        index1: 0
    });
    h.style.display = 'none';
    if (isIE7)
    h.appendChild(fr);
}


function jCalix_add_history_entry(url, parameters) {
    var found = false;
    currentHashIndex = hashIndex;
    var bhash = hash.split('html');
    if (bhash[1])
    window.location.hash = bhash[0] + 'html/' + encode64(bhash[1].replace('//', '/').replace('menu_id', 'mi').replace('dyn_id', 'di').replace('alb_id', 'ai')).replace('html', 'html/');
    else
    window.location.hash = hash;
    current_hash = window.location.hash;
    for (var i = histo.length - 1; i >= 0; i--) {
        if (histo[i]['key'] == url && histo[i]['parameters'] == parameters) {
            found = true;
            break;
        }
    }
    if (!found) {
        histo[hashIndex] = new Array();
        histo[hashIndex]['html'] = htmlpage.html();
        histo[hashIndex]['key'] = current_hash;
        histo[hashIndex]['parameters'] = parameters;
        histo[hashIndex]['id'] = htmlbody.Class();
    }
    if (isIE7) {
        window.frames['histoframe'].document.open();
        window.frames['histoframe'].document.write('<body>' + current_hash + '</body>');
        window.frames['histoframe'].document.close();
    }
    var ind = document.createElement('div');
    histo[hashIndex]['index'] = hashIndex;
    hashIndex++;
    if (ajaxtimer == null) ajaxtimer = window.setTimeout(jCalix_onTickCallback, ajaxtimertick);
    return false;
}


function jCalix_onTickCallback() {
    var found = false;
    var test = document.location.hash;
    if (isIE7)
    test = window.frames['histoframe'].document.body.innerHTML;
    if (current_hash != test) {
        if (isIE7)
        current_hash = test;
        else
        current_hash = document.location.hash;
        for (var i = histo.length - 1; i >= 0; i--) {
            if (current_hash == histo[i]['key']) {
                currentHashIndex = histo[i]['index'];
                found = true;
                break;
            }
        }
        if (found) {
            if (histo[currentHashIndex] != null) {
                htmlbody = _$(':body', {
                    index1: 0
                });
                htmlpage.html(histo[currentHashIndex]['html']);
			    if (!isIE6)
			    jCalix.ajaxSetLinks({
			        callback_in: ajaxResponse
			    });                  
                htmlbody.Class(histo[currentHashIndex]['id']);
                onLoad();
            } else {
                window.clearTimeout(ajaxtimer);
                ajaxtimer = null;
            }
        }
    }
    window.clearTimeout(ajaxtimer);
    ajaxtimer = window.setTimeout(jCalix_onTickCallback, ajaxtimertick);
}



/*...............End..Ajax History.................*/

// end jCalix sections


