// JavaScript Document
YAHOO.namespace("example.container");
YAHOO.example.init = function() {
    var myTabs = new YAHOO.widget.TabView('demo', { orientation: 'bottom' });
    myTabs.contentTransition = function(newTab, oldTab) {
        if ( newTab.anim && newTab.anim.isAnimated() ) {
            newTab.anim.stop(true);
        }
        
        newTab.set('contentVisible', true);
        YAHOO.util.Dom.setStyle(newTab.get('contentEl'), 'opacity', 0);
        
        newTab.anim = newTab.anim || new YAHOO.util.Anim( newTab.get('contentEl') );
        newTab.anim.attributes.opacity = { to: 1 };
        
        var hideContent = function() {
            oldTab.set('contentVisible', false);
            oldTab.anim.onComplete.unsubscribe(hideContent);
        };
        
        oldTab.anim = oldTab.anim || new YAHOO.util.Anim( oldTab.get('contentEl') );
        oldTab.anim.onComplete.subscribe(hideContent, this, true);
        oldTab.anim.attributes.opacity = { to: 0 };
        
        newTab.anim.animate();
        oldTab.anim.animate();
    };

};
YAHOO.example.init();
function init() {
					// Initialize the temporary Panel to display while waiting for external content to load
YAHOO.example.container.wait = 
new YAHOO.widget.Panel("wait",  
										{ width:"230px", 
										  fixedcenter:true, 
										  close:false, 
										  draggable:false, 
										  modal:true,
										  visible:false,
										  effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.2} 
										} 
									);
}
function getAgency () {
init();
YAHOO.example.container.wait.setHeader("Loading, please wait...");
YAHOO.example.container.wait.setBody("<img src=\"images/ajax-loader.gif\"/>");
YAHOO.example.container.wait.render(document.body);
// Define the callback object for Connection Manager that will set the body of our content area when the content has loaded
var myPanel = new YAHOO.widget.Panel("imgShow",  
										{ width:"400px", 
										  fixedcenter:true, 
										  close:true,
										  underlay:"shadow",
										  draggable:false, 
										  modal:true,
										  visible:false,
										  effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.2} 
										} 
									);
		myPanel.setHeader('Our Agencies');
var callback = {
	success : function(o) {
		myPanel.setBody(o.responseText);
		myPanel.render(document.body);
		myPanel.show();
///		accordion();
		YAHOO.example.container.wait.hide();
	},
	failure : function(o) {
		content.innerHTML = o.responseText;
		content.style.visibility = "visible";
		content.innerHTML = "CONNECTION FAILED!";
		YAHOO.example.container.wait.hide();
	}
}
// Show the Panel
YAHOO.example.container.wait.show();
// Connect to our data source and load the data
var conn = YAHOO.util.Connect.asyncRequest("GET", "feed.php?ac=ag", callback);
}
function showImg (textHeader, id, nWidth) {
init();
YAHOO.example.container.wait.setHeader("Loading, please wait...");
YAHOO.example.container.wait.setBody("<img src=\"images/ajax-loader.gif\"/>");
YAHOO.example.container.wait.render(document.body);
// Define the callback object for Connection Manager that will set the body of our content area when the content has loaded
var myPanel = new YAHOO.widget.Panel("imgShow",  
										{ width:nWidth+"px", 
										  fixedcenter:true, 
										  close:true,
										  underlay:"shadow",
										  draggable:false, 
										  modal:true,
										  visible:false,
										  effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.2} 
										} 
									);
		myPanel.setHeader(textHeader);
var callback = {
	success : function(o) {
		myPanel.setBody(o.responseText);
		myPanel.render(document.body);
		myPanel.show();
		YAHOO.example.container.wait.hide();
	},
	failure : function(o) {
		content.innerHTML = o.responseText;
		content.style.visibility = "visible";
		content.innerHTML = "CONNECTION FAILED!";
		YAHOO.example.container.wait.hide();
	}
}
// Show the Panel
YAHOO.example.container.wait.show();
// Connect to our data source and load the data
var conn = YAHOO.util.Connect.asyncRequest("GET", "feed.php?ac=gs&i=" + id, callback);
}
function getHTML(oDiv, pars)
{
init();
YAHOO.example.container.wait.setHeader("Loading, please wait...");
YAHOO.example.container.wait.setBody("<img src=\"images/ajax-loader.gif\"/>");
YAHOO.example.container.wait.render(document.body);
myDiv=$(oDiv);
var callback = {
	success : function(o) {
		myDiv.innerHTML = o.responseText;
		YAHOO.example.container.wait.hide();
		makeTT();
	},
	failure : function(o) {
		myDiv.innerHTML = o.responseText;
		content.innerHTML = "CONNECTION FAILED!";
		YAHOO.example.container.wait.hide();
	}
}
// Show the Panel
YAHOO.example.container.wait.show();
var conn = YAHOO.util.Connect.asyncRequest("GET", 'feed.php?' + pars, callback);
}
function sendForm(ac, f)
{
init();
YAHOO.example.container.wait.setHeader("Loading, please wait...");
YAHOO.example.container.wait.setBody("<img src=\"images/ajax-loader.gif\"/>");
YAHOO.example.container.wait.render(document.body);
var myPanel = new YAHOO.widget.Panel("sentContact",  
										{ width:"300px", 
										  fixedcenter:true, 
										  close:true,
										  underlay:"shadow",
										  draggable:false, 
										  modal:true,
										  visible:false,
										  effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.2} 
										} 
									);
		myPanel.setHeader('Send Message');
var callback = {
	success : function(o) {
		myPanel.setBody(o.responseText);
		myPanel.render(document.body);
		myPanel.show();
		YAHOO.example.container.wait.hide();
	},
	failure : function(o) {
		$('sentContact').innerHTML = o.responseText;
		YAHOO.example.container.wait.hide();
	}
}
// Show the Panel
YAHOO.example.container.wait.show();
YAHOO.util.Connect.setForm($(f));
var conn = YAHOO.util.Connect.asyncRequest("POST", 'feed.php?ac='+ac, callback);
}
function makeTT() {
	///// Tooltips ////
	YAHOO.example.container.tt1 = new YAHOO.widget.Tooltip("tt1", { context:"ct1", text:"Floor Tiles" }); 
	YAHOO.example.container.tt2 = new YAHOO.widget.Tooltip("tt2", { context:"ct2", text:"Exterior Floor Tiles" }); 
	YAHOO.example.container.tt3 = new YAHOO.widget.Tooltip("tt3", { context:"ct3", text:"Wall Tiles" }); 
	YAHOO.example.container.tt4 = new YAHOO.widget.Tooltip("tt4", { context:"ct4", text:"Single Firing" }); 
	YAHOO.example.container.tt5 = new YAHOO.widget.Tooltip("tt5", { context:"ct5", text:"Double Firing" }); 
	YAHOO.example.container.cx1 = new YAHOO.widget.Tooltip("cx1", { context:"co1", text:"Suitable for walls bathroom and bedroom floors" }); 
	YAHOO.example.container.cx2 = new YAHOO.widget.Tooltip("cx2", { context:"co2", text:"Suitable for light traffic area like the floors of house" }); 
	YAHOO.example.container.cx3 = new YAHOO.widget.Tooltip("cx3", { context:"co3", text:"Suitable for heavy traffic area like entrances" }); 
	YAHOO.example.container.cx4 = new YAHOO.widget.Tooltip("cx4", { context:"co4", text:"Suitable for heavy traffic enviorements like restaurant, shopping stores" }); 
	YAHOO.example.container.cx5 = new YAHOO.widget.Tooltip("cx5", { context:"co5", text:"Suitable for heavy traffic indoor and outdoor environments" }); 
	//////////////////
}
//// Accordion Tabs

function accordion() {
	<!--
	// Behold the DED namespace!
	var DED = window.DED || {};
	DED.example = function() {
		var YUD = YAHOO.util.Dom;
		var YUE = YAHOO.util.Event;
		var YUA = YAHOO.util.Anim;
		var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
		var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
		var last = [];
		var ua = navigator.userAgent.toLowerCase();
		var isOpera = (ua.indexOf('opera') != -1);
		var isIE = (ua.indexOf('msie') != -1 && !isOpera);
		return {
			init : function() {
				var oLi = YUD.getElementsByClassName('hd','li','content');
				for ( var i=0, j=oLi.length; i<j; ++i ) {
					YUE.on(oLi[i], 'click', this.collapse, oLi[i].offsetHeight);
				}
				YUD.batch(oLi, function(oEl) {
						if ( YUD.hasClass(oEl, 'close') ) {
							oEl.getElementsByTagName('ul')[0].style.height = '0';
						}
					}
				);
				onMenuCollapse.subscribe(this.swapColor, 'title');
				onMenuOpen.subscribe(this.closeLast);
				onMenuCollapse.subscribe(this.notify, false);
				onMenuOpen.subscribe(this.notify, true);
			},
			collapse : function(e, iH) {
				last.push(this);
				if ( last.length > 3 ) {
					last.shift();
				}
				if ( YUD.hasClass(this, 'close') ) {
					YUD.removeClass(this, 'close');
					var oEl = this.getElementsByTagName('ul')[0];
					oEl.style.height = '0';
					var iHeight = (isIE ? parseInt(iH)-60 : parseInt(iH)-30);
					var attributes = {
						height : {
							from : 0,
							to : iHeight
						}
					};
					var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
					anim.animate();
					onMenuOpen.fire();
				}
				else {
					YUD.addClass(this, 'close');
					var oEl = this.getElementsByTagName('ul')[0];
					var attributes = {
						height : {
							to : 0
						}
					};
					var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
					anim.animate();
					onMenuCollapse.fire();
				}
			},
			swapColor : function(type, args, me) {
				if ( YUD.hasClass(me, 'foo') ) {
					YUD.removeClass(me, 'foo');
				}
				else {
					YUD.addClass(me, 'foo');
				}
			},
			notify : function(type, args, b) {
				if ( b === true ) {
					YUD.get('open').innerHTML += '<p>Woot. We opened someone!<hr /></p>';
				}
				else {
					YUD.get('close').innerHTML += '<p>Woot. We collapsed \'em all!<hr /></p>';
				}
				YUD.get('action').innerHTML += '<p>Woot. We got action!<hr /></p>';
			},
			closeLast : function() {
				var oLast = last[(last.length)-2];
				if ( last.length === 1) {
					return;
				}
				else if ( oLast === last[(last.length)-1] ) {
					return;
				}
				if ( !YUD.hasClass(oLast, 'close') ) {
					YUD.addClass(oLast, 'close');
					var oEl = oLast.getElementsByTagName('ul')[0];
					var attributes = {
						height : {
							to : 0
						}
					};
					var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
					anim.animate();
				}
			}
		};
	}();
	YAHOO.util.Event.onAvailable('content',DED.example.init, DED.example, true);
	//-->
}
////////////////////

