
function print_prev() {
	myform = document.dir_search
	myform.action = "/layout/set/ajax_print/Capital-Health-Plan/Network-Directory/Search-for-Physicians-and-Providers";
	myform.page_limit.value = 10000;
	myform.offset.value = 0;
	myform.submit();
}

function getStyle(x,styleProp)
{
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}


function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}

var IEver = getIEVersionNumber()

 function EventWorker() {
   this.addHandler = EventWorker.addHandler;
 }


 EventWorker.addHandler = function (eventRef, func) {
  var eventHandlers = eval(eventRef);
  if (typeof eventHandlers == 'function') {
   eval(eventRef + " = function(event) {eventHandlers(event); func(event);}");  
  } else {
   eval(eventRef + " = func;");
  }
 }

 function getElementsByClass(node,searchClass,tag) {
   var classElements = new Array();
   var els = node.getElementsByTagName(tag); // use "*" for all elements
   var elsLen = els.length;
   var pattern = new RegExp("\\b"+searchClass+"\\b");
   for (i = 0, j = 0; i < elsLen; i++) {
     if ( pattern.test(els[i].className) ) {
       classElements[j] = els[i];
       j++;
     }
   }
   return classElements;
 }

 function firstRealSib(obj) {
   var output = obj;
   while (output == obj || output.nodeType == 3) {
      output = output.nextSibling;
   }
   return output;
 }

 function firstRealChild(obj) {
   var output = obj.firstChild;
   while (output.nodeType == 3) {
      output = output.nextSibling;
   }
   return output;
 }

 function sort_uls() {
   var uls = getElementsByClass(document, 'slist', 'UL');
  if (uls.length != 0) {
   for (i in uls) {
      if (uls[i].firstChild.tagName == 'LI') {
         uls[i].firstChild.className = 'first';
      } else {
         uls[i].firstChild.nextSibling.className = 'first';
      }
   }
  }
 }

// EventWorker.addHandler("window.onload", sort_uls);

var myAnim = new Array();


function show_slide(i) {

   if (document.getElementById('tab' + i).className != 'tab-skin selected') {
      for (xx=5; xx > 0; xx--) {
         this_slide = document.getElementById('tab' + xx);
         if (i != xx) {
            if (typeof myAnim[xx] == 'object') myAnim[xx].stop;
            if (this_slide.parentNode.className != 'tab-skin selected' && this_slide.style.opacity > 0) this_slide.style.opacity = 0;
            if (this_slide.parentNode.className == 'tab-skin selected') {
               myAnim[xx] = new YAHOO.util.Anim(this_slide.firstChild, { opacity: { to: 0 } }, 1, YAHOO.util.Easing.easeOut);
               myAnim[xx].animate();
            }
            this_slide.parentNode.className = 'tab-skin normal';
         } else {
            if (typeof myAnim[i] == 'object') myAnim[i].stop;
            myAnim[i] = new YAHOO.util.Anim(this_slide.firstChild, { opacity: { to: 1 } }, 1, YAHOO.util.Easing.easeOut);
            myAnim[i].animate();
            this_slide.parentNode.className = 'tab-skin selected';
	  }
      }
   }
}

/*
initMenu = function() {
   var ieULs = document.getElementById('menu');
   var ieLIs = ieULs.getElementsByTagName('li');
   for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
		if (ieLIs[i].className != 'welcome') ieLIs[i].onmouseover=function() {
			if (document.getElementById('tab1')) show_slide(this.id.charAt(11));
			var sibs = this.parentNode.childNodes;	
			for (xx in sibs) {
				if (sibs[xx].tagName == 'LI') {
					sibs[xx].className = sibs[xx].className.replace(new RegExp("selected\\b"), 'normal');
					if (sibs[xx] == this ) sibs[xx].className = sibs[xx].className.replace(new RegExp("normal\\b"), 'selected');
				} 
			}
   		}
   }
}
*/

function Timer(){
    this.obj = (arguments.length)?arguments[0]:window;
    return this;
}

// The set functions should be called with:
// - The name of the object method (as a string) (required)
// - The millisecond delay (required)
// - Any number of extra arguments, which will all be
//   passed to the method when it is evaluated.

Timer.prototype.setInterval = function(func, msec){
    var i = Timer.getNew();
    var t = Timer.buildCall(this.obj, i, arguments);
    Timer.set[i].timer = window.setInterval(t,msec);
    return i;
}
Timer.prototype.setTimeout = function(func, msec){
    var i = Timer.getNew();
    Timer.buildCall(this.obj, i, arguments);
    Timer.set[i].timer = window.setTimeout("Timer.callOnce("+i+");",msec);
    return i;
}

// The clear functions should be called with
// the return value from the equivalent set function.

Timer.prototype.clearInterval = function(i){
    if(!Timer.set[i]) return;
    window.clearInterval(Timer.set[i].timer);
    Timer.set[i] = null;
}
Timer.prototype.clearTimeout = function(i){
    if(!Timer.set[i]) return;
    window.clearTimeout(Timer.set[i].timer);
    Timer.set[i] = null;
}

// Private data

Timer.set = new Array();
Timer.buildCall = function(obj, i, args){
    var t = "";
    Timer.set[i] = new Array();
    if(obj != window){
        Timer.set[i].obj = obj;
        t = "Timer.set["+i+"].obj.";
    }
    t += args[0]+"(";
    if(args.length > 2){
        Timer.set[i][0] = args[2];
        t += "Timer.set["+i+"][0]";
        for(var j=1; (j+2)<args.length; j++){
            Timer.set[i][j] = args[j+2];
            t += ", Timer.set["+i+"]["+j+"]";
    }}
    t += ");";
    Timer.set[i].call = t;
    return t;
}
Timer.callOnce = function(i){
    if(!Timer.set[i]) return;
    eval(Timer.set[i].call);
    Timer.set[i] = null;
}
Timer.getNew = function(){
    var i = 0;
    while(Timer.set[i]) i++;
    return i;
}

function isObject(v) {
	return typeof v == 'object'
}

function isNumber(v) {
	return typeof v == 'number'
}

var selected_tab, selected_page, current_tab, current_page, hover_tab;
initMenu = function()
{
   var tab_bar = document.getElementById('menu');
   var tab_node = tab_bar.getElementsByTagName('li');


      for (var tab_index = 0; tab_index < tab_node.length; tab_index++)
   {
	      if (tab_node[tab_index].id.indexOf('tab_switch') == 0)
	   {
		      if (tab_node[tab_index].className.indexOf('selected') == 0)
		   {
			selected_tab = tab_node[tab_index];
			hover_tab = tab_node[tab_index];
		   }

		tab_node[tab_index].onmouseover = function()
		{
		   if (this != hover_tab) {hover_tab.out();}
		      if (document.getElementById('tab1'))
		   {
			show_slide(this.id.charAt(11));
		   }
		hover_tab = this;

		  this.className = this.className.replace(new RegExp("normal"), 'selected');
		  selected_tab.className = selected_tab.className.replace(new RegExp("selected"), 'normal');

		if (isNumber(this.timerRef)) this.timer.clearTimeout(this.timerRef);
		this.className = this.className.replace(new RegExp("normal"), 'selected');
		current_tab = this;
		}

		tab_node[tab_index].onmouseout = function()
		{
		   if (this == current_tab) current_tab = false;
		   if (isNumber(this.timerRef)) this.timer.clearTimeout(this.timerRef);
		   if (document.getElementById('tab1')) {selected_tab = this;}
		this.timer = new Timer(this)
		this.timerRef = this.timer.setTimeout("out",800);
		}

		tab_node[tab_index].out=function()
		{
		this.timerRef = null;
		      if (hover_tab != selected_tab)
		   {
			this.className = this.className.replace(new RegExp("selected"), 'normal');
		   }
		      if (!current_tab)
		   {
//			   if (document.getElementById('tab1')) show_slide(selected_tab.id.charAt(11));
			      if (!document.getElementById('tab1'))
			   {
				selected_tab.className = selected_tab.className.replace(new RegExp("normal"), 'selected');
			   }

			      if (isObject(selected_page))
			   {
				selected_page.className = selected_page.className.replace(new RegExp("normal"), 'selected');
			   }
		   }
	   	}

		page_nodes = tab_node[tab_index].getElementsByTagName('li');
		      for (var page_index = 0; page_index < page_nodes.length; page_index++)
		   {
			   if (page_nodes[page_index].className.indexOf('selected') == 0) {selected_page = page_nodes[page_index];}

				page_nodes[page_index].onmouseover = function()
				{
				   if (isNumber(this.timerRef)) this.timer.clearTimeout(this.timerRef);
				   if (selected_page) selected_page.className = selected_page.className.replace(new RegExp("selected"), 'normal');
				this.className = this.className.replace(new RegExp("normal"), 'selected');
				current_page = this;
				}

				page_nodes[page_index].onmouseout = function()
				{
				   if (this == current_page) current_page = false;
				   if (isNumber(this.timerRef)) this.timer.clearTimeout(this.timerRef);
				this.timer = new Timer(this)
				this.timerRef = this.timer.setTimeout("out",400);
					this.className = this.className.replace(new RegExp('selected'), 'normal');
				}

				page_nodes[page_index].out=function()
				{
				this.timerRef = null;
				   if (!current_page && selected_page) {selected_page.className = selected_page.className.replace(new RegExp("normal"), 'selected');}
			   	}
		   }

	   }
   }
}
EventWorker.addHandler("window.onload", initMenu );

function hideleft(obj) {
   var myAnim = new YAHOO.util.Anim(obj, { height: { to: 0 } }, .4, YAHOO.util.Easing.easeOut);
   myAnim.onComplete.subscribe(function(){ obj=this.getEl();obj.style.height = 'auto';obj.style.left = '-5000px';obj.style.position = 'absolute';});
   myAnim.animate(); 
}

function antihideleft(obj) {
   var start_height = obj.offsetHeight;
   obj.style.height = '0px';
   obj.style.left = '0px';
   obj.style.display = 'block';
   obj.style.position = 'relative';
   var myAnim = new YAHOO.util.Anim(obj, { height: { to: start_height } }, .4, YAHOO.util.Easing.easeOut);
   myAnim.animate(); 
}


function Verifyme(ThisForm)
{
var Goodtogo = true;
var Oldradio = 0;
myform = document.forms[ThisForm];
for (i = 0; i < myform.elements.length; i++)
{
thiselement = myform.elements[i];
if (thiselement.type == 'text' || thiselement.type == 'textarea') {
var thisentry = thiselement.value;
if (!thisentry) {
thiselement.style.backgroundColor = "Pink";
Goodtogo = false;
} else {
thiselement.style.backgroundColor = "White";
}
}
if (thiselement.type == 'radio') {

var thisentry = thiselement.checked;
if (!thisentry && Oldradio >0) {
thiselement.style.backgroundColor = "Pink";
Goodtogo = false;
myform.elements[Oldradio].style.backgroundColor = "Pink";
} else if (!thisentry) {
Oldradio = i;
}
}
}
if (Goodtogo) {
myform.submit();
}

}
