var thisbrowser = msieversion();

function scrollto(id1,id2)
{
if (thisbrowser == 0 || thisbrowser >= 7)
{ 
	coordinates_1 = getAnchorPosition(id1);
	coordinates_2 = getAnchorPosition(id2);
	var ypos_1 = coordinates_1.y;
	var ypos_2 = coordinates_2.y;
	var scrollpos = parseInt(ypos_2 - ypos_1);
	//alert("id1: "+id1);
	//alert("id2: "+id2);
	//alert("scrollpos: "+scrollpos);
	
	window.scroll(0,scrollpos); // horizontal and vertical scroll targets
}
}

function eheightonresize(id)
{
if ( thisbrowser > 0)
{ 
  var myWidth = 0, myHeight = 0;
  var myWidth1 = 0, myHeight1 = 0;
  var diff = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth1 = window.innerWidth;
    myHeight1 = window.innerHeight;
	// do nothing...
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
		if (msieversion() >= 7)
		{
    		myWidth1 = window.innerWidth;
    		myHeight1 = window.innerHeight;
			// do nothing else...
		}
		else
		{
    		myWidth = document.documentElement.clientWidth;
    		myHeight = document.documentElement.clientHeight;
		}
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if(myHeight > 0)
  {
  	var new_h = myHeight - 155;
	document.getElementById(id).style.height=new_h;
	document.getElementById("navbar_container").style.height=myHeight - 107;
  }
}
}
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; } 
}
function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
}
function processItem(key){
if(queryString(key)=='false') 
{
// do nothing
//alert("you didn't enter a querystring item.");
}else{
//alert(queryString(key));
scrollto('content_area',queryString(key));
}
}

function urlencode(str) {
    var v;
    try { v = encodeURIComponent(str); } catch (e) { v = escape(str); }
    return v.replace(/%20/g,"+");
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function match_height(id1, id2)
{
	var maxheight;
	var height_id1 = getElementHeight(id1);
	var height_id2 = getElementHeight(id2);
	//alert("height_id1: "+height_id1);
	//alert("height_id2: "+height_id2);
	if(height_id2 > height_id1) maxheight = height_id2;
	else maxheight = height_id1;
	document.getElementById(id1).style.height = maxheight + "px";
	document.getElementById(id2).style.height = maxheight + "px";
	//alert("maxheight: "+maxheight);
}

function match_height_mid(id1, id2, id3)
{
	var maxheight;
	var height_id1 = getElementHeight(id1);
	var height_id2 = getElementHeight(id2);
	//alert("height_id1: "+height_id1);
	//alert("height_id2: "+height_id2);
	if(height_id2 > height_id1) maxheight = height_id2;
	else maxheight = height_id1;
	document.getElementById(id1).style.height = maxheight + "px";
	document.getElementById(id2).style.height = maxheight + "px";
	document.getElementById(id3).style.height = maxheight-38 + "px";
	//alert("maxheight: "+maxheight);
}

