// JavaScript Class For Administration UserInterface

var Wildsow = {
		
	getInstance: function() {
		if (this._instance == null)
		{
			this._instance = this;
			this.url = 'index.php';
			this.init();
		}
		return this._instance;
	},
	
	init: function() {
		Cufon.replace('h1', {hover: true});
        Cufon.replace('h2', {hover: true});
        Cufon.replace('h3', {hover: true});
	},
	
	display: function(obj) {
		document.getElementById(obj).style.display = 'block';
	},
	
	hide: function(obj) {
		document.getElementById(obj).style.display = 'none';
	},
	
	displayBlank: function(obj) {
		document.getElementById(obj).style.display = '';
	},
	
	lightBox: function (params, objId) {
		
		this.params = params.ajaxParams;
		this.params.id = objId;
		lb = document.getElementById('lbLoadMessage');
		lb.innerHTML  = '<h1>' + params.title + '</h1><br />';
		lb.innerHTML += '<input type="button" class="inpBtn" onclick="objApp.hideLightBox();" value="' + params.buttonCancel + '" /> &nbsp; ';
		lb.innerHTML += '<input type="button" class="inpBtn btnDel" onclick="objApp.ajaxRequest(objApp.params);" value="' + params.buttonOK + '" />';
		
		this.display('overlay');
		this.display('lightbox');
	},
	
	hideLightBox: function() {
		this.hide('overlay');
		this.hide('lightbox');
	},
	
	displayLightBox: function() {
		this.show('overlay');
		this.show('lightbox');	
	},
	
	ajaxLightBox: function(params) {
		new Ajax.Updater('lbLoadMessage', 'index.php', {
						 parameters: params,
						 evalScripts: true,
						 method: 'post',
						 onComplete: function(transport) {
							Wildsow.display('overlay');
							Wildsow.display('lightbox');
							Wildsow.init();
						 }
						});
		
	},
	
	ajaxRequest: function(requestParams) {
		this.hideLightBox();
		new Ajax.Request( this.url, {
						  method: 'post',
						  parameters: requestParams,
						  onComplete: function(transport) {  
							if (requestParams.redirect == "true" || requestParams.redirect == true) {
								window.location = 'index.php?page=' + requestParams.page;
							}
							//requestParams.callBack();
						  }
						});
	},
	
	slideShow: function(slideshowObj)
	{
		var totalSlides = $$('.slide').length;
		alert(totalSlides);
	}
};

