function getFirstParam(){
	var pair = window.location.search.substring( 1 );
	var parts = pair.split( '=' );
	var param = parseInt( parts[1] );
	return param;
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function loadHiddenIframe(path) {	
	var height = document.getElementById('frame_content').offsetHeight + 30;
	
	//this loads the hidden page into the iFrame hidden inside the survey, with height as a url parameter.
	var iframe = document.getElementById( 'HiddenIframe' );	
	var src = path + '?height=' + height;
	iframe.src = src;
}

function resizeIframe( height ) { 
	//called by parent page 	
	var iframe = window.top.document.getElementById('contentFrame');
	iframe.style.overflow = "hidden";
	iframe.style.height = height + "px";
	var iframe_div = window.top.document.getElementById("bodycontainer");
	iframe_div.style.height = height + "px";
}
