
// Text size Widget Script
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);	

  loadtabs(); //tasnook added 2008.07.31

}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);



// Jump Menu

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}



// Re-enable divs disabled by javascript Javascript

function loadtabs() {

if (document.getElementById("tab")) {

document.getElementById("tab").style.display='block';
}


/*Divs you wan to turn OFF if Javascript is On*/

var hidediv= new Array() 


hidediv[0]="tab_content2";
hidediv[1]="tab_content3";
hidediv[2]="tab_content4";
hidediv[3]="noscript-tab1";
hidediv[4]="noscript-tab2";
hidediv[5]="noscript-tab3";
hidediv[6]="noscript-tab4";
hidediv[7]="text-size";

for (var i=0; i<=hidediv.length-1; i++) {

	if (document.getElementById(hidediv[i])) {
		/*alert ("document.getElementById(\"" + hidediv[i] + "\")");*/
		document.getElementById(hidediv[i]).style.display='none';
	}

}

/*Divs you wan to turn ON if Javascript is On*/

var showdiv= new Array() 

showdiv[0]="text-size";

for (var i=0; i<=showdiv.length-1; i++) {
	if (document.getElementById(showdiv[i])) {
	
		/*alert ("document.getElementById(\"" + showdiv[i] + "\")");*/
		document.getElementById(showdiv[i]).style.visibility='visible';
		document.getElementById(showdiv[i]).style.display='block';
	}
}


/*Divs you wan to Overflow auto if Javascript is on*/

var overflowdiv= new Array() 

overflowdiv[0]="tab_content1";
overflowdiv[1]="tab_content2";
overflowdiv[2]="tab_content3";
overflowdiv[3]="tab_content4";

for (var i=0; i<=overflowdiv.length-1; i++) {
	if (document.getElementById(overflowdiv[i])) {
		
		document.getElementById(overflowdiv[i]).style.overflow='auto';
		document.getElementById(overflowdiv[i]).style.height='300px';
	}
}

/*Make share disappear for opera*/
 	if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Opera/x.x or Opera x.x (ignoring remaining decimal places);
		var oprversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 	if (oprversion>=8) {

			document.getElementById("share-me").style.display='none';
			

		}

		
	}


}




//DOM scripting to force IE6 to perform :hover on <li> tags


	sfHover = function() {
	if (document.getElementById("subnav")) {
			var sfEls = document.getElementById("subnav").getElementsByTagName("LI");
			

			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					className = this.className;
					this.className+=" sfhover";

				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");

				}
			}
		}

	if (document.getElementById("nav")) {
			var sfElsTop = document.getElementById("nav").getElementsByTagName("LI");
			

			for (var i=0; i<sfElsTop.length; i++) {
				sfElsTop[i].onmouseover=function() {
					className = this.className;
					this.className+=" sfhover";

				}
				sfElsTop[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");

				}
			}
		}
		
}

if (window.attachEvent) window.attachEvent("onload", sfHover);



// Opera detect to disable the share
function isOpera() {

}







// Tabbing Script
function getTab (tabnum) {

var showContent = "tab_content" + tabnum
var showTab = "tab" + tabnum
var tab = document.getElementById("tab"); 
var lis = tab.getElementsByTagName("li"); 
	


var tabContent = document.getElementById("tabbed-content"); 
var divs = tabContent.getElementsByTagName("div"); 
for (var j=0; j<=divs.length; j++) 
	{ 

		var el = divs[j]; 
		if (el) 
		{ 
        	//alert(el); 
     		el.style.display = "none"; 
			
         } 
      
	

     }

document.getElementById(showContent).style.display='block'

var thisTab=document.getElementById("tab").getElementsByTagName("li") 
thisTab = document.getElementById(showTab).className;




if (document.getElementById("tab1") != document.getElementById(showTab)) {
	var thisClass=document.getElementById("tab1").className
		
		
		if (thisClass.indexOf('_on')!= -1) {
	
			isOn = 1;
			document.getElementById("tab1").className=thisClass.replace("_on","")
	
		}



	}


if (document.getElementById("tab2") != document.getElementById(showTab)) {
	var thisClass=document.getElementById("tab2").className
	
		if (thisClass.indexOf('_on')!= -1) {
			isOn = 1;
			document.getElementById("tab2").className=thisClass.replace("_on","")
		}


	}



if (document.getElementById("tab3") != document.getElementById(showTab)) {
	var thisClass=document.getElementById("tab3").className
	
		if (thisClass.indexOf('_on')!= -1) {
			isOn = 1;
			document.getElementById("tab3").className=thisClass.replace("_on","")
		}
		
		

	}




if (document.getElementById("tab4") != document.getElementById(showTab)) {
	var thisClass=document.getElementById("tab4").className
		var stringLength = thisClass.length;
		var startStringHere = thisClass.length - 3
		
	if (thisClass.indexOf('_on')!= -1) {
		isOn = 1;
		document.getElementById("tab4").className=thisClass.replace("_on","")

	}


}


if (thisTab.match("_on")) {
	document.getElementById(showTab).className=document.getElementById(showTab).className
}

else {
	document.getElementById(showTab).className=document.getElementById(showTab).className + "_on"
}


}





/*

SUPERNOTE v1.0beta (c) 2005-2006 Angus Turnbull, http://www.twinhelix.com
Altering this notice or redistributing this file is prohibited.

*/


// Common event handler API code.

if (typeof addEvent != 'function')
{
 var addEvent = function(o, t, f, l)
 {
  var d = 'addEventListener', n = 'on' + t, rO = o, rT = t, rF = f, rL = l;
  if (o[d] && !l) return o[d](t, f, false);
  if (!o._evts) o._evts = {};
  if (!o._evts[t])
  {
   o._evts[t] = o[n] ? { b: o[n] } : {};
   o[n] = new Function('e',
    'var r = true, o = this, a = o._evts["' + t + '"], i; for (i in a) {' +
     'o._f = a[i]; r = o._f(e||window.event) != false && r; o._f = null;' +
     '} return r');
   if (t != 'unload') addEvent(window, 'unload', function() {
    removeEvent(rO, rT, rF, rL);
   });
  }
  if (!f._i) f._i = addEvent._i++;
  o._evts[t][f._i] = f;
 };
 addEvent._i = 1;
 var removeEvent = function(o, t, f, l)
 {
  var d = 'removeEventListener';
  if (o[d] && !l) return o[d](t, f, false);
  if (o._evts && o._evts[t] && f._i) delete o._evts[t][f._i];
 };
}

function cancelEvent(e, c)
{
 e.returnValue = false;
 if (e.preventDefault) e.preventDefault();
 if (c)
 {
  e.cancelBubble = true;
  if (e.stopPropagation) e.stopPropagation();
 }
};



// *** MAIN OBJECT CLASS ***

function SuperNote(myName, config)
{
 var defaults = {
  myName: myName,        // Names used for notes of this class.
  allowNesting: false,   // Whether to allow triggers within triggers.
  cssProp: 'visibility', // CSS property used to show/hide notes and values.
  cssVis: 'inherit',
  cssHid: 'hidden',
  IESelectBoxFix: true,  // Enables the IFRAME select-box-covering fix.
  showDelay: 0,          // Millisecond delays.
  hideDelay: 500,
  animInSpeed: 0.1,           // Animation speed, from 0.0 to 1.0; 1.0 disables.
  animOutSpeed: 0.1,
  animations: [],        // Array of animation plugins.
  mouseX: 0, mouseY: 0,  // Live mouse co-ords.
  notes: {},             // Store for note timers/references.
  rootElm: null,         // The outermost element, handles mouse events.
  onshow: null,          // Events you can capture. Passed the note ID.
  onhide: null
 };

 for (var p in defaults)
  this[p] = (typeof config[p] == 'undefined') ? defaults[p] : config[p];

 // Capture mouse events on the entire document.
 var obj = this;
 addEvent(document, 'mouseover', function(evt) { obj.mouseHandler(evt, 1) } );
 addEvent(document, 'click', function(evt) { obj.mouseHandler(evt, 2) } );
 addEvent(document, 'mousemove', function(evt) { obj.mouseTrack(evt) } );
 addEvent(document, 'mouseout', function(evt) { obj.mouseHandler(evt, 0) } );

 // Record this instance in our 'instances' array (for setTimeouts).
 this.instance = SuperNote.instances.length;
 SuperNote.instances[this.instance] = this;
}
// Collection of all objects created.
SuperNote.instances = [];
// A list of note behaviour and positioning type handlers.
SuperNote.prototype.bTypes = {};
SuperNote.prototype.pTypes = {};





// *** DEFAULT TYPE HANDLERS ***

// Handlers are called as the note's state changes. They are passed:
// 1) An object reference to this SuperNote object.
// 2) The ID of the note in question.
// 3) The proposed next 'visible' flag of the note.
// 4) The proposed next 'animating' flag of the note ("positional" only).
//
// There are two types: "pTypes" are positional handlers, "bTypes" behavioural.
// Use positional handlers to perform actions when notes show/hide.
// Use behavioural handlers to cancel default actions; they're called when
// notes are about to animate, and can "return false" to cancel it.
//
// Your might find it handy to set notes[noteID].ref.style.left and .top to
// position the note. Also, checkWinX/Y() are functions accepting a note
// reference and proposed position that modify the position so the note will
// display within the borders of the current browser window.

SuperNote.prototype.pTypes.mouseoffset = function(obj, noteID, nextVis, nextAnim) { with (obj)
{
 // Position on first show, and respect both shows and hides.
 var note = notes[noteID];
 if (nextVis && !note.animating && !note.visible)
 {
  note.ref.style.left = checkWinX(mouseX, note) + 'px';
  note.ref.style.top = checkWinY(mouseY, note) + 'px';
 }
}};


SuperNote.prototype.pTypes.mousetrack = function(obj, noteID, nextVis, nextAnim) { with (obj)
{
 // Position every few milliseconds the entire time it's visible.
 var note = notes[noteID];
 if (nextVis && !note.animating && !note.visible)
 {
  var posString = 'with (' + myName + ') {' +
   'var note = notes["' + noteID + '"];' +
   'note.ref.style.left = checkWinX(mouseX, note) + "px";' +
   'note.ref.style.top = checkWinY(mouseY, note) + "px" }';
  eval(posString);
  obj.IEFrameFix(noteID, 1);
  if (!note.trackTimer) note.trackTimer = setInterval(posString, 50);
 }
 else if (!nextVis && !nextAnim)
 {
  clearInterval(note.trackTimer);
  note.trackTimer = null;
 }
}};


SuperNote.prototype.pTypes.triggeroffset = function(obj, noteID, nextVis, nextAnim) { with (obj)
{
 // Find the trigger position and offset the note from that.
 var note = notes[noteID];
 if (nextVis && !note.animating && !note.visible)
 {
  var x = 0, y = 0, elm = note.trigRef;
  while (elm)
  {
   x += elm.offsetLeft;
   y += elm.offsetTop;
   elm = elm.offsetParent;
  }
  note.ref.style.left = checkWinX(x, note) + 'px';
  note.ref.style.top = checkWinY(y, note) + 'px';
 }
}};


SuperNote.prototype.bTypes.pinned = function(obj, noteID, nextVis) { with (obj)
{
 // Ignore hide requests.
 return (!nextVis) ? false : true;
}};





// *** OBJECT METHODS ***

SuperNote.prototype.docBody = function()
{
 return document[(document.compatMode &&
  document.compatMode.indexOf('CSS') > -1) ? 'documentElement' : 'body'];
};
SuperNote.prototype.getWinW = function()
{
 return this.docBody().clientWidth || window.innerWidth || 0;
};
SuperNote.prototype.getWinH = function()
{
 return this.docBody().clientHeight || window.innerHeight || 0;
};
SuperNote.prototype.getScrX = function()
{
 return this.docBody().scrollLeft || window.scrollX || 0;
};
SuperNote.prototype.getScrY = function()
{
 return this.docBody().scrollTop || window.scrollY || 0;
};

SuperNote.prototype.checkWinX = function(newX, note) { with (this)
{
 // Takes a note and a proposed X position, and modifies the position so that
 // the note will fit within the border of the visible browser window.

 return Math.max(getScrX(), Math.min(newX, getScrX() + getWinW() - note.ref.offsetWidth - 8));
}};
SuperNote.prototype.checkWinY = function(newY, note) { with (this)
{
 return Math.max(getScrY(), Math.min(newY, getScrY() + getWinH() - note.ref.offsetHeight - 8));
}};


SuperNote.prototype.mouseTrack = function(evt) { with (this)
{
 // Stores the mouse coordinates as it moves.

 mouseX = evt.pageX || evt.clientX + getScrX() || 0;
 mouseY = evt.pageY || evt.clientY + getScrY() || 0;
}};


SuperNote.prototype.mouseHandler = function(evt, show) { with (this)
{
 // This is called from an onmouseover/click/mouseout handler in the document.
 // show: 0 = mouseout, 1 = mouseover, 2 = click.
 // It loops up the DOM from the event source, initialises element references,
 // and forwards the event to display() for processing.

 if (!document.documentElement) return true;

 var srcElm = evt.target || evt.srcElement,
  // Match CLASS="objectname-hover-foobar" or "objectname-click-foobar".
  trigRE = new RegExp(myName + '-(hover|click)-([a-z0-9]+)', 'i'),
  // Match ID="objectname-target-foobar"
  targRE = new RegExp(myName + '-(note)-([a-z0-9]+)', 'i'),
  // Whether to repsect a found trigger or not (for nesting triggers).
  trigFind = 1,
  // A list of found notes in the current DOM tree.
  foundNotes = {};

 if (srcElm.nodeType != 1) srcElm = srcElm.parentNode;
 var elm = srcElm;
 while (elm && elm != rootElm)
 {
  // Match our regexes, and keep going upwards to detect nested notes!
  if (targRE.test(elm.id) || (trigFind && trigRE.test(elm.className)))
  {
   if (!allowNesting) trigFind = 0;
   var click = RegExp.$1 == 'click' ? 1 : 0,
    noteID = RegExp.$2,
    ref = document.getElementById(myName + '-note-' + noteID),
    trigRef = trigRE.test(elm.className) ? elm : null;

   // If the target exists...
   if (ref)
   {
    // Init data store, keyed on the last part of the tag class/id.
    if (!notes[noteID])
    {
     notes[noteID] = {
      click: click,
      ref: ref,
      trigRef : null,
      visible: 0,
      animating: 0,
      timer: null
     };
     // Also store references in the note DOM object.
     ref._sn_obj = this;
     ref._sn_id = noteID;
    }
    var note = notes[noteID];

    // Add to our list of found notes on this loop up the DOM.
    // Don't "find" clicks on triggers; they're 'outside' clicks, hiding note.
    if (!note.click || (trigRef != srcElm)) foundNotes[noteID] = true;

    // Show/hide hover notes, and show onclick notes.
    if (!note.click || (show == 2))
    {
     // If this is a trigger, record this as the note's current trigger.
     // Also record the trigger reference on the note DOM object for looping.
     if (trigRef)
      notes[noteID].trigRef = notes[noteID].ref._sn_trig = elm;
     // Now call display() to show/record it, if its visibility has changed.
     display(noteID, show);
     // Click notes: avoid navigating the entire document :).
     if (note.click && (srcElm == trigRef)) cancelEvent(evt);
    }
   }
  }

  // Otherwise check the next element up the DOM.
  if (elm._sn_trig)
  {
   // If this is a note target, recurse to its original trigger and allow
   // further triggers to be found and activated.
   trigFind = 1;
   elm = elm._sn_trig;
  }
  else
  {
   elm = elm.parentNode;
  }
 }

 // Now we've finished looping up the DOM, do a final loop through our list
 // of notes, checking to see if any onclick notes need hiding.
 if (show == 2) for (var n in notes)
 {
  if (notes[n].click && notes[n].visible && !foundNotes[n]) display(n, 0);
 }
}};


SuperNote.prototype.display = function(noteID, show) { with (this)
{
 // Called to manage show/hide timers for a specified target.

 with (notes[noteID])
 {
  // Clear any existing timeout.
  clearTimeout(timer);

  // Check that this note isn't already performing the desired action.
  if (!animating || (show ? !visible : visible))
  {
   // If we're currently animating, use a short timeout.
   // Otherwise revert to the standard show/hide timeout.
   var tmt = animating ? 1 : (show ? showDelay||1 : hideDelay||1);
   timer = setTimeout('SuperNote.instances[' + instance + '].setVis("' +
    noteID + '", ' + show + ', false)', tmt);
  }
 }
}};


SuperNote.prototype.checkType = function(noteID, nextVis, nextAnim) { with (this)
{
 // Processes the two 'types' for each note and returns the results.
 // The behavioural type is called when about to animate; it can "return false"
 // to cancel the pending action.
 // The positioning type is always called whenever an action succeeds.

 var note = notes[noteID], bType, pType;
 if ((/snp-([a-z]+)/).test(note.ref.className)) pType = RegExp.$1;
 if ((/snb-([a-z]+)/).test(note.ref.className)) bType = RegExp.$1;

 if (nextAnim && bType && bTypes[bType] &&
  (bTypes[bType](this, noteID, nextVis) == false)) return false;
 if (pType && pTypes[pType]) pTypes[pType](this, noteID, nextVis, nextAnim);
 return true;
}};


SuperNote.prototype.setVis = function(noteID, show, now) { with (this)
{
 // Called from display() above; sets the note visibility,
 // calls the type handler function, and calls animate() below.
 // Pass 'now' in order to show/hide immediately (skips animation).

 var note = notes[noteID];
 if (note && checkType(noteID, show, 1) || now)
 {
  note.visible = show;
  note.animating = 1;
  animate(noteID, show, now);
 }
}};


SuperNote.prototype.animate = function(noteID, show, now) { with (this)
{
 // Repeatedly called to animate a note in and out (if applicable).

 var note = notes[noteID];

 if (!note.animTimer) note.animTimer = 0;
 if (!note.animC) note.animC = 0;

 with (note)
 {
  clearTimeout(animTimer);
  var speed = (animations.length && !now) ? (show ? animInSpeed : animOutSpeed) : 1;

  if (show && !animC)
  {
   if (onshow) this.onshow(noteID);
   IEFrameFix(noteID, 1);
   ref.style[cssProp] = cssVis;
  }

  animC = Math.max(0, Math.min(1, animC + speed * (show ? 1 : -1)));

  if (document.getElementById && speed < 1)
   for (var a = 0; a < animations.length; a++) animations[a](ref, animC);

  if (!show && !animC)
  {
   if (onhide) this.onhide(noteID);
   IEFrameFix(noteID, 0);
   ref.style[cssProp] = cssHid;
  }

  if (animC != parseInt(animC))
  {
   animTimer = setTimeout(myName + '.animate("' +
    noteID + '", ' + show + ')', 50);
  }
  else
  {
   checkType(noteID, animC ? 1 : 0, 0);
   note.animating = 0;
  }
 }
}};


SuperNote.prototype.IEFrameFix = function(noteID, show) { with (this)
{
 // Positions a hidden IFRAME under a note to allow it to cross over <select>
 // boxes in MSIE.

  if (!window.createPopup || !IESelectBoxFix) return;

  var note = notes[noteID], ifr = note.iframe;
  if (!ifr)
  {
   ifr = notes[noteID].iframe = document.createElement('iframe');
   ifr.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)';
   ifr.style.position = 'absolute';
   ifr.style.borderWidth = '0';
   note.ref.parentNode.insertBefore(ifr, note.ref.parentNode.firstChild);
  }

  if (show)
  {
   ifr.style.left = note.ref.offsetLeft + 'px';
   ifr.style.top = note.ref.offsetTop + 'px';
   ifr.style.width = note.ref.offsetWidth + 'px';
   ifr.style.height = note.ref.offsetHeight + 'px';
   ifr.style.visibility = 'inherit';
  }
  else
  {
   ifr.style.visibility = 'hidden';
  }

}};


//FLASH DETECT

// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			alert("flashVer="+flashVer);
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


