/*------------------------------------------------------------
	Frame Sizer and Text Sizer- 
	script language="JavaScript" type="text/javascript"
--------------------------------------------------------------*/
		
//Specify affected tags. Add or remove from list:
var tgs = new Array('table','td','p','div','ul','span'); 
var defaultFontSize = 14;

function showIFrameUrl(){
 var dtitle = window.frames["mainframe"].document.title;
alert("Frame URL: " + window.frames["mainframe"].location.href + "\nFrame Protocol: " + window.frames["mainframe"].location.protocol + "\n" + dtitle);	
}

/***********************************************
* Based on Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function bookmarkIFRAME(titlePart1){
 var url = null, dtitle = titlePart1, titlePart2 ="";
 url=window.frames["mainframe"].location.href;
 if(!url || window.frames["mainframe"].location.protocol != "http:"){alert("Frame URL Not found "); return;}
 	titlePart2 = window.frames["mainframe"].document.title;
 	if(titlePart2) dtitle = dtitle + " " + titlePart2;
 
	if (window.sidebar) // firefox
		window.sidebar.addPanel(dtitle, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',dtitle);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
	window.external.AddFavorite(url, dtitle);
}

function changeFrameFont( Framename, trgt,inc ) {
	if (!document.getElementById(Framename)) return
	var cEl = null,i,j,cTags, p, fsize = 0, d = null, marqueeID = null, marqueeID2 = null;

	d = window.frames[Framename].document;
	// set marquee height
	if (( marqueeID = d.getElementById( "mq1" ))  && ( marqueeID2 = d.getElementById( "mq2" )) ) {
	  fsize = marqueeID2.style.height;
	  fsize = parseInt(fsize.replace("px", ""));
  	  fsize = fsize+inc; 
	  if(fsize < 20) fsize = 20;
	  else if(fsize > 70) fsize = 70;
	  fsize = fsize + 'px'; 
	  marqueeID.style.height = fsize;
	  marqueeID2.style.height = fsize;
	  //  alert("mq height: " + marqueeID.style.height);
	}
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	if(!cEl) return
	fsize = 0;
	if(cEl.currentStyle){ // IE version
		fsize = cEl.currentStyle.fontSize;
	}
	else{ // other browsers
		var finalStyle = document.defaultView.getComputedStyle(cEl, "");
		fsize = finalStyle.getPropertyValue("font-size");
	}
	if(!fsize){
		fsize = cEl.style.fontSize;
	}
	fsize = parseInt(fsize.replace("px", ""));
	if(fsize){
	 	fsize = fsize + inc;
	    // alert("font size: " + fsize);
	 	if(inc > 0 && fsize < 16){inc = 17-fsize; fsize = 16;}
	 	if(fsize < 8) fsize = 8;
	 	else if(fsize > 64) fsize = 64;
	 	if(fsize > 0)cEl.style.fontSize = fsize + 'px'; 
	}
	/*else{
	 	//if(inc > 0)cEl.style.fontSize = '110%';
	 	//else if(inc < 0)cEl.style.fontSize = '90%';
	} */

	for ( i = 0 ; i < tgs.length ; i++ ) {
		if(cTags = cEl.getElementsByTagName( tgs[ i ] )){
		 	
			for ( j = 0 ; j < cTags.length ; j++ ){
			 	p = cTags[j];
			 	fsize = 0;
			 	if(!(p.tagName == "br" || p.tagNmae == "BR" || p.tagName == "Br")){
				if(p.currentStyle){ // IE version
					fsize = p.currentStyle.fontSize;
				}
				else{ // other browsers
					var finalStyle = document.defaultView.getComputedStyle(p, "");
					fsize = finalStyle.getPropertyValue("font-size");
				}
				if(!fsize){
					fsize = p.style.fontSize;
				}
				fsize = parseInt(fsize.replace("px", ""));
			 	if(fsize > 0){ 
					if(fsize+inc > 0){
					 	fsize = fsize + inc;
					 	if(inc > 0 && fsize < 16){inc = 17-fsize; fsize = 16;} 
					 	if(fsize < 8) fsize = 8;
					 	else if(fsize > 64) fsize = 64;
						if(fsize > 0)p.style.fontSize = fsize + 'px';
					}
				}
				/*else{
				 	//if(inc > 0)p.style.fontSize = '110%';
				 	//else if(inc < 0)p.style.fontSize = '90%';
				} */
				}
			} 
		}
	}
}


function resetFrameFont( Framename, trgt){ //reset to null fontchange
	if (!document.getElementById(Framename)) return
	var cEl = null,i,j,cTags, d = null;
	
	d = window.frames[Framename].document;	
	if(!d) return;
	if (( marqueeID = d.getElementById( "mq1" ))  && ( marqueeID2 = d.getElementById( "mq2" )) ) {
	  marqueeID.style.height = "24px";
	  marqueeID2.style.height = "24px";
	  //  alert("mq height: " + marqueeID.style.height);
	}

	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	if(!cEl) return
	cEl.style.fontSize = '';

	for ( i = 0 ; i < tgs.length ; i++ ) {
		if(cTags = cEl.getElementsByTagName( tgs[ i ] )){
			for ( j = 0 ; j < cTags.length ; j++ ){
				cTags[j].style.fontSize = '';
			} 
		}
	}	
		//for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.background = 'red';}
}

/*
script language="javascript" type="text/javascript" 
    resize window frame flag = 0 reset, > 0 make wider
------------------------------------------------------ */
function Expand206Frame(iflag ) {
  var aw, ah, awstr;
  aw = screen.availWidth - 80;
  ah = screen.availHeight - 40;
  if(iflag > 0){
    if(aw < 862){ aw = 862;}
    if(ah < 400){ ah = 400;}
    else if(ah > 640){ ah = 640;}
	}
  else{aw = 862; 
    if(ah < 400){ ah = 400;}
    else if(ah > 630){ ah = 630;}
  }
  awstr = aw + "px";
  document.getElementById("headertable").style.width = awstr; 
  document.getElementById("headertable2").style.width = awstr;
  /*
  aw -= 4; awstr = aw + "px";
  tf = window.document.getElementById("mainframe"); 
	objToResize = (tf.style) ? tf.style : tf; 
	objToResize.width = awstr; 
	objToResize.height = awstr; 
  alert("Width: " + document.getElementById("mainframe").style.width + "\nAWstr: " + awstr);*/
 }

function resetFrameProps(){
   Expand206Frame( 0 )	;
   resetFrameFont("mainframe", "body");
}

