function WwsManager()
{
 	this._init();
};

YAHOO.extend(WwsManager, YAHOO.util.EventProvider);

WwsManager.prototype._layoutView;
WwsManager.prototype._actionHandler;
WwsManager.prototype._LeftNav;
WwsManager.prototype._dialog;
WwsManager.prototype._divArray = new Array("HomePage", "portfolio-display", "movie-portfolio-display", "contact-us", "hosting");
WwsManager.prototype._webAccordion;


WwsManager.prototype._init = function()
{
	 var Dom = YAHOO.util.Dom,
	 Event = YAHOO.util.Event;
	
	 //this.initLeftMenu();
	 //this.initTopMenu();
		
	 this._dialog = new WwsDialogue();
 	var _this = this;	
	if($.browser.msie)
	{
		$.ajaxSetup ({
			cache: false
		});
	}
	var ajax_load = "<div id='loading'><img src='app/css/images/ajax-loader.gif' alt='loading...' /></div>";  
	 $("#portfolio-icon").click(function(){
		_this.clicked(null, "portfolio-display");								 
		$("#portfolio-display").html(ajax_load).load("app/php/portfolio.php #portfolio-content", function () {
			_this.portfolioSlider();
	   });
																										 
	});
	 
	 $("#home-icon").click(function(){
		_this.clicked(null, "HomePage");								 
		$("#HomePage").html(ajax_load).load("app/php/home.php #home-content", function () {
			_this.sliderHome();
		});
																										 
	});
	 
	 //YAHOO.util.Event.addListener("home-icon", "click", this.clicked, "HomePage", this); 
	 //YAHOO.util.Event.addListener("portfolio-icon", "click", this.clicked, "portfolio-display", this); 
	 YAHOO.util.Event.addListener("hosting-icon", "click", function() {
																	window.open("http://www.securepaynet.net/Hosting/Legacy.aspx?ci=1782&prog_id=437390", '_blank');
																	}); 
	 YAHOO.util.Event.addListener("quote-icon", "click", this.clicked, "quote", this);
	 YAHOO.util.Event.addListener("multimedia-icon", "click", this.clicked, "movie-portfolio-display", this);
	 YAHOO.util.Event.addListener("contact-icon", "click", this.clicked, "contact-us", this);

	 
	 $(function(){

		$("div#demo ul#menu li img").bubbleup({tooltip: true, scale:96});
		
	});
	 
	 $(document).ready(function() {
		$("#HomePage").html(ajax_load).load("app/php/home.php #home-content", function () {
			_this.sliderHome();
		});
	});

};
WwsManager.prototype.sliderHome = function()
{
	$("#slider-slideshow").easySlider({
		  	controlsBefore:	'<p id="controls">',
			controlsAfter:	'</p>',
			auto: true,
			continuous: true 
		});
		
		$("#slider-text").easySlider({
		  	controlsBefore:	'<p id="controls2">',
			controlsAfter:	'</p>',
			prevId: 'prevBtn2',
			nextId: 'nextBtn2'	
		});
}

WwsManager.prototype.clicked = function(a, type)
{
	 var object = this;
	 if(type == "quote")
	 {
	 	this._dialog.showPanel(type);
	 }
	 else
	 {
		for (i=0;i<this._divArray.length;i++)
		{
			this.hideDiv(this._divArray[i]);
		}
	
		this.showDiv(type);
		if(type == "contact-us")
		{
			this._dialog.showContactForm();	
		}
		/*if(type == "portfolio-display")
		{
			

		}*/
	 }
}
WwsManager.prototype.portfolioSlider = function()
{
	//vars
		var conveyor = $(".content-conveyor", $("#sliderContent")),
		item = $(".item", $("#sliderContent"));
		
		//set length of conveyor
		conveyor.css("width", item.length * parseInt(item.css("width")));
				
        //config
        var sliderOpts = {
		  max: ((item.length -1) * parseInt(item.css("width"))) - parseInt($(".viewer", $("#sliderContent")).css("width")),
          slide: function(e, ui) { 
            conveyor.css("left", "-" + ui.value + "px");
          }
        };

        //create slider
        $("#slider").slider(sliderOpts);
		/*this.fixZIndex("viewer");
		this.fixZIndex("conveyor");
		$('#viewer').css('filter', "alpha(opacity=100)");
		$('#conveyor').css('filter', "alpha(opacity=100)");*/

}


WwsManager.prototype.phpCallBack = function(a, b, c) 
{
	var placeholder;
}
WwsManager.prototype.hideDiv = function(className)
{
	 if(!YAHOO.util.Dom.hasClass(className, "hidden"))
	 {
		$('#'+className).slideDown('slow', function() {
			// Animation complete.
			YAHOO.util.Dom.addClass(className, "hidden");
		});

		
	 }
	 	// $('#'+className).fadeOut('slow', function() {});

}

WwsManager.prototype.showDiv = function(className)
{
	 if(YAHOO.util.Dom.hasClass(className, "hidden"))
	 {
	 	YAHOO.util.Dom.removeClass(className, "hidden");
	 }
	// $('#'+className).fadeIn('slow', function() {});

}
WwsManager.prototype.fixZIndex = function(divId)
{	
	var highestIndex = 0;  
	var currentIndex = 0;
	$('div').each(function() {
		var curr = $(this).css('zIndex')
		if (curr == parseInt(curr))
		{
			currentIndex = curr;
			if(parseInt(currentIndex) > parseInt(highestIndex))
			{
				highestIndex = currentIndex;
			}
		}
	});
	$('#'+divId).css('zIndex', highestIndex+1);

}
