<!--
function doNothing(){}

function doSiteSearch()
{	    
	var searchVal = document.getElementById("SiteSearch").value;
	location.href = '/ostomy/search/default.aspx?Search=' + searchVal;
	return false;
}

function switchImages( name1, source1 ){
		if ( document.images ){
			document[name1].src=source1;

        }
}

function blogFormHandler()
{ 
	var blogList = document.getElementById("BlogList");	
	var url = blogList.options[blogList.selectedIndex].value;
	
	window.location.href = url;
	return false;
} 


// Function to trap enter key clicks.
function fnTrapKD(btn, event){
    
	if (document.all){		
		if (event.keyCode == 13){ 		    
			event.returnValue=false; 
			event.cancel = true; 			
			doSiteSearch();
		}
	}
	
	else if(document.layers){		
		if(event.which == 13){		  
			event.returnValue=false;
			event.cancel = true;
			doSiteSearch();
		}
	}
		
	else if (document.getElementById){		
		if (event.which == 13){		    
			event.returnValue=false;
			event.cancel = true;
			doSiteSearch();
		}
	}
}

function openPopCenter(url,height,width,features){

	// Get left and top coordinates so window can be opened centered on the screen
	var screenx = ((screen.availWidth / 2) - (width / 2))
	var screeny = ((screen.availHeight / 2) - (height / 2))

	var featureList = 'height=' + height + ',width=' + width + ',left=' + screenx + ',top=' + screeny;
	if (features != '')
		featureList += ',' + features
		
	var newWin = window.open(url,"window",featureList);
}

function openEmailWindow(url,height,width,features){

	// Get left and top coordinates so window can be opened centered on the screen
	var screenx = ((screen.availWidth / 2) - (width / 2))
	var screeny = ((screen.availHeight / 2) - (height / 2))

	var featureList = 'height=' + height + ',width=' + width + ',left=' + screenx + ',top=' + screeny;
	if (features != '')
		featureList += ',' + features

	url = url + "?CallingPage=" + window.location

	var newWin = window.open(url,"window",featureList);
}


function showHide(sTblId)
{

	var tblId
	var moveTable

	tblId = document.getElementById(sTblId)

	if(tblId.style.display=="none")
	{
		tblId.style.display = "block"
		tblId.style.position = "relative"        
        
		if(isNaN(parseInt(tblId.style.left)))
			tblId.oldLeft = 0
		else
			tblId.oldLeft = parseInt(tblId.style.left)

		moveTable = tblId.oldLeft + 20;		
		tblId.style.left = eval(String.fromCharCode(34) + moveTable + "px" + String.fromCharCode(34))
	}
	else
	{
		tblId.style.display = "none"
		tblId.style.position = "relative"
		tblId.style.left = tblId.oldLeft
	}
}

function showHideIcon(sTblId, ico)
{

	var icoObj
	var tblId
	var moveTable

	tblId = document.getElementById(sTblId)
	

	if(tblId.style.display=="none")
	{
		tblId.style.display = "block"
		tblId.style.position = "relative"

		if(isNaN(parseInt(tblId.style.left)))
			tblId.oldLeft = 0
		else
			tblId.oldLeft = parseInt(tblId.style.left)

		moveTable = tblId.oldLeft + 20
		tblId.style.left = eval(String.fromCharCode(34) + moveTable + "px" + String.fromCharCode(34))

		icoObj = document.getElementById(ico)
		icoObj.src = "/ostomy/images/minus_icon.gif"
	}
	else
	{
		tblId.style.display = "none"
		tblId.style.position = "relative"

		if(!isNaN(tblId.oldLeft))
			tblId.style.left = tblId.oldLeft

		icoObj = document.getElementById(ico)
		icoObj.src = "/ostomy/images/plus_icon.gif"
	}
}

/*
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie, or null if cookie does not exist.
 *
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/*
* Allows you to have a text box on a form that displays the number of characters entered in another text box.
* Will display a message if the number of characters entred exceeds a certain amount.
*   frm - the name of the form where the controls appear
*   limit - the max number of characters that is allowed
*   fldToCount - the name of the field that should be counted
*   fldToUpdate - the name of the field that should be updated with the number of characters entered.
*/
function updateCounter(frm,limit,fldToCount,fldToUpdate) {

   var fieldToUpdate = document[frm].elements[fldToUpdate];
   var fieldToCount = document[frm].elements[fldToCount];
   var old = fieldToUpdate.value;
   
   fieldToUpdate.value = fieldToCount.value.length;

   //if(fieldToUpdate.value > limit && old <= limit) 
   if(fieldToUpdate.value > limit) 
   {
     alert('Please limit your entry to ' + limit + ' characters.');
     if(document.styleSheets)
     {
       fieldToUpdate.style.fontWeight = 'bold';
       fieldToUpdate.style.color = '#ff0000';
     } 
   }

   else if(fieldToUpdate.value <= limit && old > limit && document.styleSheets )
   {
       fieldToUpdate.style.fontWeight = 'normal';
       fieldToUpdate.style.color = '#000000';
   } 
}

// End --> 

