

function changeButton(a, b){ 
	if (document.getElementById(a).className=='button_link_'+b+'_over') {
		document.getElementById(a).className='button_link_'+b;
	} else {
		document.getElementById(a).className='button_link_'+b+'_over';
	}
}

function changeColor(a){
	b = document.getElementById(a.name).className
	c = b+'_focus'
	document.getElementById(a.name).className=c

}
function changeColorID(a){
	b = document.getElementById(a.id).className
	c = b+'_focus'
	document.getElementById(a.id).className=c
}
function changeBackID(a){
	b = document.getElementById(a.id).className
	c = b.substring(0, b.length-6)
	document.getElementById(a.id).className=c
}

function changeBack(a){
	b = document.getElementById(a.name).className
	c = b.substring(0, b.length-6)
	document.getElementById(a.name).className=c
}
function searchThis() {

	document.search_form.submit()
}
function BackToHome() {
	document.location = 'home_page.php'
}
/* REMOVES ALL CHARS THAT ARE NOT NUMBERS */
function onlyNum(whatField) {
	whatName = whatField.name
	a = eval('document.edit_form.'+whatName+'.value')
	holdString = ''
	for (i = 0; i < a.length; i++)  {
		thisChar = a.substring(i, i+1) 
		if ((thisChar != '0')  && (thisChar != '.')  && (thisChar != '1') && (thisChar != '2') && (thisChar != '3') && (thisChar != '4') && (thisChar != '5') && (thisChar != '6') && (thisChar != '7') && (thisChar != '8') && (thisChar != '9')) {
			eval('document.edit_form.'+whatName+'.value=\''+holdString+'\'')
		} else {
			holdString = holdString + thisChar
		}
	}
	eval('document.edit_form.'+whatName+'.value=\''+holdString+'\'')
}



function centerMe(boxWidth) {
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		thisWidth = document.body.scrollWidth
	} else {                                                
		thisWidth = window.innerWidth
		thisWidth = thisWidth-15
		thisWidth = document.body.scrollWidth
	}
	thisCenter = (thisWidth / 2) - (boxWidth / 2)
	document.getElementById('center_box').style.left=thisCenter+'px'
}

function reSizeHeader() {
firstSizeHeader() 
}
function firstSizeHeader() {

	reSizeHeaderLogin() 
	resizeFooterLogin() 
}
function reSizeHeader() {
	reSizeHeaderLogin() 
	resizeFooterLogin() 
}

function reSizeHeaderLogin() {


	thisWidth = document.body.scrollWidth
	thisHeight = document.body.scrollHeight
	thisScrollHeight = document.body.scrollHeight
	realHeight = thisHeight
	a = document.body.parentNode.scrollHeight 

	//alert('realHeight:'+realHeight+' a'+a+' thisHeight:'+thisHeight)

		document.getElementById('strech').width = thisWidth-770
	
	if (document.getElementById('search_area')) {
		document.getElementById('search_area').style.visibility = 'visible'
		document.getElementById('search_area').style.left = thisWidth-390+'px'
	}
	document.getElementById('logo_image').src = '/images/new_logo.jpg'
	document.getElementById('strech').src = '/images/strech.jpg'
	document.getElementById('city_1').src = '/images/city_scape1.jpg'
	document.getElementById('city_2').src = '/images/city_scape2.jpg'
}

function resizeFooterLogin() {



	clientHeight = document.documentElement.clientHeight
	scrollHeight = document.body.parentNode.scrollHeight
	if (scrollHeight > clientHeight) {
		realHeight = scrollHeight +30
	} else {

		realHeight = clientHeight -40
	}
	
	// measure this_body
	//alert('clientHeight:'+clientHeight+' scrollHeight'+scrollHeight+' realHeight:'+realHeight)
	newHeight = parseInt(realHeight)
	document.getElementById('footer').style.top = newHeight+'px'
	document.getElementById('footer').style.visibility = 'visible'

}

/* BLOG AND FRAME FUCNTIONS */
function reSizeHeaderLoginFromFrame() {
	thisWidth = parent.document.body.scrollWidth
	thisHeight = parent.document.body.scrollHeight
	thisScrollHeight = parent.document.body.scrollHeight
	//alert('realHeight:'+realHeight+' a'+a+' thisHeight:'+thisHeight)
	if (thisScrollHeight > thisHeight) {
		 parent.document.getElementById('strech').width = thisWidth-787
	} else {
		 parent.document.getElementById('strech').width = thisWidth-770
	}
	if ( parent.document.getElementById('search_area')) {
		 parent.document.getElementById('search_area').style.visibility = 'visible'
		 parent.document.getElementById('search_area').style.left = thisWidth-390+'px'
	}
	 parent.document.getElementById('logo_image').src = '/images/new_logo.jpg'
	 parent.document.getElementById('strech').src = '/images/strech.jpg'
	 parent.document.getElementById('city_1').src = '/images/city_scape1.jpg'
	 parent.document.getElementById('city_2').src = '/images/city_scape2.jpg'
}
function resizeFooterLoginFromFrame() {
	thisHeight = parent.document.documentElement.clientHeight
	thisScrollHeight = parent.document.body.parentNode.scrollHeight
	if (thisScrollHeight > thisHeight) {
		realHeight = thisScrollHeight + 35
	} else {
		realHeight = thisHeight
	}
	//alert('realHeight:'+realHeight+' thisHeight:'+thisHeight)
	newHeight = parseInt(realHeight)-43
	parent.document.getElementById('footer').style.top = newHeight+'px'
	parent.document.getElementById('footer').style.visibility = 'visible'

}
function firstSizeFrame() {
	reSizeHeaderLoginFromFrame() 
	resizeFooterLoginFromFrame() 
}
function reSizeBlogFrame() {
	thisHeight = document.body.scrollHeight
	parent.document.getElementById('BlogFrame').height = thisHeight  + 'px'	
	document.getElementById('blog_container').style.height = thisHeight  + 'px'	
}

function reSizeBlogFrameFromParent() {
	thisHeight = BlogFrame.document.body.scrollHeight
	document.getElementById('BlogFrame').height = thisHeight  + 'px'	
	BlogFrame.document.getElementById('blog_container').style.height = thisHeight  + 'px'	
	firstSizeFrame()
}
function reSizeAllBlogDetail() {
	if (FirstLoad == 1) {
		a = document.sub_form.post_BlogID.value
		document.location = 'blog_detail_page.php?BlogID='+a
	}
}
function reSizeAllBlog() {
	if (FirstLoad == 1) {
		a = document.sub_form.viewDate.value
		document.location = 'public_defender_blog.php?viewDate='+a
	}
}

function reSizeCommentFrame() {

	thisHeight = document.body.scrollHeight
	
	parent.document.getElementById('BlogCommentFrame').height = thisHeight  + 'px'	
	firstSizeFrame()
}

function show_comment(a) {
	document.getElementById('post_a_comment_'+a).style.display='inline'
	document.getElementById('email_comment_'+a).style.display='none'
	document.getElementById('email_done_'+a).style.display='none'
	document.getElementById('email_done_'+a).innerHTML = ''

	reSizeBlogFrame()
}
function email_this(a) {
// close_this(a)
//	document.getElementById('post_a_comment_'+a).style.display='none'
	document.getElementById('email_comment_'+a).style.display='inline'
	document.getElementById('email_done_'+a).style.display='inline'
	document.getElementById('email_done_'+a).innerHTML = ''
	reSizeBlogFrame()
}

function reSizeBlogCalendar() {
	thisHeight = document.documentElement.clientHeight
	thisScrollHeight = document.body.parentNode.scrollHeight
	if (thisScrollHeight >= thisHeight) {
		realHeight = thisScrollHeight
	} else {
		realHeight = thisHeight
	}
//	alert('realHeight:'+realHeight+' a'+a+' thisHeight:'+thisHeight)
	parent.document.getElementById('RightCalendar').height = realHeight  +250+ 'px'	

	firstSizeFrame()
}
function reSizeFAQFrame() {
	
	thisHeight = document.documentElement.clientHeight
	thisScrollHeight = document.body.scrollHeight
	if (thisScrollHeight >= thisHeight) {
		realHeight = thisScrollHeight
	} else {
		realHeight = thisHeight
	}
	leftNavHeight = parent.document.getElementById('menu_container').scrollHeight 
	if (leftNavHeight > realHeight) {
		realHeight = leftNavHeight
	} 

	parent.document.getElementById('DocumentFrame').height = realHeight  + 'px'	
	parent.document.getElementById('content_box').style.height =   realHeight  + 'px'	

	// FIND OUT WHICH IS TALLER
	// THE NAV OR THE CONTENT

	

	if (thisScrollHeight > leftNavHeight) {
		newHeight = thisScrollHeight 
	} else {
		newHeight = leftNavHeight
	}
	// if both shorter that window - float bottom
	thisHeight = parent.document.documentElement.clientHeight
	if (newHeight < thisHeight) {
		newHeight = thisHeight -43
	}  else {
		newHeight = parseInt(newHeight)+280
	}
	//	alert('realHeight:'+realHeight+' leftNavHeight'+leftNavHeight+' thisScrollHeight:'+thisScrollHeight+' newHeight:'+newHeight)

	parent.document.getElementById('footer').style.top = newHeight+'px'
	parent.document.getElementById('footer').style.visibility = 'visible'	
//resizeFooterLoginFromFrame()
	/*
	thisHeight = parent.document.documentElement.clientHeight
	thisScrollHeight = parent.document.body.scrollHeight
alert('realHeight:'+realHeight+' thisHeight'+thisHeight+' thisHeight:'+thisHeight)
	parent.document.getElementById('footer').style.top = realHeight+280+'px'
	*/
}
function gotoDoc(whereto, docid, LinkTypeID) {

	if (LinkTypeID == 1) {
		whereto = '/Documents/'+whereto
	} else {
		//whereto = '<?echo $File_Dir?>/Documents/'+whereto
	}
	whereto = "../includes/"+whereto
	window.open(whereto,'DocumentName','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=600')
//	hiddenFrame.document.location = '../includes/document_select.php?FromPage=Documents&DocumentID='+docid
}