﻿window.onload=function(){
Nifty("h3.h-style1,div.boxs2 h3.title","top");
Nifty("div.form-block,div.search-block,div.archive-block","medium transparent");
Nifty("div.pager a,div.links-block,ul.list-faq li","small transparent");
Nifty("div.commentForm","medium bottom");
}

function SiteClass()
{
    this.enlargewidth = 268;
	this.shrinkwidth = 162;
	this.restwidth = 185;
   

    this.mouseover = function(i)    
    {
        var obj = {};
			
		var temp = this;	
		this.Accords.each(function(other, j)
		{		    
		    var w = other.getStyle('width').toInt();
		    		   
			if (j != i)
			{						
				if (w != temp.shrinkwidth) obj[j] = {'width': [w, temp.shrinkwidth]};
			}
			else
			{
			    if (w != temp.enlargewidth) obj[j] = {'width': [w, temp.enlargewidth]};
			}
		});
			
		this.fx.start(obj);
    }
    
    this.returntorest = function()
    {
        var temp = this;
        var obj = {};
        this.Accords.each(function(other, j){
	        obj[j] = {'width': [other.getStyle('width').toInt(), temp.restwidth]};
        });
        this.fx.start(obj);
    }

    this.parseAccords = function()
    {       
		//this.Accords = $$('#Accord .Accord');		
		
		//bodge for asp.net js conflict
		this.Accords = new Array();
		this.Accords[0] = $('Accord1');
		this.Accords[1] = $('Accord2');
		this.Accords[2] = $('Accord3');
		this.Accords[3] = $('Accord4');
		this.Accords[4] = $('Accord5');
		
		this.fx = new Fx.Elements(this.Accords, {wait: false, duration: 300, transition: Fx.Transitions.quadInOut});
    	
    	
    	
    	var temp = this;
		this.Accords.each(
		    function(Accord, i)
	        {
	            
		        Accord.addEvent('mouseenter', function(e)
		            {
			            temp.mouseover(i);
		            });
	        });
		
		$('Accord').addEvent('mouseleave', 
		    function(e)
		    {		   		        
		        if (temp.ActiveTab == null)
		        {
			        temp.returntorest();
			    }
			    else
			    {
			        temp.mouseover(Site.ActiveTab);
			    }
		    });
		    
		if (this.ActiveTab != null)
		    temp.mouseover(this.ActiveTab);
	};
	
	this.start = function()
    {       
        
        if ($('Accord'))
        {            
            this.parseAccords();
        }
    };
}



var Site = new SiteClass();
window.addEvent('load', function(){Site.start();});
