function fixBottomNavHeight()
{
	divs = document.getElementsByTagName('div');
	maxHeight = 0;
	for(i=0; i<divs.length; i++)
	{
		thisNode = divs[i];
		if(thisNode.id=="bottom_nav_box")
		{
			if(thisNode.offsetHeight>maxHeight)
			{
				maxHeight = thisNode.offsetHeight;
			}
		}
	}

	maxHeight -= 10;
	for(i=0; i<divs.length; i++)
	{
		thisNode = divs[i];
		if(thisNode.id=="bottom_nav_box")
		{
			lasti = i
			thisNode.style.height = maxHeight+"px";
		}
	}
	divs[lasti].style.borderRight = "0px";
}

function checkContentColumns()
{
	contentDiv = document.getElementById('main_content');
	rightContentDiv = document.getElementById('right_content');
	
	if(rightContentDiv.offsetHeight>contentDiv.offsetHeight)
	{
		contentDiv.style.height = rightContentDiv.offsetHeight+"px";
	}
}

function createAJAX()
{
	var ajaxStarter;
	try
	{
		// Firefox, Opera 8.0+, Safari
		ajaxStarter=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			ajaxStarter=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				ajaxStarter=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				return false;
			}
		}
	}
	
	return ajaxStarter;
}

function checkEmail()
{
	if(document.getElementById('unreg-email').value!="")
	{
		//Call the AJAX scripts to process the email
		emailAjax = createAJAX();
		if(emailAjax!=false)
		{
			
		}
	}
	
	return true;
}

function signInTog()
{
	if(document.getElementById('top_sign_in_div').style.display=="block")
	{
		grayOut(false);
		document.getElementById('top_sign_in_div').style.display = "none";
	}
	else
	{
		grayOut(true);
		document.getElementById('top_sign_in_div').style.display = "block";
		document.getElementById('signin-email-top').focus();
		document.getElementById('top_sign_in_div').style.zIndex = "50";
	}
}

function togNewToMove()
{
	if(document.getElementById('new_to_movesavers').style.display=="block")
	{
		grayOut(false);
		document.getElementById('new_to_movesavers').style.display = "none";
	}
	else
	{
		grayOut(true);
		document.getElementById('new_to_movesavers').style.display = "block";
		document.getElementById('new_to_movesavers').style.zIndex = "50";
	}
}

function toggelDetails(id1, id2)
{
	if(document.getElementById('offer_'+id1+'_'+id2).style.display=="block")
	{
		document.getElementById('offer_'+id1+'_'+id2).style.display = "none";
		document.getElementById('sod_'+id1+'_'+id2).style.display = "block";
		document.getElementById('hod_'+id1+'_'+id2).style.display = "none";
	}
	else
	{
		document.getElementById('offer_'+id1+'_'+id2).style.display = "block";
		document.getElementById('sod_'+id1+'_'+id2).style.display = "none";
		document.getElementById('hod_'+id1+'_'+id2).style.display = "block";
	}
}

function offConcTog(interestGroup, overRide)
{
	if(document.getElementById('ocOverlay').search_zip_code.value!="" && overRide=="")
	{
		document.getElementById('ocOverlay').submit();
	}
	else
	{
		interestArray = new Array();
		
		phaseArray = new Array();
		phaseArray[0] = "Pre-Move Offers";
		phaseArray[1] = "Post-Move Offers";
		
		productArray = new Array();
		productArray[0] = "Cable Products & Services";
		productArray[1] = "Moving Products & Services";
		productArray[2] = "Home Products & Services";
		productArray[3] = "Financial Products & Services";
		
		interestArray['phases'] = phaseArray;
		interestArray['products'] = productArray;
		interestArray['all'] = productArray.concat(phaseArray);
		
		if(document.getElementById('off_conc_overlay').style.display=="block")
		{
			grayOut(false);
			document.getElementById('off_conc_overlay').style.display = "none";
		}
		else
		{
			if(interestGroup!="")
			{
				selectBox = document.getElementById('search_interest_ovlay');
				selectBox.options.length = 1;
				selectBox.selectedIndex = 0;
				
				for(i=0; i<interestArray[interestGroup].length; i++)
				{
					newI = i+1;
					selectBox.options[newI] = new Option(interestArray[interestGroup][i],interestArray[interestGroup][i]);
				}
			}
			grayOut(true);
			document.getElementById('off_conc_overlay').style.display = "block";
			document.getElementById('off_conc_overlay').style.zIndex = "50";
		}
	}
}

function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 2;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        if(document.body.scrollHeight>document.getElementById('layout_holder').offsetHeight)
        {
        	var pageHeight = document.body.scrollHeight+'px';
        }
        else
        {
      		var pageHeight = document.getElementById('layout_holder').offsetHeight+'px';
      	}
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
        if(document.body.offsetHeight>document.getElementById('layout_holder').offsetHeight)
        {
        	var pageHeight = document.body.offsetHeight+'px';
        }
        else
        {
      		var pageHeight = document.getElementById('layout_holder').offsetHeight+'px';
      	}
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }
    
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';                          
  } else {
     dark.style.display='none';
  }
}

function shipAddrVis(theKey)
{
	if(theKey=="0")
	{
		document.getElementById('dif_addr_holder').style.display = "none";
	}
	else
	{
		document.getElementById('dif_addr_holder').style.display = "block";
	}
}

function checkRegForm(theForm)
{
	alertText = "";
	
	if(theForm.reg_email.value=="")
	{
		alertText += "- Email Address is required\n";
	}
	else if(theForm.reg_email.value.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)
	{
		alertText += "- Email Address must be a valid format\n";
	}
	
	if(theForm.reg_password.value=="")
	{
		alertText += "- Password is required\n";
	}
	else if(theForm.reg_password.length<6)
	{
		alertText += "- Passwords must be at least 6 characters long\n";
	}
	else if(theForm.reg_password_confirm.value=="")
	{
		alertText += "- Please confirm your password\n";
	}
	else if(theForm.reg_password.value!=theForm.reg_password_confirm.value)
	{
		alertText += "- Your passwords do not match\n";
	}
	
	if(alertText!="")
	{
		alert("Please fix the following errors and try again:\n\n"+alertText);
		return false;
	}
	else
	{
		return true;
	}
}

function verifyUpdate(theForm)
{
	alertText = "";
	
	if(theForm.upd_email.value!=theForm.old_email.value)
	{
		if(theForm.upd_email.value=="")
		{
			alertText += "- Email Address is required\n";
		}
		else if(theForm.upd_email.value.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)
		{
			alertText += "- Email Address must be a valid format\n";
		}
	}
	
	if(theForm.upd_password.value!="")
	{
		if(theForm.upd_password.length<6)
		{
			alertText += "- Passwords must be at least 6 characters long\n";
		}
		else if(theForm.upd_password_confirm.value=="")
		{
			alertText += "- Please confirm your password\n";
		}
		else if(theForm.upd_password.value!=theForm.upd_password_confirm.value)
		{
			alertText += "- Your passwords do not match\n";
		}
		else if(theForm.upd_old_password.value=="")
		{
			alertText += "- You must enter your old password\n";
		}
	}

	if(alertText!="")
	{
		alert("Please fix the following errors and try again:\n\n"+alertText);
		return false;
	}
	else
	{
		return true;
	}	
}

function myAccountTog(starterBit)
{
	if(document.getElementById(starterBit+'_form').style.display=="block")
	{
		document.getElementById(starterBit+'_form').style.display = "none";
		document.getElementById(starterBit+'_static').style.display = "block";
	}
	else
	{
		document.getElementById(starterBit+'_static').style.display = "none";
		document.getElementById(starterBit+'_form').style.display = "block";
	}
}

function exactDateTog(boxValue,dateBox)
{
	if(boxValue=="On an exact date...")
	{
		document.getElementById('exact_date_box').style.display = "block";
	}
	else
	{
		document.getElementById('exact_date_box').style.display = "none";
		document.getElementById(dateBox).value = "";
	}
}

function togLGS(cMethod)
{
	lgsBox = document.getElementById('lgsWindow');
	
	if(cMethod=="hide")
	{
		lgsBox.style.display = "none";
	}
	else if(cMethod=="show")
	{
		lgsBox.style.display = "block";
	}
}

function checkConcForm(theForm)
{
	alertText = "";
/*
	if(theForm.search_moving_when.value=="")
	{
		alertText += "- Select when you are moving\n";
	}
	else if(theForm.search_moving_when.value=="On an exact date..." && theForm.search_exact_date.value=="")
	{
		alertText += "- Enter the exact date on which you will move\n";
	}

	if(theForm.search_interstate && theForm.search_interstate.value=="")
	{
		alertText += "- Indicate if you are moving to a new state\n";
	}

*/	
	if(theForm.search_zip_code.value=="")
	{
		alertText += "- Enter the zip code to which you are moving\n";
	}
	else if(theForm.search_zip_code.value.match(/[^0-9]/)!=null)
	{
		alertText += "- The zip code can only contain numbers\n";
	}
	else if(theForm.search_zip_code.value.length!=5)
	{
		alertText += "- The Zip Code must be 5 numbers long\n";
	}
	
	if(alertText!="")
	{
		alert("Please fix these errors and try again:\n\n"+alertText);
		return false;
	}
	else
	{
		return true;
	}
}

function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\\\/g,'\\');
str=str.replace(/\\0/g,'\0');
return str;
}

function addToCart(itemID, itemName, extraBits, rewardInfo, sessionID)
{
	//Add the item to the cart
	addNewAjax = createAJAX();
	
	addNewAjax.onreadystatechange=function()
	{
		if(addNewAjax.readyState==4)
		{
			if(addNewAjax.responseText!="BAD")
			{
				//Hide the item in the display
				document.getElementById('item_div_'+itemID).style.display = "none";
				document.getElementById('no-items-text').style.display = "none";
				document.getElementById('order_now').style.display = "block";
				
				//Adding the item to the shopping cart
				holderDiv = document.getElementById('cartItems');
				newDiv = document.createElement('div');
				newDiv.setAttribute('id','cart_item_'+addNewAjax.responseText);
				newDiv.setAttribute('class','shopping_cart_item');
				newDiv.setAttribute('className','shopping_cart_item');
				
				closeImage = document.createElement('img');
				closeImage.setAttribute('src','/templates/ms_standard/images/small-x.gif');
				closeImage.setAttribute('class','shop_cart_remove');
				closeImage.setAttribute('className','shop_cart_remove');
				closeImage.setAttribute('ciid',addNewAjax.responseText);
				closeImage.onclick = function() { UnTip(); removeFromCart(this.getAttribute("ciid"), document.getElementById('hidden_session').value); }
				closeImage.onmouseover = function() { Tip('Click here to remove this offer<br />from your list of selected offers.', BALLOON, true, ABOVE, true, OFFSETX, -17, PADDING, 8); }
				closeImage.onmouseout = function() { UnTip(); }
				newDiv.appendChild(closeImage);				

				
				prodNames = itemName.split("::");
				prodExtras = extraBits.split("::");
				for(i=0; i<prodNames.length; i++)
				{
					prodName = document.createElement('div');
					prodName.setAttribute('class','shop_cart_prod_name');
					prodName.setAttribute('className','shop_cart_prod_name');
					prodNameText = document.createTextNode(stripslashes(prodNames[i]));
					prodName.appendChild(prodNameText);

					prodDesc = document.createElement('div');
					prodDesc.setAttribute('class','shop_cart_prod_desc');
					prodDesc.setAttribute('className','shop_cart_prod_desc');
					prodDescText = document.createTextNode(stripslashes(prodExtras[i]));
					prodDesc.appendChild(prodDescText);

					newDiv.appendChild(prodName);
					newDiv.appendChild(prodDesc);
				}
				
				holderDiv.appendChild(newDiv);
				//Add the reward bit if it is present
				if(rewardInfo!="")
				{
					document.getElementById('no-reward-text').style.display = "none";
					holderDiv = document.getElementById('cartRewards');
					newDiv = document.createElement('div');
					newDiv.setAttribute('id','cart_rwd_'+addNewAjax.responseText);
					newDiv.setAttribute('class','shopping_cart_reward');
					newDiv.setAttribute('className','shopping_cart_reward');
					
					rwdName = document.createElement('div');
					rwdName.setAttribute('class','shop_cart_rwd_name');
					rwdName.setAttribute('className','shop_cart_rwd_name');
					rwdNameText = document.createTextNode(stripslashes(rewardInfo));
					rwdName.appendChild(rwdNameText);	
					
					newDiv.appendChild(rwdName);
					holderDiv.appendChild(newDiv);					
				}
				
				checkOfferDisplay();
				
				//Show an overlay box for a few seconds
				overlayDiv = document.createElement('div');
				overlayDiv.setAttribute('class','overlay_boxes');
				overlayDiv.setAttribute('className','overlay_boxes');
				overlayDiv.setAttribute('id','add_to_cart_div_'+itemID);
				overlayDiv.style.display = "block";
				
				headerText = document.createElement('p');
				theText = document.createTextNode('Selected offers have been added to your selected list of offers.');
				headerText.appendChild(theText);
				
				headerText.appendChild(document.createElement('br'));
				theText = document.createTextNode('View your selected offers on the top right side of the page.');
				headerText.appendChild(theText);
				
				overlayDiv.appendChild(headerText);

				//grayOut(true);
				document.body.appendChild(overlayDiv);
				setTimeout("document.body.removeChild(document.getElementById('add_to_cart_div_"+itemID+"'))",2000);
				//setTimeout("grayOut(false)",2000);
			}
			else
			{
				//An error occured
				alert("ERROR");
			}
		}
	}
	addNewAjax.open("GET","/ajax_parser.php?action=addtocart&sessionid="+sessionID+"&itemName="+encodeURI(itemName)+"&itemID="+encodeURI(itemID)+"&extrainfo="+encodeURI(extraBits)+"&rewardinfo="+encodeURI(rewardInfo),true);
	addNewAjax.send(null);	
}

function removeFromCart(cartItemID, sessionID)
{
	//Add the item to the cart
	removeFromAjax = createAJAX();
	
	removeFromAjax.onreadystatechange=function()
	{
		if(removeFromAjax.readyState==4)
		{
			if(removeFromAjax.responseText!="BAD")
			{
			
				//Remove the item from the cart area
				holderDiv = document.getElementById('cartItems');
				childDiv = document.getElementById('cart_item_'+cartItemID);
				holderDiv.removeChild(childDiv);
				
				rholderDiv = document.getElementById('cartRewards');
				//Remove any reward bits present
				if(document.getElementById('cart_rwd_'+cartItemID))
				{
					childDiv = document.getElementById('cart_rwd_'+cartItemID);
					rholderDiv.removeChild(childDiv);
				}
				
				//If the item is still present on the page, make it visible
				if(document.getElementById('item_div_'+removeFromAjax.responseText))
				{
					document.getElementById('item_div_'+removeFromAjax.responseText).style.display = "block";
				}
				
				//Check to see if there is anything left in the cart/rewards divs
				//If there is only 1 thing, make it visible
				showNOI = 0;
				for(i=0; i<holderDiv.childNodes.length; i++)
				{
					if(holderDiv.childNodes[i].id!="no-items-text" && holderDiv.childNodes[i].tagName=="DIV")
					{
						showNOI = 1;
					}
				}
				if(showNOI==0)
				{
					document.getElementById('no-items-text').style.display = "block";
					document.getElementById('order_now').style.display = "none";
				}
				
				showNOR = 0;
				for(i=0; i<rholderDiv.childNodes.length; i++)
				{
					if(rholderDiv.childNodes[i].id!="no-reward-text" && rholderDiv.childNodes[i].tagName=="DIV")
					{
						showNOR = 1;
					}
				}
				if(showNOR==0)
				{
					document.getElementById('no-reward-text').style.display = "block";
				}
				checkOfferDisplay();
			}
			else
			{
				//An error occured
				alert("ERROR");
			}
		}
	}
	removeFromAjax.open("GET","/ajax_parser.php?action=removefromcart&sessionid="+sessionID+"&cartitem="+cartItemID,true);
	removeFromAjax.send(null);	
}

function checkOfferDisplay()
{
	holderDiv = document.getElementById('offer_holder');
	showNOO = 0;
	for(i=0; i<holderDiv.childNodes.length; i++)
	{
		if(holderDiv.childNodes[i].id!="no-offer-text" && holderDiv.childNodes[i].id!="ignore_this" && holderDiv.childNodes[i].id!="" && holderDiv.childNodes[i].tagName=="DIV" && holderDiv.childNodes[i].style && (holderDiv.childNodes[i].style.display=="" || holderDiv.childNodes[i].style.display=="block"))
		{
			extraBit = "";
			if(showNOO!=0)
			{
				extraBit += " offer_top_border";
			}
			if(holderDiv.childNodes[i].getAttribute('rewards')=="true")
			{
				extraBit += " oph_min_height";
			}
			if(holderDiv.childNodes[i].className.match("normal_hidden")=="normal_hidden")
			{
				extraBit += " normal_hidden";
			}
			else
			{
				showNOO = 1;
			}
			
			holderDiv.childNodes[i].setAttribute('class', 'offer_holder'+extraBit);
			holderDiv.childNodes[i].setAttribute('className', 'offer_holder'+extraBit);
			

		}
	}
	if(showNOO==0)
	{
		document.getElementById('no-offer-text').style.display = "block";
	}
	else
	{
		document.getElementById('no-offer-text').style.display = "none";
	}
}

function chkpassReset(theForm)
{
	if(theForm.fpw_email.value=="")
	{
		alert("Please enter an email address.");
		return false;
	}
	else if(theForm.fpw_email.value!="" && theForm.fpw_email.value.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)
	{
		alert("The email you entered is not a valid format.");
		return false;
	}
	else
	{
		return true;
	}
}


function checkHolderSubmit(theForm)
{
	alertText = "";
	
	if(theForm.address_1.value=="")
	{
		alertText += "- Address is required\n";
	}
	if(theForm.zip_code.value=="")
	{
		alertText += "- Zip Code is required\n";
	}
	if(theForm.move_date.value=="")
	{
		alertText += "- Move Date is required\n";
	}
	if(theForm.reg_email.value=="")
	{
		alertText += "- Email Address is required\n";
	}
	else if(theForm.reg_email.value.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)
	{
		alertText += "- Email Address must be a valid format\n";
	}	
	if(document.getElementById('new_account').style.display=="block")
	{
		if(theForm.reg_password.value=="")
		{
			alertText += "- Password is required\n";
		}
		else if(theForm.reg_password.length<6)
		{
			alertText += "- Passwords must be at least 6 characters long\n";
		}
		else if(theForm.reg_password_confirm.value=="")
		{
			alertText += "- Please confirm your password\n";
		}
		else if(theForm.reg_password.value!=theForm.reg_password_confirm.value)
		{
			alertText += "- Your passwords do not match\n";
		}
	}
	else if(document.getElementById('old_account').style.display=="block")
	{
		if(theForm.signin_password.value=="")
		{
			alertText += "- We already have your email in the\nsystem. Please scroll down to the\nbottom of this form and enter your\nexisting Account Password\n";
		}
	}
	
	if(alertText!="")
	{
		alert("Please fix the following errors and try again:\n\n"+alertText);
		return false;
	}
	else
	{
		return true;
	}
}

function checkEmailFormat(theEmail)
{
	if(theEmail.value.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)==null)
	{
		alert("The email entered is not a valid format.");
		return false;
	}
	else
	{
		return true;
	}
}

function checkAjaxEmail(theEmail)
{
	checkAE = createAJAX();
	
	checkAE.onreadystatechange=function()
	{
		if(checkAE.readyState==4)
		{
			if(checkAE.responseText=="login")
			{
				document.getElementById('new_account').style.display = "none";
				document.getElementById('old_account').style.display = "block";
			}
			else if(checkAE.responseText=="new")
			{
				document.getElementById('new_account').style.display = "block";
				document.getElementById('old_account').style.display = "none";
			}
			else
			{
				document.getElementById('new_account').style.display = "none";
				document.getElementById('old_account').style.display = "none";
			}
		}
	}
	checkAE.open("GET","/ajax_parser.php?action=checkEmail&email="+theEmail,true);
	checkAE.send(null);
}

function ctoTrigger()
{
	sessionID = document.getElementById('hidden_session').value;
	
	ctoEvent = createAJAX();
	ctoEvent.open("GET","/ajax_parser.php?action=ctoClick&sessionid="+sessionID,true);
	ctoEvent.send(null);		
	
	
}

function rotateDivs(theDirection)
{
	imageArray = document.getElementById('theseImages').value.split(",");
	
	maxVal = imageArray.length - 1;

	currentVal = parseInt(document.getElementById('currentPos').value);
	if(theDirection=="l")
	{
		currentVal--;
	}
	else
	{
		currentVal++;
	}
	
	if(currentVal<0)
	{
		currentVal = maxVal;
	}
	else if(currentVal>maxVal)
	{
		currentVal = 0;
	}

	//Load up the new Image
	newImage = document.createElement('img');
	newImage.src = "/images/regslides/"+imageArray[currentVal];
	newImage.onload = function() { changeImage(this); }
	document.getElementById('currentPos').value = currentVal;
}

function changeImage(theImage)
{
	holderDiv = document.getElementById('reg_img_holder');
	holderDiv.removeChild(document.getElementById('oldImage'));
	theImage.id = "oldImage";
	holderDiv.appendChild(theImage);
}	