﻿///<reference path="mootools-v1.2.js" />
var Site = new Events();
var Menu = new Class({
    Implements : [Options,Events],
    options : {
		orientation: "vertical",
		autoclose: true,
		closeonreclick: true,
		showvisited: true,
		menuPanelid : "myMenu",
		menuitemTag : "li",
		menuitemClass : "menuitem",
		openatstartup : '',
		getRandombackground : false,
		addLinkTothisPage : false,
		parentitemClass : "parentitem"
    },
    initialize: function(contentObject, options){
        this.setOptions(options);
        
		var rootElt = $(this.options.menuPanelid);

		if (Browser.Engine.trident && this.options.orientation == "horizontal") rootElt.setStyle("margin-top", -12);
		this.history = new HistoryManager();
		this.history.register("lbl",[""], this.getElementByLabel.bind(this),
		            function(values) {
						return ["lbl", '(', values[0], ')'].join('');
					}.bind(this),
					"lbl" + '\\((\[^)]+)\\)');
        
		this.currentElementId;
		this.numOfChanged = 0;
		this.hasStartUp = !(this.options.openatstartup == '');
		this.contentObject = contentObject;
		this.activeHover = [];
		this.allObjects = new Hash();
		this.populateMenu(rootElt);
        this.history.start();
        this.changeLinks("div#loginlink");
            
        if(Browser.Engine.trident || Browser.Engine.webkit) this.fixIELinksHome(null);
    },
    changeLinks: function (selectorStr) {
        $$(selectorStr).each(function(el) {
            var optionsElt = el.getElement("span.options");
            if($chk(optionsElt)){
                var label = optionsElt.getElement("span.label").get("html");
                var linkElt = el.getElement("a");
                if($chk(linkElt)){
                    if(label != ""){
                        linkElt.addEvent('click', this.contentObject.getcontent.pass({"label" : label},this.contentObject));
                        linkElt.href = "javascript:void(0)";
                    }
                }
            }
        },this);
        
    }, 
    fixIELinksHome : function (rootElt){
        var urlstr = window.location.href.replace("http://","");
        urlstr = urlstr.substring(0, urlstr.indexOf("/"));
        $$("a[href=/], a[href=../], a[href=/default.aspx], a[href=http://"+ urlstr + "], a[href=http://" + urlstr + "/]", rootElt).set({"href" : "javascript:void(0)",
                                                                 "events" : {"click" : this.getElementByLabel.pass([["startpage"]], this)}
                                                                 });
    },
    getElementByLabel : function (label) {
        if(label[0] == "") return;
        if(label[0] == "startpage") {
            if(this.hasStartUp) label[0] = this.options.openatstartup;
            else label[0] = "";
        } 
        if(!this.allObjects.get(label[0])) {
            this.contentObject.getcontent({"label" : label[0]});
            this.update($(this.options.menuPanelid));
            return;
        }
        this.contentObject.getcontent(this.allObjects.get(label[0]));
        this.update(this.allObjects.get(label[0]));
    },
    populateMenu: function(element){
        
        var isHorizontal = !(this.options.orientation.contains("vertical") || this.options.orientation.contains("simpleLine"));
        if(isHorizontal) element.addClass("h");
        else element.addClass("v");
        element.getElements(this.options.menuitemTag + "." + this.options.menuitemClass + "," + this.options.menuitemTag +"." + this.options.parentitemClass).each(function(el) {
            $extend($(el), this.createOptions(el));
            var linkElt = el.getElement("a");
            if(isHorizontal) {
                if($(el).getParent() == $(this.options.menuPanelid)) {
                    $(el).addClass("parentmenuBar");
                    $(el).setStyle("float","left");
                    if(Browser.Engine.trident4) $(el).setStyles({"display":"block","width":10});
                    $(el).addEvent('mouseleave', this.closeSub.pass(el,this));
                    this.parentHorizontalHover(el);
                    this.closeSub(el);
                } else $(el).addClass("menuBar");
            }
            if($chk(linkElt)){
                if($(el).label == "logout") return;
                linkElt.href = "javascript:void(0)";
                linkElt.addEvent('click', this.menuclicked.pass(el,this));
                if($(el).label != ""){
                    linkElt.addEvent('click', this.contentObject.getcontent.pass(el,this.contentObject));
                    linkElt.href = "javascript:void(0)";
                    this.allObjects.set($(el).label,el);
                    if(this.options.addLinkTothisPage) linkElt.addEvent('click', this.changeLinkTothisPage.pass($(el).label,this));
                }
                
                if($(el).hasClass(this.options.parentitemClass) && isHorizontal){
                    $(el).addEvent('mouseenter', this.parentHorizontalHover.pass(el,this));
                    //$(el).addEvent('mouseleave', this.closeSub.pass(el,this));
                }
            }
        },this);
        if(this.hasStartUp) this.getElementByLabel([this.options.openatstartup]);
    },
    parentHorizontalHover : function (el) {
        if(!$chk(el.subPosition)) {
            var childElt = $(el).getElement("ul")
            if($chk(childElt)){
                var coord = $(el).getCoordinates();
                $(childElt).setStyles({"position" : "absolute", "top" : (Browser.Engine.trident ? coord.bottom - 3 : coord.bottom), "left" : coord.left, "z-index" : 10});
                
                $(childElt).addEvent('mouseleave', this.closeSub.pass($(el),this))
            }
            $extend(el, {"subPosition" : true});
        }
        this.activeHover.include(el);
        var tpel = el;
        while($chk(el) && el != $(this.options.menuPanelid)){
            this.setActive(el);
            el = el.getParent()
        }
        
    },
    parentHorizontalOut : function(el) {
        el.removeClass("active");
    },
    createOptions : function (elt) {
    
        var curObj = this.contentObject.cO.get(elt.get('id'))
        
        var label = "";
        var backStr = "";
        if($chk(curObj.label)) label = curObj.label;
        if($chk(curObj.backStr)) backStr = curObj.backStr;
        var optobj = {
            "label" : label,
            "backStr" : backStr
        }
        return optobj;
    },
    closeSub : function (parentElt) {
        this.activeHover.each(function (thisElt) {
             var thisElttemp = thisElt;
             while($chk(thisElttemp) && thisElttemp != $(this.options.menuPanelid)){
                    if(thisElttemp.hasClass("activeParent")) thisElttemp.removeClass("activeParent");
                    this.setInactive(thisElttemp);
                    thisElttemp = thisElttemp.getParent();
             }
         }.bind(this));
         elt = $(this.currentElementId);
         while($chk(elt) && elt != $(this.options.menuPanelid)){
                if(elt.hasClass("parentmenuBar")) elt.addClass("activeParent");
                elt = elt.getParent()
         }
    },
    menuclicked: function(elt){
        
        if(this.options.showvisited) elt.addClass("visited");
        this.update(elt);
        Site.fireEvent('onPageChange');
        this.numOfChanged +=1;
        this.history.setValue("lbl",0, elt.label);
        if(this.options.getRandombackground) $E("body").setStyle("background-image","url(/returnbandeaux.aspx?"+$random(0,100)+")");
        if(elt.hasClass(this.options.menuitemClass)) this.fireEvent('onMenuClicked');
        if(elt.hasClass(this.options.parentitemClass)) this.fireEvent('onParentMenuClicked');
    },
    changeLinkTothisPage : function(labelString) {
        if($chk($("linktothispageLink"))) $("linktothispageLink").setProperty("href","/?lbl=" + labelString);
    },
    update: function(elt) {
        
        var currentElement = $(this.currentElementId);
        if(elt != currentElement && !elt.hasClass('active')) {
            if(this.options.autoclose){
                while($chk(currentElement) && currentElement != $(this.options.menuPanelid)){
                    this.setInactive(currentElement);
                    if(currentElement.hasClass("activeParent")) currentElement.removeClass("activeParent");
                    currentElement = currentElement.getParent()
                }
            }
            elt = $(elt);
            this.currentElementId = elt.get("id");
            while($chk(elt) && elt != $(this.options.menuPanelid)){
                this.setActive(elt);
                elt = elt.getParent()
            }
        } else if(this.options.closeonreclick && elt.hasClass('active')) {
            
            while(currentElement && currentElement != $(this.options.menuPanelid) && currentElement != elt){
                this.setInactive(currentElement);
                currentElement = currentElement.getParent();
            }
            this.currentElementId = elt.get("id");
        }
    },
    setActive: function(elt) {
        elt.addClass('active');
    },
    setInactive: function(elt) {
        elt.removeClass('active');
    }
});
var Content = new Class({
    Implements: [Options, Events],
    initialize: function(options) {
        this.setOptions({
            mainpanelid: "contentPanel",
            defaultclass: "contentpage",
            cO: false,
            loaderIcon: "/assets/ajax-loader.gif"
        }, options);
        if (!this.options.cO) return false;
        this.cO = $H(this.options.cO);
        var mainpanel = $(this.options.mainpanelid);
        this.currentelementId;
        this.currentRequest;
        //this.mainTitle = document.title;
        var loadDiv = new Element('div', { 'id': 'loadingIcon', 'class': 'contentpage' }).injectInside(mainpanel);
        this.hideLoading();
        new Element('img', { 'alt': 'loading page', 'src': this.options.loaderIcon }).injectInside(loadDiv);
        /// todo : events
        if (Browser.Engine.trident) this.addEvent("onContentChanged", this.fixObjectIE7.bind(this));
    },
    fixObjectIE7: function(elt) {
        $(elt).getElements("hr").each(function(hrElt) {
            var container = new Element("div", { "class": "separator" }).inject(hrElt, "before");
            container.set("html", "<!-- IE -->");
            hrElt.destroy();
        });
    },
    getcontent: function(elt) {
        var curElt = $(this.currentelementId);
        if (curElt && curElt.hasClass('active')) curElt.removeClass('active');

        if ($chk($(elt.label)) && $(elt.label).get("html") != "") {
            
            this.currentelementId = elt.label;
            curElt = $(elt.label);
            curElt.addClass('active');
            curElt.setStyle("opacity",1);
            
            if ($chk(elt.getElement) && $chk(elt.getElement("a"))) document.title =  elt.getElement("a").get("text");
            
        } else {
            var newDiv = $(elt.label) ? $(elt.label).addClass('active') : 
                                        new Element('div').addClass(this.options.defaultclass)
                                                          .addClass('active')
                                                          .setProperty('id', elt.label)
                                                          .setStyle("opacity", 0)
                                                          .injectInside($(this.options.mainpanelid));
            
            if ($chk(this.currentRequest)) this.currentRequest.cancel();
            this.currentRequest = new Request.HTML({ url: '/ajax/ReturnPage.aspx', 
                                                     update: newDiv, 
                                                     onSuccess: function(divId) { 
                                                                        $(divId).setStyle('opacity', 1); 
                                                                        this.hideLoading(); 
                                                                        Site.fireEvent('onContentChanged', divId); }.pass(elt.label, this), 
                                                     onFailure: this.hideLoading.bind(this)}).post({ 'label': elt.label });
            this.currentelementId = elt.label;
            if ($chk(elt.getElement)) document.title =  elt.getElement("a").get("text");
            this.showLoading();
        }
        if ($chk(elt.backStr)) this.changeBackGround(elt);
        Site.fireEvent('onPageChange', elt.label);
    },
    changeBackGround: function(elt) {
        //        document.body.style.backgroundImage = "url('"+elt.backStr.split("|")[0]+"')";
        //        document.body.style.backgroundRepeat = (elt.backStr.split("|")[1]=="true"?"repeat":"no-repeat");
        //        document.body.style.backgroundPosition = elt.backStr.split("|")[2];
    },
    showLoading: function() {
        $("loadingIcon").setStyle('display', 'block');
    },
    hideLoading: function() {
        $("loadingIcon").setStyle('display', 'none');
    }
});
var News = new Class({
    Implements: [Events, Options],
    options: {
        autoclose: true,
        mainContainerid : "",
        newsListContainerClass: "newsList",
        newsListItemClass: "newsListitem",
        newsItemHeaderClass: "newsHeader",
        newsItemContentClass: "newsContent",
        openFirstNews: false,
        newsMode: "inline",
        hasIcon: false,
        backText: "page précedente"
    },
    initialize: function(menuOcc, mainContainerid, options) {
        this.setOptions(options);
        this.options.mainContainerid = mainContainerid;
        var mainContainer = $(mainContainerid);
        this.currentelementId = false;
        this.allNews = new Hash();
        
        this.populatePanel();
        Site.addEvent('onPageChange', this.inpageReinit.bind(this));
        if (this.options.openFirstNews && this.allNews.getKeys().length > 0) this.getNews(this.allNews.getKeys()[0])
    },
    populatePanel: function() {
        if (this.options.newsMode == "inpage") {
            new Element("div", {"id" : this.options.mainContainerid + "_hCont", "styles": { "display": "block"} }).inject($(this.options.mainContainerid));
            new Element("div", {"id" : this.options.mainContainerid + "_cCont", "styles": { "display": "none"} }).inject($(this.options.mainContainerid));
        }
        $(this.options.mainContainerid).getElements("." + this.options.newsListItemClass).each(function(elt, i) {
            var curnews = new Hash();
            curnews.set('h', $chk(elt.getElement("." + this.options.newsItemHeaderClass)) ? elt.getElement("." + this.options.newsItemHeaderClass) : false);
            curnews.set('c', $chk(elt.getElement("." + this.options.newsItemContentClass)) ? elt.getElement("." + this.options.newsItemContentClass) : false);
            curnews.set('i', this.options.hasIcon ? new Element('div', { 'class': 'newsIconClosed' }).inject(curnews.get('h'), 'top') : false);
            
            if (curnews.get("h")) {
                elt.addEvent('click', this.getNews.pass("n" + i, this));
                curnews.get("h").set('href', 'javascript:void(0);');
            }
            if (curnews.get("c")) curnews.get("c").setStyle("display", "none");
            if (this.options.newsMode == "inpage") {
                if (curnews.get("c")) curnews.get("c").inject($(this.options.mainContainerid + "_cCont"));
                if (curnews.get("h")) curnews.get("h").inject($(this.options.mainContainerid + "_hCont")).addEvent('click', this.getNews.pass("n" + i, this));
                elt.destroy();
            }
            this.allNews.set("n" + i, curnews);
        }, this);
        if (this.options.newsMode == "inpage") new Element('a', { 'class': 'inpageBackButton', 'text': this.options.backText, "events": { "click": this.getBackToList.bind(this)} }).injectInside($(this.options.mainContainerid + "_cCont"));
    },
    toggleIcon: function(bool, curnews) {
        if (curnews && curnews.get("i")) curnews.get("i").removeClass(bool ? "newsIconClosed" : "newsIconOpened").addClass(bool ? "newsIconOpened" : "newsIconClosed")
        return curnews;
    },
    getNews: function(allNewsid) {
        switch (this.options.newsMode) {
            case "inline":
                this.getnewsInline(allNewsid);
                break;
            case "inpage":
                this.getnewsInPage(allNewsid);
                break;
        }

    },
    getnewsInline: function(allNewsid) {
        if (this.options.autoclose && $chk(this.allNews.get(this.currentelement))) {
            this.toggleIcon(false, this.allNews.get(this.currentelement)).c.setStyle("display", "none");
        }
        
        var toggleback = false;
        if(this.allNews.get(allNewsid).c) {
            toggleback = this.allNews.get(allNewsid).c.getStyle("display") != "block" && allNewsid != this.currentelement;
            this.toggleIcon(toggleback, this.allNews.get(allNewsid)).c.setStyle("display", toggleback ? "block" : "none");
        }
        this.currentelement = toggleback ? allNewsid : false;
    },
    getnewsInPage: function(allNewsid) {
        $(this.options.mainContainerid + "_hCont").setStyle("display", "none");
        $(this.options.mainContainerid + "_cCont").setStyle("display", "block");
        this.allNews.get(allNewsid).c.setStyle("display", "block");
        this.allNews.get(allNewsid).h.addClass("visited");
        this.currentelement = allNewsid;
    },
    getBackToList: function() {
        if ($chk(this.allNews.get(this.currentelement))) {
            $(this.options.mainContainerid + "_cCont").setStyle("display", "none");
            $(this.options.mainContainerid + "_hCont").setStyle("display", "block");
            this.allNews.get(this.currentelement).c.setStyle("display", "none");
        }
        this.currentelement = false;
    },
    inpageReinit: function() {
        if (this.options.newsMode == "inpage") this.getBackToList();
        else if (this.allNews.get(this.currentelement)) this.toggleIcon(false, this.allNews.get(this.currentelement)).c.setStyle("display", "none");
    }
});
var NormalImg = new Class({
    Implements : [Events, Options],
    options : {
            showThumbnails : true,
            thumbnailStyle : "bottom",
            showFirstPic : true,
            thumbSpacing : "margin: 5px 5px 5px 0;",
            fullSpacing : "padding: 5px 0;",
            showLegends : true
    },
    initialize: function(fPid, options){
        this.setOptions(options);
        this.slideObj = [];
        $(fPid).getElements("div.imageElement").each(function (imgElt){
            var fulsrc = imgElt.getElement("img.full").get("src");
            var thumbsrc = imgElt.getElement("img.thumbnail").get("src");
            var caption = imgElt.getElement("div").get("html");
            this.slideObj.include({"caption" : caption, "thumbnail" : thumbsrc ? thumbsrc : "", "fulsrc" : fulsrc});
            imgElt.destroy();
        },this);
        this.curImg = -1;
        $(fPid).empty();
        
        this.fullPanel = new Element("div",{"events" : {"click" : function (ev){this.go(this.curImg + 1);}.bind(this)}}).set("style",this.options.fullSpacing).setStyles({"position" : "relative","cursor" : "pointer", "clear" :"both"}).inject($(fPid));
        if(this.options.showThumbnails) {
            this.tumbPanel = new Element("div");
            
            switch(this.options.thumbnailStyle) {
                case "top" :
                    this.tumbPanel.inject($(fPid),"top");        
                break;
                default:
                    this.tumbPanel.inject($(fPid),"bottom");        
                break;
            } 
            this.slideObj.each(function(imgElt,ind){
                    if($chk(imgElt.thumbnail)) {
                        new Element("img", {"src" : imgElt.thumbnail,
                                            "events" : {"click" : this.go.pass(ind,this)}
                                            }).set("style",this.options.thumbSpacing).setStyles({"float" : "left",
                                                       "cursor" : "pointer"
                                                       }).inject(this.tumbPanel);
                        
                        }
                },this);
        }
        if(this.options.showLegends) {
            this.legendPanel = new Element("div").inject(this.fullPanel,"after");
        }
        if(this.options.showFirstPic) {this.go(0);}
    },
    go : function(ind){
        ind = ind % this.slideObj.length;
        if(this.curImg == ind) return;
        this.curImg = ind;
        this.fullPanel.empty();
        new Element("img", {"src" : this.slideObj[ind].fulsrc}).inject(this.fullPanel);
        if(this.options.showLegends) this.legendPanel.set("html", this.slideObj[ind].caption);
    }
});
var Img = new Class({
    Implements : Options,
    options :{
                showController : true,
                fullHeight : 300,
                fullWidth : 400,
                diaporamaDelay : 3000
		    },
    initialize: function(fPid,panelId, options){
        this.setOptions(options);
        
        this.fPid = fPid;
        this.panelId = panelId;
        var slideObj = new Hash();
        
        $(fPid).getElements("div.imageElement").each(function (imgElt){
            var fulsrc = imgElt.getElement("img.full").get("src");
            var thumbsrc = imgElt.getElement("img.thumbnail").get("src");
            var caption = imgElt.getElement("div").get("html");
            slideObj.set(fulsrc,{"caption" : caption, "thumbnail" : thumbsrc ? thumbsrc : ""});
            imgElt.destroy();
        },this);
        
        this.curImg = -1;
        
        $(fPid).empty().setStyles({"height" : this.options.fullHeight,"width" : this.options.fullWidth, "margin-bottom" : (this.options.showThumbnails ? 65 : 0)});
        this.slideShowObj = slideObj.getClean();
        
        $(fPid).store("slide", new Slideshow(fPid,slideObj.getClean(),{"thumbnails" : this.options.showThumbnails, "controller" : this.options.showController,resize : false, paused : true,"height" : this.options.fullHeight,"width" : this.options.fullWidth,"delay" : this.options.diaporamaDelay}));
        
        Site.addEvent("onPageChange", this.reinit.bindWithEvent(this));
    },
    reinit : function(curLabel) {
    if(this.panelId != curLabel) {
        if($(this.fPid).retrieve("slide"))
            $(this.fPid).retrieve("slide").destroy();
        } else {
            $(this.fPid).store("slide", new Slideshow(this.fPid,this.slideShowObj,{"thumbnails" : this.options.showThumbnails, "controller" : this.options.showController,resize : false, paused : true,"height" : this.options.fullHeight,"width" : this.options.fullWidth,"delay" : this.options.diaporamaDelay}));    
        }   
    }
});
var PopupImg = new Class({
    Implements : Options,
    options : {
            thumbSpacing : "margin: 5px 5px 5px 0;"
    },
    initialize: function(fPid, sizObj, options){
        this.setOptions(options);
        
        var sizObjH = $H(sizObj);
        $(fPid).getElements("div.imageElement").each(function (imgElt, ind){
            var fullsrc = imgElt.setStyle("float","left").getElement("a").removeProperty("target").get("href");
            imgElt.getElement("a").getElement("img").set("class","thumb");
            imgElt.getElement("a").addEvent("click",function(ev) {
                                                                    ev.stop();
                                                                    var scree = window.getSize();
                                                                    var imgS = sizObjH.get("img" + (ind+1).toString());
                                                                    var centerTop = (scree.y-imgS.y)/2 ;
                                                                    var centerLeft = (scree.x-imgS.x)/2;
                                                                    var newpage = window.open("/popImage.aspx?url="+fullsrc,"full","top="+centerTop+",left="+centerLeft+",width="+imgS ? imgS.x : ""+",height="+imgS ? imgS.y : ""+",resizable,scrollbars=no,status=0");
                                                                    newpage.focus();
                                                                    });
        },this);
        new Element("div", {"styles" : {"clear" : "both", "float" : "none", "width" : 1, "height" : 1}}).inject($(fPid));
    }
});
function getVideo(width, height, url) {
    var centerTop = (screen.availHeight-400)/2 - 200;
    var centerLeft = (screen.availWidth-400)/2 + 200;
    var newpage = window.open("/popVideo.aspx?url="+url+"&width="+width+"&height="+height,"video","top="+centerTop+",left="+centerLeft+",width="+width+",height="+height+",resizable,scrollbars=no,status=0");
    newpage.focus();
}
var Video = new Class({
    initialize : function (urlVideo, contId, w, h) {
        this.contId = contId;
        var o =  $(contId).getElement("a.img") ? $(contId).getElement("a.img") : new Element("a",{"styles":{"width": "100%", "height" : "100%", "display":"block"}}).inject($(contId));
        o.addEvent("click",this.show.bind(this));
        this.h = $pick(h,240).toInt();
        this.w = $pick(w,320).toInt();
        $chk($(contId).getElement("div.vid")) ? $(contId).getElement("div.vid") : new Element("div",{"class":"vid", "styles" : {"width": this.w, "height" : this.h,"background-color" : "#000000"}}).inject($(contId));
        this.urlVideo = urlVideo;
        // event handeling
        Site.addEvent('onPageChange', this.hide.bind(this));
    },
    show : function () {
        $(this.contId).getElement("a.img").setStyle("display", "none");
        $(this.contId).getElement("div.vid").setStyle("display", "block");
        if(Browser.Plugins.Flash.version >= 9)  new Swiff('/video.swf', {"width": this.w +"px","height": this.h + "px", vars : {'urlVideo' : this.urlVideo, 'autoPlay' : 'true'},params : {'scale' : 'showall','allowFullScreen' : 'true','allowScriptAccess' :'sameDomain'}}).inject($(this.contId).getElement("div.vid"));
        else new Element("a",{'text' : "please install the last flash player here","target" : "_blank","href" : "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=shockwaveFlash", "styles" : {"color" : "white", "width": "100%", "height" : "100%", "font-size" : "10px", "display" : "block", "display" : "block"}}).inject($(this.contId).getElement("div.vid"));
    },
    hide : function(){
        $(this.contId).getElement("a.img").setStyle("display", "block");
        $(this.contId).getElement("div.vid").setStyle("display", "none");
        $(this.contId).getElement("div.vid").empty();
    }
});
formFunctions = new Hash ({
    prepareBtn: function(formId) {
        new Element("div").setProperty("id","response_"+formId).injectInside($("Form_"+formId))
        $("sendbtn_"+formId).addEvent('click', this.sendForm.pass(formId));
    },
	sendForm: function(formid){
	    new Ajax("/ajax/sendForm.aspx", {method: 'post', autoCancel : true, update:$("response_"+formid), data:$("Form_"+formid).toQueryString(), evalScripts: true}).request();
	}
}); 