var tabs = [];
tabs[tabs.length] = [
		'images/associate_section.gif',
		'images/associate_section_o.gif',
		'<table align=center bgcolor="#e7f7ff" width="100%" ><tr><td align="left" valign="top"><a href="#">Become Our Associate</a><br><a href="#">Associate Login</a><br><a href="#">Why should become associate?</a><br><a href="#">List of our associates</a></td></tr></table>','',
	  ];
tabs[tabs.length] = [
		'images/services.gif',
		'images/services_o.gif',
			'<table border=0 align=center cellpadding=0 cellspacing=0><tr><td  valign="top">b</td></tr></table>',			'VP',
		  ];
 tabs[tabs.length] = [
		'images/project_library.gif',
		'images/project_library_o.gif',
			'<table border=0 align=center cellpadding=0 cellspacing=0><tr><td  valign="top">c</td></tr></table>',			'VP',
		  ];

 tabs[tabs.length] = [
		'images/success_story.gif',
		'images/success_story_o.gif',
			'<table border=0 align=center cellpadding=0 cellspacing=0><tr><td  valign="top">d</td></tr></table>',			'VP',
		  ];
 tabs[tabs.length] = [
		'images/newsletter.gif',
		'images/newsletter_o.gif',
			'<table border=0 align=center cellpadding=0 cellspacing=0><tr><td  valign="top">e</td></tr></table>',			'VP',
		  ];
 tabs[tabs.length] = [
		'images/hot_topic.gif',
		'images/hot_topic_o.gif',
			'<table border=0 align=center cellpadding=0 cellspacing=0><tr><td  valign="top">e</td></tr></table>',			'VP',
		  ];

var width = 755;

function preloadImages() {
	for (var y = 0; y < 2; y++) {
		for (var x = 0; x < tabs.length; x++) {
			image = new Image();
			image.src = tabs[x][y];
		}
	}
}

function drawTabs() {
	document.write("<table cellspacing=0 cellpadding=0 border=0><tr>");
	for (var x = 0; x < tabs.length; x++) {
		document.write("<td id='tabtd"+x+"' width=169 background=images/blank.gif>");
		if ( x != 0 )
		{
			document.write("<a href='javascript:void(0);'  onMouseOver='eventOnSwitchTab("+x+")'>");
		}
		document.write("<img name='tab"+x+"' border=0  src="+tabs[x][0]+" hspace=10></a></td>");
	}
	document.write("</td><td width=500 background=images/blank.gif></td></tr><tr><td id=currentTab colspan="+(tabs.length+1)+" align=center>");
    if ( tabs[0] && tabs[0][2] )
    {
		document.write(tabs[0][2]);
	}
	document.write("</td></tr></table>");
    if ( document.images["tab0"] )
    {
	document.images["tab0"].src = tabs[0][1];
	}
}
/////////////////////////////////// For Video Profile /////////////////////////////////
function getVP_logo(url,id_area)
{
  http_request = false;
//  document.getElementById(id_area).innerHTML='<TD colspan="2" ALIGN="CENTER"><B>Please Wait..</B></TD> ';

  if (window.XMLHttpRequest)
  {
   http_request = new XMLHttpRequest();
   if (http_request.overrideMimeType)
   {
    http_request.overrideMimeType('text/xml');
   }
  }
  else if (window.ActiveXObject)
  { // IE
   try
   {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch (e)
   {
    try
    {
     http_request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)
    {
    }
   }
  }
  http_request.onreadystatechange = alertContents;
  http_request.open('GET', url, true);
  data = http_request.send(null);
  
  function alertContents()
  {
   if (http_request.readyState == 4)
   {
    if (http_request.status == 200)
    {
//     document.getElementById(id_area).innerHTML = http_request.responseText;
    }
    else
    {

    }
   }
  }
}
//////////////////////////////////////////////////////////////////////////////////
vpLogoLoadedFlg = 0;
blLogoLoadedFlg = 0;
function eventOnSwitchTab (tab)
{
	if (tabs[tab][3] && tabs[tab][3] == 'VP')
	{
		switchTab(tab);
		if ( vpLogoLoadedFlg == 0 )
		{
			try {
			getVP_logo("view_count.html?comma_sep_ids_logo_lnk=&comma_sep_ids_txt_lnk=11,9,13,192,14,153&type=VPLOGO","currentTab");
			}
			catch(e)
			{
				//alert(e);
			}
		}
		vpLogoLoadedFlg = 1;
	}
	else if (tabs[tab][3] && tabs[tab][3] == 'BL')
	{
		switchTab(tab);
		if ( blLogoLoadedFlg == 0 )
		{
			try {
			getVP_logo("view_count.html?comma_sep_ids_logo_lnk=&comma_sep_ids_txt_lnk=&type=BLLOGO","currentTab");
			}
			catch(e)
			{
				//alert(e);
			}
		}
		blLogoLoadedFlg = 1;
	}

	else
	{
		switchTab(tab);
	}
}

function intializeTabs()
{
    drawTabs();
    if ( tabs[0] )  // If Any event is associated with it then it should be executed. ( In this case View count must be increased if First Tab is Video Tab
    {
        eventOnSwitchTab(0);
    }
}

function switchTab(tab) {
	for (var x = 0; x < tabs.length; x++) {
		if (x != tab)
		{
			document.images["tab"+x].src = tabs[x][0];
			document.getElementById("tabtd"+x).innerHTML	= "<a href='javascript:void(0);'  onMouseOver='eventOnSwitchTab("+x+")'><img name='tab"+x+"' border=0  src="+tabs[x][0]+" hspace=2></a>";
		}
		else
		{
			document.getElementById("tabtd"+x).innerHTML	= "<img name='tab"+x+"' border=0  src="+tabs[x][0]+" hspace=2>";
		}
	}
	document.images["tab"+tab].src = tabs[tab][1];
	document.getElementById("currentTab").innerHTML = tabs[tab][2];
}
preloadImages();


