window.onload = function(){
	setH();
	setBg();
}

function getElemId(n,ele){return (ele || document).getElementById(n);}
function getElemTag(n,ele){return (ele || document).getElementsByTagName(n);}
function createEle(ele){return document.createElement(ele);}
function createText(t){return document.createTextNode(t);}
function appChild(n,ele){return (ele ||document).appendChild(n)}

function manEvnt(eOj,e,eHandler){
	if(eOj.addEventListener){
	eOj.addEventListener(e,eHandler,false);
	}else if(eOj.attachEvent){// for older browsers
		e = "on" + e;
		eOj.attachEvent(e,eHandler);
	}
}

/*can turn this into an objecgts*/
//declare object to sort out heights
function Seth(sId,sEle){
	this.searchId = sId;//id to search
	this.searchEle = sEle;//element to search for
	 var searchArray = new Array();
	searchFor = function(o){
	var cur;	
	//var o = getElemId(sId);
	
	if(o.childNodes.length > 0){
		for(var a = 0;a<o.childNodes.length;a++){
			if(o.childNodes[a].nodeType == 1 && o.childNodes[a].nodeName.toLowerCase() == sEle){//dont bother with text or white space
				alert("got it");
			}
			else{	
						cur = o.childNodes[a];
						searchFor(cur)	;
				}
		}
	}
	//var e = o.getElementsByTagName(sEle);
}

 searchFor(getElemId(sId));
 //alert(searchArray)
}

function setH(){
	if(getElemId("pmo")){
	var b = getElemId("pmo");
var c = b.getElementsByTagName("p");

var pH = 0;
for(var i=0;i<c.length;i++){
	//alert(c.length)
	var pHn = c[i].clientHeight;//get div height
	var e = c[i].className;
	if(e == "pmo-p1" || e == ""){
	if(pHn > pH){pH = pHn;}//if height is greater then make it current height}
	}}

for(var ii=0;ii<c.length;ii++){//reloop
	var e = c[ii].className;
	if(e == "pmo-p1" || e == ""){
	c[ii].style.height = pH + "px";//set height of p tag
	}}
	}
	else{return}
	}

function setBg(){
var hC	= $("#mn-cnt-in").height();
var hC2	= $("#rhn").height();
if(hC>hC2){$("#rhn").height(hC)}else{$("#mn-cnt-in").height(hC2)}
}

function fullHeight( elem) {
// If the element is being displayed, then offsetHeight
// should do the trick, barring that, getHeight() will work
if ( getStyle( elem, 'display' ) != 'none' )
return elem.offsetHeight || getHeight( elem );
// Otherwise, we have to deal with an element with a display
// of none, so we need to reset its CSS properties to get a more
// accurate reading
var old = resetCSS( elem, {
display: '',
visibility: 'hidden',
position: 'absolute'
});
// Figure out what the full height of the element is, using clientHeight
// and if that doesn't work, use getHeight
var h = elem.clientHeight || getHeight( elem );
// Finally, restore the CSS properties back to what they were
restoreCSS( elem, old );
// and return the full height of the element
return h;
}

// Get the actual height (using the computed CSS) of an element
function getHeight( elem ) {return parseInt( getStyle( elem, 'height' ));}

// Get a style property (name) of a specific element (elem)
function getStyle( elem, name ) {
// If the property exists in style[], then it's been set
// recently (and is current)
if (elem.style[name])
return elem.style[name];
// Otherwise, try to use IE's method
else if (elem.currentStyle)
return elem.currentStyle[name];
// Or the W3C's method, if it exists
else if (document.defaultView && document.defaultView.getComputedStyle) {
// It uses the traditional 'text-align' style of rule writing,
// instead of textAlign
name = name.replace(/([A-Z])/g,"-$1");
name = name.toLowerCase();
// Get the style object and get the value of the property (if it exists)
var s = document.defaultView.getComputedStyle(elem,"");
return s && s.getPropertyValue(name);
// Otherwise, we're using some other browser
} else
return null;
}


//taken from pro js tech p 101
function SetAttr(e, n, v) {
// Make sure that a valid name was provided
if ( !n || n.constructor != String ) return '';
// Figure out if the name is one of the weird naming cases
n = { 'for': 'htmlFor', 'class': 'className' }[n] || n;
// If the user is setting a value, also
if ( typeof v != 'undefined' ) {
// Set the quick way first
e[n] = v;
// If we can, use setAttribute
if ( e.setAttribute )
e.setAttribute(n,v);
}
// Return the value of the attribute
return e[n] || e.getAttribute(n) || '';
}

$(document).ready(function(){    
//set height ;
setBg();
});  //end ready function