// JavaScript Document
function doIframe(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeight(o[i]);
			addEvent(o[i],'load', doIframe);
		}
	}
}

function setHeight(e){
	if(e.contentDocument){
		e.height = e.contentDocument.body.offsetHeight + 10;
	} else {
		e.height = e.contentWindow.document.body.scrollHeight;
	}
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);	
}

$.getJSON(urlx + '&callback=?', function(data) {  
$.each(data, function(entryIndex, entry) { 
 if (entry['data'].length > 0 ) {
  ps_height = entry['data'].length / 4;
  $('#ps_inv').after("<iframe id='ps_content' src='inv-frame.html' style='visibility:visible; width:350px;overflow-x:hidden; overflow-y:hidden;' frameborder='0' align='left' class='autoHeight' ></iframe>");
 
  $('#ps_content').load( function(){
	  $(this.contentDocument).find('#ps_inv_div').css("visibility","visible");
	  //$(this.contentDocument).find('#ps_inv_div').html(entry['data']);
      $(this.contentDocument).find('#ps_inv_div').css("width","100%");
	  $('#ps_content').contents().find('#ps_inv_div').html(entry['data']);
  });
 
 }
 }) 
});