// JavaScript Document
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }

	function switchPreviewImage(imageControl, imageNameAndPath, forcecache, hiddenInputField)
	{
		img = document.getElementById(imageControl)
		if(img != null)
		{
			hiddenInputField.value = imageNameAndPath;
			img.src = imageNameAndPath + '?' + forcecache;
		}
	}

	function switchPreviewImage2(imageDivToShow, imageDivToHide, toShowHiddenInputField, toHideHiddenInputField)
	{
		divToShow = document.getElementById(imageDivToShow);
		divToHide = document.getElementById(imageDivToHide);
		if(divToShow != null && divToHide != null)
		{
			toShowHiddenInputField.value = imageDivToShow;
			toHideHiddenInputField.value = imageDivToHide;
			divToShow.style.display = 'block';
			divToHide.style.display = 'none';
		}
	}

	function validate_form(theForm, pageToGoto, pageBeingProcessed, skipValidate)
	{

		if(pageBeingProcessed == 1)
		{
			if(pageToGoto == 1)
			{
				showPvloading_img()
			}
			if(skipValidate == true || theForm.business_name.value.length > 0 )
			{
				theForm.page.value = pageToGoto;
				theForm.submit();
			}
			else
			{
				document.getElementById("bname_label").style.color = "#ff0000";
				alert("Please enter a business name");
			}

		}
		else if(pageBeingProcessed == 2)
		{
			theForm.page.value = pageToGoto;
			theForm.PostBack.value = pageToGoto;
			theForm.submit();
		}
	}


	function hideMergeSingleTimesDiv()
	{
		document.getElementById("mergeSingleTimesDiv").style.display = "none";
	}


	function showMergeSingleTimesDiv()
	{
		document.getElementById("mergeSingleTimesDiv").style.display = "block";
	}
	function showPvloading_img()
	{
		document.getElementById("pvloading_img").style.display = "block";
	}


//here you place the ids of every element you want.
//var ids=new Array('day1_row1','day1_row2','day2_row1','day2_row2','day3_row1','day3_row2','day4_row1','day4_row2','day5_row1','day5_row2','day6_row1','day6_row2','day7_row1','day7_row2');
var ids=new Array('day1_row2','day2_row2','day3_row2','day4_row2','day5_row2','day6_row2','day7_row2');

function switchid(id){
	hideallids();
	showdiv(id);
}

function hideallids()
{
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}
}




function showallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		showdiv(ids[i]);
	}
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}



}

function copyDown()
{
	for(dayCounter = 2; dayCounter <= 7; dayCounter++)
	{
		for(hourMinCounter = 1; hourMinCounter <= 4; hourMinCounter++)
		{
			var sourceHour1 = document.getElementById("Day1Hour" + hourMinCounter);
			var sourceMin1 = document.getElementById("Day1Min" + hourMinCounter);

			var targetHour1 = document.getElementById("Day" + dayCounter + "Hour" + hourMinCounter);
			var targetMin1 = document.getElementById("Day" + dayCounter + "Min" + hourMinCounter);

			targetHour1.selectedIndex = sourceHour1.selectedIndex;
			targetMin1.selectedIndex = sourceMin1.selectedIndex;
		}
	}
}

function styleChange(theForm)
{
	validate_form(theForm, 1, 1, true);
}
//-->
