/**
 * @author Baird Buckingham
 */

/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){
    var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){
        var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){
            x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){
                x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0
                }
            }else{
            if(typeof j.ActiveXObject!=b){
                var y=null,AB=false;try{
                    y=new ActiveXObject(p+".7")
                    }catch(t){
                    try{
                        y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"
                        }catch(t){
                        if(AC[0]==6){
                            AB=true
                            }
                        }if(!AB){
                        try{
                            y=new ActiveXObject(p)
                            }catch(t){}
                        }
                    }if(!AB&&y){
                    try{
                        x=y.GetVariable("$version");if(x){
                            x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]
                            }
                        }catch(t){}
                    }
                }
            }var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{
            w3cdom:v,
            pv:AC,
            webkit:AA,
            ie:q,
            win:z,
            mac:w
        }
        }();var L=function(){
        if(!h.w3cdom){
            return
        }f(H);if(h.ie&&h.win){
            try{
                K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){
                    I(J,"onreadystatechange",S)
                    }
                }catch(q){}
            }if(h.webkit&&typeof K.readyState!=b){
            Z=setInterval(function(){
                if(/loaded|complete/.test(K.readyState)){
                    E()
                    }
                },10)
            }if(typeof K.addEventListener!=b){
            K.addEventListener("DOMContentLoaded",E,null)
            }R(E)
        }();function S(){
        if(J.readyState=="complete"){
            J.parentNode.removeChild(J);E()
            }
        }function E(){
        if(e){
            return
        }if(h.ie&&h.win){
            var v=a("span");try{
                var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)
                }catch(w){
                return
            }
            }e=true;if(Z){
            clearInterval(Z);Z=null
            }var q=o.length;for(var r=0;r<q;r++){
            o[r]()
            }
        }function f(q){
        if(e){
            q()
            }else{
            o[o.length]=q
            }
        }function R(r){
        if(typeof j.addEventListener!=b){
            j.addEventListener("load",r,false)
            }else{
            if(typeof K.addEventListener!=b){
                K.addEventListener("load",r,false)
                }else{
                if(typeof j.attachEvent!=b){
                    I(j,"onload",r)
                    }else{
                    if(typeof j.onload=="function"){
                        var q=j.onload;j.onload=function(){
                            q();r()
                            }
                        }else{
                        j.onload=r
                        }
                    }
                }
            }
        }function H(){
        var t=N.length;for(var q=0;q<t;q++){
            var u=N[q].id;if(h.pv[0]>0){
                var r=C(u);if(r){
                    N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){
                        if(h.webkit&&h.webkit<312){
                            Y(r)
                            }W(u,true)
                        }else{
                        if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){
                            k(N[q])
                            }else{
                            O(r)
                            }
                        }
                    }
                }else{
                W(u,true)
                }
            }
        }function Y(t){
        var q=t.getElementsByTagName(Q)[0];if(q){
            var w=a("embed"),y=q.attributes;if(y){
                var v=y.length;for(var u=0;u<v;u++){
                    if(y[u].nodeName=="DATA"){
                        w.setAttribute("src",y[u].nodeValue)
                        }else{
                        w.setAttribute(y[u].nodeName,y[u].nodeValue)
                        }
                    }
                }var x=q.childNodes;if(x){
                var z=x.length;for(var r=0;r<z;r++){
                    if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){
                        w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))
                        }
                    }
                }t.parentNode.replaceChild(w,t)
            }
        }function k(w){
        A=true;var u=C(w.id);if(u){
            if(w.altContentId){
                var y=C(w.altContentId);if(y){
                    M=y;l=w.altContentId
                    }
                }else{
                M=G(u)
                }if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){
                w.width="310"
                }if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){
                w.height="137"
                }K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){
                var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){
                    u.parentNode.removeChild(u)
                    };I(j,"onload",v)
                }U({
                data:w.expressInstall,
                id:m,
                width:w.width,
                height:w.height
                },{
                flashvars:r
            },x)
            }
        }function O(t){
        if(h.ie&&h.win&&t.readyState!=4){
            var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){
                t.parentNode.removeChild(t)
                };I(j,"onload",q)
            }else{
            t.parentNode.replaceChild(G(t),t)
            }
        }function G(v){
        var u=a("div");if(h.win&&h.ie){
            u.innerHTML=v.innerHTML
            }else{
            var r=v.getElementsByTagName(Q)[0];if(r){
                var w=r.childNodes;if(w){
                    var q=w.length;for(var t=0;t<q;t++){
                        if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){
                            u.appendChild(w[t].cloneNode(true))
                            }
                        }
                    }
                }
            }return u
        }function U(AG,AE,t){
        var q,v=C(t);if(v){
            if(typeof AG.id==b){
                AG.id=t
                }if(h.ie&&h.win){
                var AF="";for(var AB in AG){
                    if(AG[AB]!=Object.prototype[AB]){
                        if(AB.toLowerCase()=="data"){
                            AE.movie=AG[AB]
                            }else{
                            if(AB.toLowerCase()=="styleclass"){
                                AF+=' class="'+AG[AB]+'"'
                                }else{
                                if(AB.toLowerCase()!="classid"){
                                    AF+=" "+AB+'="'+AG[AB]+'"'
                                    }
                                }
                            }
                        }
                    }var AD="";for(var AA in AE){
                    if(AE[AA]!=Object.prototype[AA]){
                        AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'
                        }
                    }v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)
                }else{
                if(h.webkit&&h.webkit<312){
                    var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){
                        if(AG[z]!=Object.prototype[z]){
                            if(z.toLowerCase()=="data"){
                                AC.setAttribute("src",AG[z])
                                }else{
                                if(z.toLowerCase()=="styleclass"){
                                    AC.setAttribute("class",AG[z])
                                    }else{
                                    if(z.toLowerCase()!="classid"){
                                        AC.setAttribute(z,AG[z])
                                        }
                                    }
                                }
                            }
                        }for(var y in AE){
                        if(AE[y]!=Object.prototype[y]){
                            if(y.toLowerCase()!="movie"){
                                AC.setAttribute(y,AE[y])
                                }
                            }
                        }v.parentNode.replaceChild(AC,v);q=AC
                    }else{
                    var u=a(Q);u.setAttribute("type",P);for(var x in AG){
                        if(AG[x]!=Object.prototype[x]){
                            if(x.toLowerCase()=="styleclass"){
                                u.setAttribute("class",AG[x])
                                }else{
                                if(x.toLowerCase()!="classid"){
                                    u.setAttribute(x,AG[x])
                                    }
                                }
                            }
                        }for(var w in AE){
                        if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){
                            F(u,w,AE[w])
                            }
                        }v.parentNode.replaceChild(u,v);q=u
                    }
                }
            }return q
        }function F(t,q,r){
        var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)
        }function X(r){
        var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){
            if(h.ie&&h.win){
                if(q.readyState==4){
                    B(r)
                    }else{
                    j.attachEvent("onload",function(){
                        B(r)
                        })
                    }
                }else{
                q.parentNode.removeChild(q)
                }
            }
        }function B(t){
        var r=C(t);if(r){
            for(var q in r){
                if(typeof r[q]=="function"){
                    r[q]=null
                    }
                }r.parentNode.removeChild(r)
            }
        }function C(t){
        var q=null;try{
            q=K.getElementById(t)
            }catch(r){}return q
        }function a(q){
        return K.createElement(q)
        }function I(t,q,r){
        t.attachEvent(q,r);d[d.length]=[t,q,r]
        }function c(t){
        var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false
        }function V(v,r){
        if(h.ie&&h.mac){
            return
        }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){
            t.appendChild(K.createTextNode(v+" {"+r+"}"))
            }u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){
            var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){
                q.addRule(v,r)
                }
            }
        }function W(t,q){
        var r=q?"visible":"hidden";if(e&&C(t)){
            C(t).style.visibility=r
            }else{
            V("#"+t,"visibility:"+r)
            }
        }function g(s){
        var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s
        }var D=function(){
        if(h.ie&&h.win){
            window.attachEvent("onunload",function(){
                var w=d.length;for(var v=0;v<w;v++){
                    d[v][0].detachEvent(d[v][1],d[v][2])
                    }var t=i.length;for(var u=0;u<t;u++){
                    X(i[u])
                    }for(var r in h){
                    h[r]=null
                    }h=null;for(var q in swfobject){
                    swfobject[q]=null
                    }swfobject=null
                })
            }
        }();return{
        registerObject:function(u,q,t){
            if(!h.w3cdom||!u||!q){
                return
            }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)
            },
        getObjectById:function(v){
            var q=null;if(h.w3cdom){
                var t=C(v);if(t){
                    var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){
                        q=t
                        }else{
                        if(typeof u.SetVariable!=b){
                            q=u
                            }
                        }
                    }
                }return q
            },
        embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){
            if(!h.w3cdom||!x||!AE||!AB||!AD||!q){
                return
            }AB+="";AD+="";if(c(q)){
                W(AE,false);var AA={};if(AC&&typeof AC===Q){
                    for(var v in AC){
                        if(AC[v]!=Object.prototype[v]){
                            AA[v]=AC[v]
                            }
                        }
                    }AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){
                    for(var u in z){
                        if(z[u]!=Object.prototype[u]){
                            y[u]=z[u]
                            }
                        }
                    }if(r&&typeof r===Q){
                    for(var t in r){
                        if(r[t]!=Object.prototype[t]){
                            if(typeof y.flashvars!=b){
                                y.flashvars+="&"+t+"="+r[t]
                                }else{
                                y.flashvars=t+"="+r[t]
                                }
                            }
                        }
                    }f(function(){
                    U(AA,y,AE);if(AA.id==AE){
                        W(AE,true)
                        }
                    })
                }else{
                if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){
                    A=true;W(AE,false);f(function(){
                        var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)
                        })
                    }
                }
            },
        getFlashPlayerVersion:function(){
            return{
                major:h.pv[0],
                minor:h.pv[1],
                release:h.pv[2]
                }
            },
        hasFlashPlayerVersion:c,
        createSWF:function(t,r,q){
            if(h.w3cdom){
                return U(t,r,q)
                }else{
                return undefined
                }
            },
        removeSWF:function(q){
            if(h.w3cdom){
                X(q)
                }
            },
        createCSS:function(r,q){
            if(h.w3cdom){
                V(r,q)
                }
            },
        addDomLoadEvent:f,
        addLoadEvent:R,
        getQueryParamValue:function(v){
            var u=K.location.search||K.location.hash;if(v==null){
                return g(u)
                }if(u){
                var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){
                    if(t[r].substring(0,t[r].indexOf("="))==v){
                        return g(t[r].substring((t[r].indexOf("=")+1)))
                        }
                    }
                }return""
            },
        expressInstallCallback:function(){
            if(A&&M){
                var q=C(m);if(q){
                    q.parentNode.replaceChild(M,q);if(l){
                        W(l,true);if(h.ie&&h.win){
                            M.style.display="block"
                            }
                        }M=null;l=null;A=false
                    }
                }
            }
        }
    }();


//-----------------tools.js----------------------//
tools = {

    init : function(){

    },

    collectFormVals : function(form,method){
        var form_length = form.length;
        var qstring;
        for(i=0;i<form_length;i++){
            if(form.elements[i].name != ''){
                if (i > 0) {
                    qstring += "&" + form.elements[i].name + '=' + form.elements[i].value;
                }else{
                    qstring = form.elements[i].name + '=' + form.elements[i].value;
                }
            }
        }

        return qstring;

    },

    getById : function(ele){
        return document.getElementById(ele);
    },

    getByTag : function(ele){
        return document.getElementsByTagName(ele);
    },

    addEvent : function(element, type, handler){
        if (document.addEventListener) {
            element.addEventListener(type, handler, false);
        } else if (document.attachEvent) {
            element.attachEvent("on" + type, handler);
        } else {
            addEvent = new Function; // not supported
        }
    },

    createElement : function(pEle,nEle,attrib_arr,attval_arr,eleCont,visible){
        if(visible != 'hidden'){
            visible = 'visible';
        }

        var arr_length = attrib_arr.length;

        var parentEle = document.getElementById(pEle);
        var newEle 	= document.createElement(nEle);

        for (i = 0; i < arr_length; i++) {
            newEle.setAttribute(attrib_arr[i], attval_arr[i]);
        }

        try {
            newEle.style.visibility = visible;
            newEle.style.overflow = "hidden";
            newEle.innerHTML = eleCont;
        }catch(e){}

        parentEle.appendChild(newEle);
        return newEle;


    },

    removeElement : function(pEle,remEle){
        var parentEle = document.getElementById(pEle);
        var removeEle	= document.getElementById(remEle);
        try{
            parentEle.removeChild(removeEle);
        }catch(e){}
    },

    centerEle : function(retEle){
        eleHeight = retEle.offsetHeight;
        eleWidth = retEle.offsetWidth;

        var windowH = document.body.clientHeight || document.documentElement.clientHeight
        var parentEleH = Math.round((windowH)/2);
        var parentEleW = Math.round(document.documentElement.offsetWidth/2);
        var vertical = Math.round(eleHeight/2);
        var horizontal = Math.round(eleWidth/2);
        var eleY = parentEleH - vertical;
        var eleX = parentEleW - horizontal;
        var yoffset =   document.documentElement.scrollTop || document.body.scrollTop;
        var realY = eleY + (yoffset);

        var timer = window.setInterval(function(){
            clearInterval(timer)
            timer = null;
            retEle.style.top = yoffset + eleHeight/2 +"px";
            retEle.style.left = eleX + "px";

        },300);
    },

    tooltip : function(e,menu,ani,type){
                var e = e || window.event;

                type = type ? type : '';
                var timer = window.setInterval(function(){
                    clearInterval(timer);
                    timer = null;
                    var dim = new dimensions();

                    menu.style.visiblity = "visible";
                    menu.style.position = 'absolute';
                    menu.style.zIndex = '500000';
			
                    menu.style.left = (dim.getCoords(e).x - dim.getSize(menu).w) + 90 + 'px';
                    menu.style.top = dim.getCoords(e).y +  dim.getCoords(e).yoffset + 20 + 'px';
                    
                }, 500)
	},

    showTransBack : function(){

        var ele = tools.createElement('wrapper','div',['id'],['browser_back'],'');
        var browser = tools.getById("browser");

        ele.style.filter = "alpha(opacity=70)";
        ele.style.opacity = ".7";


        var isWebkit = navigator.userAgent.indexOf("Safari") != -1 ? 1 : 0;
        var isFirefox = navigator.userAgent.indexOf("Firefox") != -1 ? 1 : 0;

        if (isWebkit == 1) {
            var yoffset = document.body.scrollHeight;
        }else if(isFirefox == 1){
            var yoffset = document.body.scrollHeight;
        }else{
            var yoffset = document.documentElement.scrollHeight;
        }

        ele.style.height = yoffset +  "px";
        ele.style.width  = document.documentElement.offsetWidth + "px";


    },

    striper : function(tid,color1,color2){
        var tableRows	= document.getElementsByTagName("TR")

        for(var i=0, node; node = tableRows[i++];) {
            node.style.backgroundColor = i%2 == 0 ? color1 : color2;
        }
    },

    highlightTools : function(){
        var rows = document.getElementsByTagName('LI');
        for (var i = 0, node; node = rows[i++];) {

            node.onmouseover = function(){
                alert(this.id)
            }
        }

    },

    regExCheck : function(strMatch,strItem){

        if(strItem){
            var pattern = new RegExp("(^|\\s)"+ strMatch +"(\\s|$)");
            return pattern.test(strItem.className);
        }

    },

    preloadImages : function(imgs) {
        if(document.images){
            if (!document.img_arr) {
                document.img_arr = new Array();
                var i;
                var img_arr_lng = document.img_arr.length;

                for (i = 0; i < imgs.length; i++) {
                    if (imgs[i].indexOf("#") != 0) {
                        document.img_arr[img_arr_lng] = new Image;
                        document.img_arr[img_arr_lng++].src = imgs[i];
                    }
                }
            }
        }
    },

    createEvent : function(findEle,func, type){
        for (var i=0, node; node = admin.allEle[i++];) {
            (function() {
                if (tools.regExCheck(findEle, node)) {
                    tools.addEvent(node, type, func);
                }
            })()

        }
    },

    getTarget : function(e){
        var e = e ? e : window.event;
        var eleId = e.target ? e.target.id : e.srcElement.id;
        eleId = eleId.replace(/del_/,"");
        return eleId;
    },

    getAttributes : function(e){
        var e = e ? e : window.event;
        var eleId = e.target ? e.target : e.srcElement;

        var ele = eleId.className.split('-');

        return ele;
    },

    getString : function(){
        var tempqstring	= location.search;
        var qstring		= tempqstring.replace("?","");

        return qstring;
    },

    getPage : function(){
        var tempqstring	= location.search;
        var qstring		= tempqstring.replace("?","");
        var params 		= qstring.split("&");
        if (params[0]) {
            var ret =  params[0];
        }
        return ret;
    },

    getView : function(){
        var tempqstring	= location.href;
        var params 		= tempqstring.split("/");
        if (params[5]) {
            var ret =  params[5];
        }
        return ret;
    },

    isNest: function(handler,e){

        e = e ? e : window.event;

        if(e.type != 'mouseout' && e.type != 'mouseover'){
            return false;
        }

        var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
        while (reltg && reltg != handler){
            reltg = reltg.parentNode;
        }
        return (reltg != handler);

    },

    exec : function(callback, args) {
            var name = this;
            callback.apply(name, args);
    },

    ev : function(e){
            var e = e || window.event;
            return e;
    },

    stopPropagation : function(e){
            e.cancelBubble = true;
            e.returnValue = false;
    },

    extractnumber : function(value){
            var n = parseInt(value);
            return n == null || isNaN(n) ? 0 : n;
    },

    getElementsByClass : function(searchClass, tag) {
        var returnArray = [];
        tag = tag || '*';
        var els = document.getElementsByTagName(tag);
        var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
        for (var i = 0; i < els.length; i++) {
            if ( pattern.test(els[i].className) ) {
                returnArray.push(els[i]);
            }
        }
        return returnArray;
    }

}

//----------------dimensions.js-------------------//

var dimensions = function(){

	var dimensions = this;

	dimensions.getCoords = function(e){
		var e = tools.ev(e);
		var yoffset = document.documentElement.scrollTop || document.body.scrollTop;
                var coords
		if (e) {
                        
			coords = {
				x: e.pageX ? e.pageX - window.pageXOffset : e.clientX,
				y: e.pageY ? e.pageY - window.pageYOffset : e.clientY,
				yoffset: yoffset
			}
		}else{
			coords = {
				yoffset: yoffset
			}
		}
		return coords;
	}

	dimensions.getSize = function(ele){
		var dimensions = {
			w: ele.offsetWidth,
			h: ele.offsetHeight,
			left: tools.extractnumber(ele.style.left),
			top: tools.extractnumber(ele.style.top)
		}
		return dimensions;
	}

}

//-----------------dragger.js----------------------//

dragger = {

    start_x		: 0,
    start_y		: 0,
    x_offset 	: 0,
    y_offset 	: 0,
    dragEle 	: '',
    oldindex 	: 0,

    init : function(){

        document.onmousedown = this.mousedown;
        document.onmouseup = this.mouseup;


    },

    mousedown : function(e) {

        e = e ? e : window.event;



        var target = e.target != null ? e.target : e.srcElement;

        if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'drag drag_bar') {
            //target = target.parentNode;
            dragger.start_x = e.clientX;
            dragger.start_y = e.clientY;

            dragger.x_offset = dragger.ExtractNumber(target.style.left);
            dragger.y_offset = dragger.ExtractNumber(target.style.top);

            dragger.oldindex = target.style.zIndex;
            target.style.zIndex = 20000;

            dragger.dragEle = target;


            document.onmousemove = dragger.mousemove;

            document.body.focus();

            document.onselectstart = function () {
                return false;
            };

            target.ondragstart = function() {
                return false;
            };

            return false;
        }

    },

    mousemove : function(e){
        e = e ? e : window.event;

        left = (dragger.x_offset + e.clientX - dragger.start_x)
        top  = (dragger.y_offset + e.clientY - dragger.start_y)

        dragger.dragEle.style.left = left + 'px';
        dragger.dragEle.style.top =  top + 'px';

    },

    mouseup : function(e){
        e = e ? e : window.event;
        if (dragger.dragEle != null) {

            document.onmousemove = null;
            document.onselectstart = null;
            dragger.dragEle.ondragstart = null;
            dragger.dragEle = null;

        }
    },

    ExtractNumber : function(value){
        var n = parseInt(value);
        return n == null || isNaN(n) ? 0 : n;
    }
}


//-----------------drag_sort.js----------------------//

function drag_sort(){

    var that = this;
    that.start_x 		= 0;
    that.start_y 		= 0;
    that.x_offset 		= 0;
    that.y_offset 		= 0;
    that.dragEle 		= '';
    that.oldindex 		= 0;
    that.cont_top		= 0;
    that.cont_bottom 	= 0;
    that.pcontainer		= '';
    that.last_cont		= '';
    that.containers		= new Array;
    that.cont_height	= new Array;
    that.cont_y			= new Array;

    that.init = function(){

        document.onmousedown = that.mousedown;
        document.onmouseup = that.mouseup;

        that.compile();
    }

    that.mousedown = function(e) {

        e = e ? e : window.event;

        var target = e.target != null ? e.target : e.srcElement;

        if(that.check(e) && target.className == 'dragger'){
            content_id = target.parentNode.parentNode.id;
            target = target.parentNode.parentNode;

            that.pcontainer = target.parentNode.parentNode;
            container = target.parentNode.parentNode;
            that.cont_top = container.offsetTop;
            that.cont_bottom = that.cont_top + container.offsetHeight - target.offsetHeight;

            parentwidth = target.offsetWidth;
            parentheight = target.parentNode.offsetHeight;
            target.parentNode.style.height = parentheight - 1 + 'px'

            that.start_y = e.clientY;

            target.style.position = 'absolute';

            that.y_offset = target.offsetTop;

            that.oldindex = target.style.zIndex;
            target.style.zIndex = 20000;
            target.style.width = parentwidth + 'px';

            that.dragEle = target;
            document.onmousemove = that.mousemove;

            document.body.focus();

            document.onselectstart = function () {
                return false;
            };

            target.ondragstart = function() {
                return false;
            };

            return false;
        }

    }

    that.check = function(e){
        e = e ? e : window.event;
        if(e.button == 1 && window.event != null || e.button == 0){
            return true;
        }else{
            return false;
        }
    }

    that.mousemove = function(e){
		
        e = e ? e : window.event;

        var top  = (that.y_offset + e.clientY - that.start_y)

        if (top > that.cont_top - 8 && top < that.cont_bottom + 4) {
            that.dragEle.style.top = top + 'px';
        }

        //tools.getById('status').innerHTML = that.dragEle.offsetTop +  ' - ' +  (that.cont_top  + 34)
        that.dragEle.parentNode.style.backgroundColor = '#F9F9FE'
        var len = that.containers.length;
        for(i=0;i<len;i++){

            if(that.dragEle.offsetTop > that.cont_y[i]){
                try {
                    if (that.dragEle.offsetTop != (that.cont_bottom - that.cont_height[i])) {
                        if (that.dragEle.offsetTop > (that.cont_top  + that.cont_height[i])) {
                            that.pcontainer.insertBefore(that.dragEle.parentNode, that.containers[i].nextSibling);
                        }else{
                            that.pcontainer.insertBefore(that.dragEle.parentNode, that.containers[i])||that.pcontainer.insertBefore(that.dragEle.parentNode, that.containers[i].nextSibling);;
                        }
                    }else{
                        that.pcontainer.appendChild(that.dragEle.parentNode);
                    }
                    that.last_cont = that.cont_y[i];
                }catch(e){}
            }

        }

    }

    that.mouseup = function(e){
        e = e ? e : window.event;
        if (that.dragEle != null && that.dragEle.className.indexOf('row') != -1 ) {
            var rows = that.dragEle.parentNode.parentNode.getElementsByTagName('LI');
            var rows_len = rows.length;
			
            rep = rows[0].childNodes[0].id != undefined ? rows[0].childNodes[0] : rows[0].childNodes[1];

            var row = rep.id.replace(/row_/,'');
            var row_arr =  row.split('-');
            ajax.callAjax('/admin/index.php', 'section=' + row_arr[0] + '&id=' + row_arr[1] + '&mode=none&action=update&sortOrder=1', 'get');

            for(i=1;i<rows_len;i++){
                rep = rows[i].childNodes[0].id != undefined ? rows[i].childNodes[0] : rows[i].childNodes[1];
                var row = rep.id.replace(/row_/,'');
                var row_arr =  row.split('-');
                ajax.callAjax('/admin/index.php', 'section=' + row_arr[0] + '&id=' + row_arr[1] + '&mode=none&action=update&sortOrder=' + (i + 1), 'get');
            }
            that.dragEle.parentNode.parentNode.style.top = that.last_cont + 'px';
            document.onmousemove = null;
            document.onselectstart = null;
            that.dragEle.ondragstart = null;
            that.dragEle = null;
            that.pcontainer = null;


            var timer = setInterval(function(){
                admin._load(); clearInterval(timer); timer=null
                },500);
        }
    }

    that.mouseover = function(e){
        if(that.dragEle != null){
    //tools.getById('status').innerHTML = e.target.parentNode.id;
    }
    }

    that.compile = function(){
        var containers = tools.getElementsByClass('drop_cont');
        var cont_length = containers.length;

        for(i=0;i<cont_length;i++){
            that.containers.push(containers[i]);
            that.cont_height.push(containers[i].offsetHeight);
            that.cont_y.push(containers[i].offsetTop);
        }
    }
}

//-----------------animation.js----------------------//

function animation(callbackFunction){

    var that = this;

    that.duration = 500;
    that.fps	  = 100;
    that.tick	  = 0;

    that.animate = function(ele, elm, start, target){
        var fps = Math.round(1000 / that.fps)
        var unit = (elm == 'opacity') ? '' : 'px';
        ele.style[elm] = start + unit;

        ele.style.overflow = "hidden";
        if(ele.style.visibility == 'hidden'){
            ele.style.visibility = 'visible';
        }
        var startTime = (new Date()).getTime();
        that.tmr = setInterval(function(){
            that.step(that.duration, startTime, target, unit, elm, ele, start)
        }, fps);
    }

    that.step = function(duration, startTime, target, unit, elm, ele, start){
        elapsedTime = (new Date()).getTime();
        if (elapsedTime > duration + startTime) {
            clearInterval(that.tmr);
            that.tmr = null;
            if (ele.style[elm] != target) {
                ele.style[elm] = target + unit;
            }
            ele.style.overflow = "hidden";
            that.callback();
        }else{
            var curTime = elapsedTime - startTime;
            var curPos = curTime / duration;
            var diff = (target - start);
            var ease = that.ease(curPos);
            //var val = ease * diff + start;
            var val = diff * ease + start
            that.increase(ele, elm, val, unit);
        }
    };

    that.ease = function(curPos){
        return (-(Math.cos(Math.PI * curPos) - 1) / 2);
    };

    that.increase = function(ele, elm, val, unit){
        ele.style[elm] = val + unit;
    };

    that.callback = callbackFunction || function(){};

}

//-----------------ajax.js----------------------//

ajax = {
    callback : '',

    callAjax : function(surl,qstring,method,postback) {
        xmlHttp=this.GetXmlHttpObject()
        var url= surl + "?" + qstring
        xmlHttp.onreadystatechange = function(){
            if(xmlHttp.readyState == 1 || xmlHttp.readyState == 2 || xmlHttp.readyState == 3){
                if (!tools.getById("loading")) {
                    var msg = msg != undefined ? msg : 'Loading. . .';
                    tools.createElement('wrapper', 'div', ['id'], ['loading'], msg)
                    var yoffset =   document.documentElement.scrollTop || document.body.scrollTop;
                    tools.getById("loading").style.top = "0px"
                }
            }

            if(xmlHttp.readyState == 4){
                tools.removeElement('wrapper','loading')
                ajax.callback(xmlHttp.responseText,xmlHttp.status,xmlHttp.responseXML);
            }
        }
        if(method != 'post'){
            xmlHttp.open("GET", url, true);
            xmlHttp.send(null);
        }else{
            //qstring = encodeURIComponent(qstring)
            xmlHttp.open("POST",surl,true)
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
            xmlHttp.send(qstring)

        }

        ajax.callback =  postback || function(){};

    },


    GetXmlHttpObject : function(){
        return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
    }


}

//-----------------accordion.js----------------------//

function accordion(){

    var that = this;

    that.timer = null
    that.selected = 1

    that.init = function(){
        tools.createEvent('acc_tab',that.slide,'click');
        this._auto_slide();
    }

    that._auto_slide = function(){
        var cont_arr = tools.getElementsByClass('acc_cont');
        var len 	 = cont_arr.length
        var w = 680;


        that.timer = window.setInterval(function(){
            var cont = tools.getById(cont_arr[that.selected].id.replace(/tab_/,'acc_'));
            
            for(var i=0;i<len;i++){
                if(cont_arr[i].id == cont.id){
                    var open_ani = new animation();
                    open_ani.animate(cont,'width',0,w)
                }else if(cont_arr[i].offsetWidth == w){
                    var ele = tools.getById(cont_arr[i].id)
                    var close_ani = new animation();
                    close_ani.animate(ele,'width',w,0);
                }
            }

            if(that.selected < (len - 1)){
                that.selected++;
            }else{
                that.selected = 0;
            }


        },8000)

    }

    that.slide = function(e){
        if(that.timer){
            clearInterval(that.timer);
            that.timer = null;
        }
        var e = e ? e : window.event;
        var eleId = tools.getTarget(e);
        var cont = tools.getById(eleId.replace(/tab_/,'acc_'));
        var cont_arr = tools.getElementsByClass('acc_cont');
        var len 	 = cont_arr.length
		
        var w = 680;
		
        for(var i=0;i<len;i++){
            if(cont_arr[i].id ==  cont.id){
                var open_ani = new animation();
                open_ani.animate(cont,'width',0,w)
            }else if(cont_arr[i].offsetWidth == w){
                var ele = tools.getById(cont_arr[i].id)
                var close_ani = new animation();
                close_ani.animate(ele,'width',w,0);
            }
        }
    }

}

//-----------------admin.js----------------------//

admin = {

    allEle : '',
    id_arr : [],
    height_arr : [],
    hide_arr : [],
    view : '',

    init : function(){
        this.allEle = tools.getByTag('*');
        this.compileFunctions();
        this.compileVariables();
    },

    compileFunctions : function(){
        var types = ['category','content','product','form','form_tabs','form_rows'];
        var types_len = types.length;

        for (i = 0; i < types_len; i++) {
            tools.createEvent('add-' + types[i],admin._add, 'click');
            tools.createEvent('edit-' + types[i],admin._edit, 'click');
            tools.createEvent('delete-' + types[i],admin._delete, 'click');
            tools.createEvent('move-' + types[i],admin._move, 'click');
            tools.createEvent('copy-' + types[i],admin._copy, 'click');
        }

        tools.createEvent('menu',admin._menu, 'click');
        tools.createEvent('minimize-category',admin._toggle, 'click');
        tools.createEvent('video_img',admin._video, 'click');
	tools.createEvent('manual_video_img',admin._manual_video, 'click');
        tools.createEvent('request_quote', admin._request_quote, 'click');
        tools.createEvent('tooltip',admin._tooltips, 'mouseover');
        tools.createEvent('tooltip',admin._tooltips, 'mouseout');
    },

    compileVariables : function(){
        admin.view = tools.getView() ? tools.getView() : 'admin';
        var class_arr = tools.getElementsByClass('minimize-category');
        var class_arr_len = class_arr.length;

        for(i=0;i<class_arr_len;i++){
            admin.id_arr[i] = "list_" + class_arr[i].id;
            if (tools.getById(admin.id_arr[i]).offsetHeight > 0) {
                admin.height_arr[i] = tools.getById(admin.id_arr[i]).offsetHeight;
            }
        }
    },

    parts_parade : function(){
        var sections = ['home', 'brass_rod', 'forge', 'impact', 'micro'];

        var flashvars;
        var params;

        for(var i=0;i<sections.length;i++){
            flashvars = {movie: sections[i] + '_parts'};
            params={wmode:"transparent"};
            swfobject.embedSWF("/video/parade_final1.swf", sections[i] + "_parts_parade", "670", "52", "9.0.0", "expressInstall.swf", flashvars, params);
        }
    },

    _request_quote : function(){
        var ele = tools.createElement('inner_wrapper', 'div', ['id'], ['request_quote_cont'],'','visible');
        ele.style.top = '243px';
        ele.style.left = 'auto';
        ele.style.marginLeft = '309px';



        ajax.callAjax('/content/quote', 'section=quote&mode=quote', 'get');
        ajax.callback = function(ret){
            ele.innerHTML = ret;

            tools.getById('close').style.cursor = 'pointer';
            tools.getById('close').onclick = function(){
                tools.removeElement('inner_wrapper', 'request_quote_cont');
            }

	    var form = tools.getById('req_quote_form');
	    var submit = tools.getById('submit');
	    
	    submit.onclick = function(){
		var err_arr = new Array();
		var form_length = form.length;
		var qstring;
		for(i=0;i<form_length;i++){
		    if(form.elements[i].name != '' && form.elements[i].name != 'address2'){
                        if(form.elements[i].value == ''){
			    form.elements[i].style.borderColor = '#FF9933';
			    form.elements[i].style.backgroundColor = '#fefefe';
			    err_arr.push(form.elements[i].name);
			}else{
			    form.elements[i].style.borderColor = '#AAAAAA';
			    form.elements[i].style.backgroundColor = '#ffffff';
			}
		    }
		}

		if(err_arr.length > 0){
		    tools.getById('msg').innerHTML = '*The fields highlighted below need to be filled out.';
		}else{
		    form.submit();
		}
	    }

	    
        }

        
    },

    _tooltips : function(e){
        var e = e ? e :  window.event;
        var eleId = tools.getTarget(e);
        var type = e.type

        var tips = {'C34500':'For general screw machined products requiring some cold formability (i.e. knurling, crimping, thread rolling, etc.)',
        'C35300':'For general screw machined products requiring some cold formability (i.e. knurling, crimping, thread rolling, etc.)',
        'C36000':'For general screw machined products.',
        'C37700':'For general hot forging applications.',
        'C27450':'For No Lead Plumbing applications requiring AB1953 compliance. Suitable for machining and forging operations.',
        'C36500':'For lower lead machining applications requiring AB1953 compliance. Alloy is dezincification resistant.',
        'C37000':'For lower lead forging applications requiring AB 1953 compliance. Alloy is dezincification resistant.',
        'C35000':'For general machining, blanking, thread rolling and knurling',
        'C35330':'Designed specifically for dezincification resistant applications',
        'C38500':'Designed for hot forming, machining applications. The chemistry of this alloy complies with many of the European brass specifications.',
        'C48500':'For general screw machine parts for marine applications',
        'C67300':'For material requiring strength and durability like gear blanks and bearing applications',
        'simulation_video':'<h3>Design Simulation</h3><ul><li>Direct access to engineering <br>for collaborative design</li><li>Identifies potential quality Issues <br>prior to production launch – predictive tool can analyze stresses ahead of build. Allows for most manufacturable design for both you and Mueller Impact Co.</li><li>Reduce or eliminate physical Trials</li><li>Reduced lead-times at start-up</li><li>Tool designed in-house</li></ul>',
        'heat_treating_video':'<h3>Heat Treating Capabilities</h3><span class="bold">Mueller Impact Company</span> uses in-house continuous heat treat furnaces for aluminum alloys. We routinely heat treat 2000, 6000, and 7000 series aluminum alloys to many different tempers. We ensure the dimensional stability of your parts by utilizing specialized racking methods through our continuous furnaces. The proper handling and racking of aluminum impact extrusions means that mechanical properties are optimized while distortion is minimized. The benefit to the customer is consistent quality from first to the last piece.'
        }

        if(type === 'mouseover'){
            var msg = '<h2 class="align_center">' + eleId +'</h2>' + tips[eleId];
            var ele = tools.createElement('wrapper','div',['id'],['tooltip_cont'],msg,'visible');
            var isIE = navigator.userAgent.indexOf("MSIE") != -1 ? 1 : 0;

            if(!isIE){
                tools.tooltip(e,ele);
            }else{
                ele.style.left = e.clientX + 'px';
                ele.style.top = e.clientY + document.body.scrollTop + document.documentElement.scrollTop + 'px';
            }

        }else{
            tools.removeElement('wrapper','tooltip_cont');
        }
    },

    quote : function(){
        return 'Test';
    },

    _loading : function(){
        alert("loading");
    },
	
    _video : function(e){
        var e = e || window.event;
        var eleId = tools.getTarget(e);

        if(tools.getById('outer')){
            tools.removeElement('wrapper', 'outer');
        }

        var outer = tools.createElement('wrapper', 'div', ['id'], ['outer'], '', 'visible');
        var close = tools.createElement('outer', 'img', ['src','id'], ['/images/common/close_3.png', 'close_btn'],'','visible');
        var div = tools.createElement('outer', 'div', ['id'], ['video_player'], 'Error Loading', 'visible');
        tools.centerEle(outer);
        outer.style.overflow = 'visible';
        var timer = window.setInterval(function(){
            clearInterval(timer);
            timer = null;
            var flashvars = {
                movieurl: '/video_new/flvs/' + eleId + '.flv'
            }

            var params={
                wmode:"transparent"
            }


            swfobject.embedSWF("/video_new/flv_player_sm.swf", "video_player", "420", "350", "9.0.0", "expressInstall.swf", flashvars, params);

        },150)

        close.onclick = function(){
            tools.removeElement('wrapper', 'outer');
        }
    },

    brass_rod_video : function(){
        var flashvars = {}

        var params={
            wmode:"transparent"
        }
        swfobject.embedSWF("/video/brass_rod_video.swf", "img_7135", "534", "294", "9.0.0", "expressInstall.swf", flashvars, params);
    },

    _manual_video : function(e){
        var e = e || window.event;
        var eleId = tools.getTarget(e);

        if(tools.getById('outer')){
            tools.removeElement('wrapper', 'outer');
        }

        var outer = tools.createElement('wrapper', 'div', ['id'], ['outer'], '', 'visible');
        var close = tools.createElement('outer', 'img', ['src','id'], ['/images/common/close_3.png', 'close_btn'],'','visible');
        var div = tools.createElement('outer', 'div', ['id'], ['video_player'], '', 'visible');
	outer.style.width = '900px';
	outer.style.height = '562px';
        tools.centerEle(outer);
        outer.style.overflow = 'visible';
        var timer = window.setInterval(function(){
            clearInterval(timer);
            timer = null;
            var flashvars = {
                movieurl: 'mueller_admin_videos/' + eleId + '.flv'
            }

            var params={
                wmode:"transparent"
            }


            swfobject.embedSWF("admin_manual.swf", "video_player", "900", "562", "9.0.0", "expressInstall.swf", flashvars, params);

        },150)

        close.onclick = function(){
            tools.removeElement('wrapper', 'outer');
        }
    },

    dominit : function(){
        admin.init();
        tools.init();

        if(tools.getElementsByClass('acc_cont').length > 0){
            var acc = new accordion();
            acc.init();

            admin.parts_parade()
        }

        if(tools.getById("img_7135")){
           admin.brass_rod_video();
        }
    }


}

var domload = (function(i) {
    var u =navigator.userAgent;var e=/*@cc_on!@*/false; var st =
    setTimeout;if(/webkit/i.test(u)){
        st(function(){
            var dr=document.readyState;
            if(dr=="loaded"||dr=="complete"){
                i()
                }else{
                st(arguments.callee,10);
            }
            },10);
    }
    else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
        document.addEventListener("DOMContentLoaded",i,false);
    } else if(e){
        (
            function(){
                var t=document.createElement('doc:rdy');try{
                    t.doScroll('left');
                    i();t=null;
                }catch(e){
                    st(arguments.callee,0);
                }
                })();
    }else{
        window.onload=i;
    }
    })(admin.dominit);


window.onload = function(){
    }

Object.prototype.getElementsByClass = function (searchClass, tag) {
    var returnArray = [];
    tag = tag || '*';
    var els = this.getElementsByTagName(tag);
    var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
    for (var i = 0; i < els.length; i++) {
        if ( pattern.test(els[i].className) ) {
            returnArray.push(els[i]);
        }
    }
    return returnArray;
}

if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function(elt /*, from*/){
        var len = this.length;

        var from = Number(arguments[1]) || 0;
        from = (from < 0) ? Math.ceil(from) : Math.floor(from);
        if (from < 0)
            from += len;

        for (; from < len; from++) {
            if (from in this &&
                this[from] === elt)
                return from;
        }
        return -1;
    };
}

