/*if (window.createPopup && document.compatMode &&  
document.compatMode=="CSS1Compat") 
{ 
  document.onreadystatechange = onresize = function fixIE6AbsPos() 
  { 
    if (!document.body) return; 
    if (document.body.style.margin != "0px") document.body.style.margin = 0; 
    onresize = null; 
    document.body.style.height = 0; 
    setTimeout(function(){ document.body.style.height =  
document.documentElement.scrollHeight+'px'; }, 1); 
    setTimeout(function(){ onresize = fixIE6AbsPos; }, 100); 
  } 
} 

*/



	/* Load the images into the browser for dynamic switching */
	
	var tabHardLeft = new Image(10,30);
	tabHardLeft.src = "/images/web_graphics/Tabs/tab_inactive_hardLeft.gif";
	
	var Active_hardLeft = new Image(10,30);
	Active_hardLeft.src = "/images/web_graphics/Tabs/tab_active_hardLeft.gif";	
	
	var Mouseover_hardLeft = new Image(10,30);
	Mouseover_hardLeft.src = "/images/web_graphics/Tabs/tab_over_hardLeft.gif";	

	/*Note that there are no distinct 'hard-right' images  */
	
	/*  Inactive tab images  */
	var tabRight = new Image(10,30);
	tabRight.src = "/images/web_graphics/Tabs/tab_inactive_right.gif";
	
	var tabLeft = new Image(10,30);
	tabLeft.src = "/images/web_graphics/Tabs/tab_inactive_left.gif";	
	
	/*  Active tab images  */
	var Active_tabRight = new Image(10,30);
	Active_tabRight.src = "/images/web_graphics/Tabs/tab_active_right.gif";	

	var Active_tabLeft = new Image(10,30);
	Active_tabLeft.src = "/images/web_graphics/Tabs/tab_active_left.gif";

	/* Mouseover images */
	var mouseOver_tabLeft = new Image(10,30);
	mouseOver_tabLeft.src = "/images/web_graphics/Tabs/tab_over_left.gif";
	
	var mouseOver_tabRight = new Image(10,30);
	mouseOver_tabRight.src = "/images/web_graphics/Tabs/tab_over_right.gif";	
	
	/* Contact Us button Mouseover images */
	var mouseUp_ContactUs = new Image(107,22);
	mouseUp_ContactUs.src = "/images/web_graphics/Bars/contact_lit.gif";

	var mouseOver_ContactUs = new Image(107,22);	
	mouseOver_ContactUs.src = "/images/web_graphics/Bars/contact_off.gif";
	

/***************************************************
	Function:		getDate()
	Date:			
	Parameters:		none
	
	Description:	This function gets the current date of the client's machine
					and displays it in the upper-left corner of the page.
	
****************************************************/
 
function getDate() {
	//Pull the date from the machine via Javascript
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	
	switch(curr_month) {
		case 0:
			curr_month = "January";
			break;
		case 1:
			curr_month = "February";
			break;
		case 2:
			curr_month = "March";
			break;
		case 3:
			curr_month = "April";
			break;
		case 4:
			curr_month = "May";
			break;
		case 5:
			curr_month = "June";
			break;
		case 6:
			curr_month = "July";
			break;
		case 7:
			curr_month = "August";
			break;
		case 8:
			curr_month = "September";
			break;
		case 9:
			curr_month = "October";
			break;
		case 10:
			curr_month = "November";
			break;
		case 11:
			curr_month = "December";
			break;
		default:	
			curr_month = "Undefined";
	}
	//Create Date string
	document.write(curr_month + " " + curr_date + ", " + curr_year);	
}

/***************************************************
	Function:		sendMail
	Date:			June 2st, 2005
	Parameters:		none
	
	Description:	Responsible for creating a sized window to access the ASP email application.
	
****************************************************/
function sendEmail()
{
	//Location of the email application
	var emailFormPath = '/emailfriend/emailform.asp';
	
	// The link of THIS web page
	var thisLink = document.URL;
	
	//URL to point the new window to . . .
	var navigateTo = emailFormPath + '?URL=' + thisLink;
	
	// seperate the javascript window parameters so they are easy to change
	var toolbar      = 'toolbar=no'      ;
	var location     = 'location=no'     ;
	var menubar      = 'menubar=no'      ;
	var scrollbars   = 'scrollbars=auto' ;
	var resizable    = 'resizable=no'    ;
	var height       = 'height=500'      ;
	var width        = 'width=550'       ;
	
	//Create a new blank browser window
	var emailWindow = window.open('', 'myEmailWin', toolbar + ',' + location + ',' + menubar + ',' +  scrollbars + ',' + resizable + ',' + height + ',' + width , true);
	
	// There have been werrors when trying to re-open the link if the window is already opened.
	// Trap and ignore any errors.
	try
	{
		// Reposition window to the upper left of screen.
		emailWindow.moveTo(0,0);
	} 
	catch (e){}
	
	//Navigate to the emailer application link
	emailWindow.location.replace(navigateTo);
	
	//Bubble window to top.
	emailWindow.focus();
}

/***************************************************
	Function:		checkEmail
	Date:			June 2st, 2005
	Parameters:		string (represents email address)
	Description:	verifies validity of email address (but not if it is actually real)
****************************************************/
function checkEmail(str)  
{
	// set RegEx string
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	// test address against the RegEx
	if (filter.test(str))
	{
		testresults=true;
	}
	else
	{
		testresults=false;
	}
	
	// return test result to the calling entity
	return (testresults)
}

/***************************************************
	Function:		isCheckboxSelected
	Date:			June 14th, 2005
	Parameters:		string (document.[form name].[collection name])

	Description:	Verifies whether or not a checkbox (or collection) has a 'checked' value.
					a collection is defined as a group of like Javascript elements (such as checkboxes)
					that have a common name/id.
  ****************************************************/
function isCheckboxSelected(checkboxCollection)
{

	//Retreive the number of checkboxes in the collection
	var listCount = checkboxCollection.length;

	//set a test variable, then initialise as false.
	var itemSelected = false;
	
	// Iterate through the checkbox collection and look for checked boxes.
	// if one is found, set the test variable to true.
	for (var i=0; i<listCount; i++)
	{
		if (checkboxCollection[i].checked==true)
		{
			itemSelected=true;
		}
	}
	
	//Return the test result
	return itemSelected;
}

/***************************************************
	Function:		processForm
	Date:			June 14th, 2005
	Parameters:		none

	Description:	Picks up the main search field and submits it to the Google search engine
	
  ****************************************************/
/***************************************************
    Function:        processForm
    Date:            June 14th, 2005
    Parameters:        none

    Description:    Picks up the main search field and submits it to the 
Google search engine
   
  ****************************************************/
/***************************************************
    Function:        processForm
    Date:            June 14th, 2005
    Parameters:        none

    Description:    Picks up the main search field and submits it to the 
Google search engine
   
  ****************************************************/
function processForm() {
   
    // set the relevent document form
    var myForm = document.searchBar;
   
    // Grab the textbox value
    var myText = myForm.searchText.value;
   
    // Implement that value into the search/url string   
    var myUrl = "http://search.ohio.gov/search?q=" + myText + 
"&site=TAX&btnG=Search&entqr=0&ud=1&sort=date%3AD%3AL%3Ad1&output=xml_no_dtd&oe=UTF-8&ie=UTF-8&client=ohio_gov&proxystylesheet=ohio_gov"

    // Redirect browser to search/url string
    location.href = myUrl;
}



/***************************************************
	Function:		getCurrentTab
	Date:			June 14th, 2005
	Parameters:		none

	Description:	Get the current Tab value
  ****************************************************/
function getCurrentTab()
	{
		return document.currentTab.currentTabItem.value;
	}
	

/***************************************************
	Function:		hardLeftMouseOver()
	Date:			June 14th, 2005
	Parameters:		none

	Description:	Tab rollover functionality for the leftmost tab object
  ****************************************************/	
	function hardLeftMouseOver()
	{
		// swap out images for left and right sides
		document.getElementById("imgHardLeft_Home").src = Mouseover_hardLeft.src; 
		document.getElementById("imgRight_Home").src = mouseOver_tabRight.src;
		
		//change style behavior
		document.getElementById("Home").style.background = "url(/images/web_graphics/Tabs/tab_over_mid.gif)";
		return true;
	}
	

/***************************************************
	Function:		commonMouseOver(tabItem)
	Date:			June 14th, 2005
	Parameters:		tabItem as string

	Description:	Tab rollover functionality for the common tab object
  ****************************************************/	
	function commonMouseOver(tabItem)
	{
		// set variable names for uniformity
		var leftImage = "imgLeft_" + tabItem;
		var RightImage = "imgRight_" + tabItem;
		
		// swap out images for left and right sides
		document.getElementById(leftImage).src = mouseOver_tabLeft.src; 
		document.getElementById(RightImage).src = mouseOver_tabRight.src;
		
		//change style behavior
		document.getElementById(tabItem).style.background = "url(/images/web_graphics/Tabs/tab_over_mid.gif)";
		return true;
	}
	

/***************************************************
	Function:		hardLeftMouseOut()
	Date:			June 14th, 2005
	Parameters:		none

	Description:	Tab rollover functionality for the leftmost tab object
  ****************************************************/	
  
	function hardLeftMouseOut()
	{
		var currentTab = getCurrentTab();
		
		if (currentTab=="Home")
		{
			document.getElementById("imgHardLeft_Home").src = Active_hardLeft.src;
			document.getElementById("imgRight_Home").src = Active_tabRight.src;
			document.getElementById("Home").style.background = "url(/images/web_graphics/Tabs/tab_active_mid.gif)";	
		}
		else
		{
			document.getElementById("imgHardLeft_Home").src = tabHardLeft.src;
			document.getElementById("imgRight_Home").src = tabRight.src;
			document.getElementById("Home").style.background = "url(/images/web_graphics/Tabs/tab_inactive_mid.gif)";
		}
		return true;
	}
	


/***************************************************
	Function:		commonMouseOut(tab)
	Date:			June 14th, 2005
	Parameters:		tabItem as string

	Description:	Tab rollover functionality for the common tab object
 ****************************************************/	
	function commonMouseOut(tab)
	{	
		var tabItem = getCurrentTab();
	
		var leftImage = "imgLeft_" + tab;
		var RightImage = "imgRight_" + tab;
		
		if (tab==tabItem)
		{
			document.getElementById(leftImage).src = Active_tabLeft.src;
			document.getElementById(RightImage).src = Active_tabRight.src;
			document.getElementById(tab).style.background = "url(/images/web_graphics/Tabs/tab_active_mid.gif)";
		}
		else
		{
			document.getElementById(leftImage).src = tabLeft.src;
			document.getElementById(RightImage).src = tabRight.src;
			document.getElementById(tab).style.background = "url(/images/web_graphics/Tabs/tab_inactive_mid.gif)";
		}
		
		return true;
	}
	

/***************************************************
	Function:		setCurrentTabState()
	Date:			June 14th, 2005
	Parameters:		tabItem as string

	Description:	Tab rollover functionality for the common tab object
 ****************************************************/	
 
	function setCurrentTabState()
	{
		var tabItem = getCurrentTab();
		
		var leftImage = "imgLeft_" + tabItem;
		var rightImage = "imgRight_" + tabItem;
		var hardLeftImage = "imgHardLeft_" + tabItem;
		var hyperLink = tabItem + "_HL"
		
		if (tabItem=="Home")
		{
			document.getElementById(hardLeftImage).src = Active_hardLeft.src;
		}
		else
		{
			document.getElementById(leftImage).src = Active_tabLeft.src;
		}
	
		document.getElementById(rightImage).src = Active_tabRight.src;
		document.getElementById(tabItem).style.background = "url(/images/web_graphics/Tabs/tab_active_mid.gif)";
		document.getElementById(hyperLink).style.color = "white";
		
		return true;
	}

/***************************************************
	Function:		ContactUsImage(state)
	Date:			June 14th, 2005
	Parameters:		tabItem as string

	Description:	Mouse rollover functionality for the Contact Us image
 ****************************************************/	
function ContactUsImage(state)
{
	if (state=="lit")
	{
		document.getElementById("contactUsImg").src = mouseOver_ContactUs.src;	
	}
	else
	{
		document.getElementById("contactUsImg").src = mouseUp_ContactUs.src;
	}
		
}

