function loadFunc()
{
	oc_init('tabs');
	productTabs("tabs", "tab-");
}

function colorRows()
{
	var content;
	var tables;
	var rows;
	var table;
	var row;

	if ( document.getElementsByTagName && document.getElementById )
	{
		if (content = document.getElementById( 'content-main' ))
		{
			tables = content.getElementsByTagName('TABLE');

			for ( table = 0; table < tables.length; table++ )
			{
				rows = tables[table].getElementsByTagName('TR');

				for ( row = 0; row < rows.length; row++ )
				{
					if ( row % 2 == 1 )
					{
						rows[row].className = 'alt';
					}
				}
			}
		}
	}
}


function oc_init( treename )
{
	var uls;
	var ul;

	if ( ! document.getElementById )
		return;

	if ( ( ul = document.getElementById( treename ) ) == null )
		return;

	ul.lastChild.className = 'last-child';
}

function addClass(elem, newClass) {
	if(elem.nodeType == 1) {
		var existingClasses = elem.className.split(/\s+/);
		var exists = false;

		for(var i = 0; i < existingClasses.length; i++) {
			if(existingClasses[i] == newClass) {
				exists = true;
				break;
			}
		}

		if(!exists) elem.className += (existingClasses.length > 0 ? " " : "") + newClass;
	}
}

function removeClass(elem, removeClass) {
	if(elem.nodeType == 1) {
		var existingClasses = elem.className.split(/\s+/);
		var newClasses = [];

		for(var i = 0; i < existingClasses.length; i++) {
			if(existingClasses[i] != removeClass) {
				newClasses.push(existingClasses[i]);
			}
		}

		elem.className = newClasses.join(" ");
	}
}

function addEventHandler(elem, event, func) {
	if(elem.attachEvent) {
		elem.attachEvent("on" + event, func);
	} else {
		elem.addEventListener(event, func, false);
	}
}

function createContentSwitcher(prefix, idx, total) {
	return function() {
		for(var i = 1; i <= total; i++) {
			var content = document.getElementById(prefix + i);
			if(content) content.style.display = (idx == i ? "" : "none");
		}
	};
}

function createTabSwitcher(tabs, idx, toggleClass) {
	return function() {
		var tabLinks = tabs.getElementsByTagName("a");
		for(var i = 0; i < tabLinks.length; i++) {
			if(i + 1 == idx) {
				addClass(tabLinks[i], toggleClass);
			} else {
				removeClass(tabLinks[i], toggleClass);
			}
		}
	};
}

function productTabs(tabsId, contentIdPrefix) {
	if(document.getElementById && document.getElementsByTagName) {
		var tabs = document.getElementById(tabsId);

		if(tabs) {
			var tabLinks = tabs.getElementsByTagName("a");

			for(var i = 0; i < tabLinks.length; i++) {
				addEventHandler(tabLinks[i], "click", createContentSwitcher(contentIdPrefix, i + 1, tabLinks.length));
				addEventHandler(tabLinks[i], "click", createTabSwitcher(tabs, i + 1, "active"));
				tabLinks[i].onclick = function() { return false; };
			}

			createContentSwitcher(contentIdPrefix, 1, tabLinks.length).call();
			createTabSwitcher(tabs, 1, "active").call();
		}
	}
}

var FlashActiveX;
var FlashActiveXVersion;

function FlashOK( version )
{
  if (navigator.plugins && navigator.plugins.length > 0)
  {
 	  if (navigator.plugins["Shockwave Flash"])
	{
	  var words = navigator.plugins["Shockwave Flash"].description.split(" ");

		for (var i = 0; i < words.length; ++i)
  	  {
		if (isNaN(parseInt(words[i])))
	   		continue;

	 		if ( parseInt(words[i]) >= version )
	 		{
	 		  return true;
	 		}
	  }
	}
  }
  else if ( FlashActiveX != null)
  {
	if ( FlashActiveX )
	{
	  return FlashActiveXVersion >= version;
	}
  }

  return false;
}


if ( navigator.userAgent.indexOf("MSIE") != -1 )
{
  if ( ! ( ( navigator.appVersion.indexOf("Mac") != -1 ) && ( parseInt(navigator.appVersion) == 3) ) )
  {
	document.writeln('<script language="VBScript">');
	document.writeln('Private i, x');

	document.writeln('On Error Resume Next');

	document.writeln('FlashActiveX = False');
	document.writeln('FlashActiveXVersion = 0');

	document.writeln('For i = 12 To 2 Step -1');

	document.writeln('  Set x = CreateObject("ShockwaveFlash.ShockwaveFlash." & i)');

	document.writeln('  If IsObject(x) Then');
	document.writeln('	FlashActiveX = True');
	document.writeln('	FlashActiveXVersion = i');
	document.writeln('	Exit For');
	document.writeln('  End If');

	document.writeln('Next');

	document.write('</scr');
	document.writeln('ipt>');

  }
}

function fm (v,f,w,h,i,a)
{
	if ( FlashOK(v) )
	{
		document.write( '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + w + '" height="' + h + '" id="' + i + '" align="middle">' );
		document.write( '  <param name="allowScriptAccess" value="sameDomain" />' );
		document.write( '  <param name="movie" value="' + f + '" /><param name="quality" value="high" />' );
		document.write( '  <embed src="' + f + '" quality="high" wmode="transparent" width="' + w + '" height="' + h + '" name="' + i + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' );
		document.write( '</object>' );
	}
	else
	{
		document.write( a );
	}
}
