/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

	var p1 = new Ext.TabPanel({
        renderTo: 'container',
		activeTab: 0,
		width:655,
		plain:true,
		defaults:{autoHeight: true},
        items: [{
                title: 'The Company :',
				html: '<p><br><span class="style2"><span class="style5">&nbsp;&nbsp;&nbsp;&nbsp;InTech Solutions</span> provides the complete range of IT services spanning, software development, Web-based Solutions, data connectivity, hardware, maintenance, networking, smart-card solutions, besides fully packaged software solutions in Banking, Retail and Education.<br /><br />'
            },{
              title: 'Our Commitment:',
              html: '<ul><li><span class="style1">*</span>	To understand your present set-up and needs and offer total solutions at optimum costs. </li><li ><span class="style1">*</span>	To estimate long-term hardware / software needs of the organization.</li><li><span class="style1">*</span> To anticipate new requirements and provide applications that can create cutting edge advantage for your organization.</li><li><span class="style1">*</span> To create an ongoing alliance for managing the challenges facing your organization.</li></ul></p>'
            }]
		
       });
 
 var tabs1 = new Ext.TabPanel({
        //renderTo: document.body,
        renderTo: 'tabs3',
		activeTab: 0,
        width:655,
		//height:400,
        plain:true,
        defaults:{autoHeight: true},
        //defaults:{autoHeight: true},
	   items:[{
				contentEl:'script1',
				title:   'Products'
				//autoLoad: 'Product.htm'
				//listeners: {activate: myajax1}
			},{
                //contentE1:'script2',
				title: 'Services',
				//autoLoad: {url: 'examples/tabs/ajax2.htm', params: 'foo=bar&wtf=1'}
				autoLoad:'services.htm'
				//html : 'Working...'
            },{
                title: 'Core Competence',
				//autoLoad: {url: 'examples/tabs/ajax2.htm', params: 'foo=bar&wtf=1'}
				autoLoad:'core1.htm'
            },{
               title: 'Major Customers',
               //listeners: {activate: handleActivate},
                autoLoad: 'client1.htm'
            },{
                 title: 'Contact Us',
                //disabled:true,
				autoLoad : 'contact_us.htm'
              
	     }]
     });
   

 
Ext.get('bt2').on('click', function(e){
     tabs1.activate(0);
	
});
  
Ext.get('bt3').on('click', function(e){
        //alert('Are you sure you want to do that?');
	  // myajax1();
	    tabs1.activate(1);
	
 });

Ext.get('bt4').on('click', function(e){
      // alert('Add New tab try....');
	 //myajax1();
	 tabs1.activate(2);
   
});

Ext.get('bt5').on('click', function(e){
    tabs1.activate(3);
 });
Ext.get('bt6').on('click', function(e){
    tabs1.activate(4);
 });

 

function handleActivate(tab)
	{
   	   alert(tab.title + ' was activated.');
	}
    
	var req = null;
    var timer = null;

function myajax1()
    {
      alert('myajax called');
      dstr = 'http://test.intechdb/cgi-bin/project2.exe/ajax1';
      if (timer != null)clearTimeout(timer);
      timer = null;
      if (req == null)
	   {
         if (window.XMLHttpRequest)
		  {  req = new XMLHttpRequest();} 
		  else
		  { req = new ActiveXObject("Microsoft.XMLHTTP");}
	   }
	  req.open('POST', dstr, true); <!-- Async -->
	  req.onreadystatechange = GridReady;
	  req.send('');<!-- POST -->
	  document.getElementById("prod").innerHTML = "working...";
   }

   function GridReady()
	{
	  if (req.readyState == 4) {
		if (req.status == 200) {
		  document.getElementById("prod").innerHTML = req.responseText;
		}
      }
	}
 


});
