var $a='|div|p|table|tbody|tr|td|th|title|head|body|script|comment|li|meta|h1|h2|h3|h4|h5|h6|hr|ul|ol|option|';var $b='|html|head|body|p|th|style|';var $c=new RegExp();$c.compile("^<!--(.*)-->$");var $d=new RegExp();$d.compile("-$");function get_xhtml($e,$f,$g,$h,$i){var i;var $j='';var $k=$e.childNodes;var $l=$k.length;var $m;var $n=$h?true:false;var $o=true;for(i=0;i<$l;i++){var $p=$k[i];switch($p.nodeType){case 1:{var $m=String($p.tagName).toLowerCase();if($m=='')break;if($m=='meta'){var $q=String($p.name).toLowerCase();if($q=='generator')break;};if(!$h&&$m=='body'){$o=false;};if($m=='!'){var $r=$c.exec($p.text);if($r){var $s=$r[1];$j+=fix_comment($s);}}else{if($m=='html'){$j='<?xml version="1.0" encoding="'+$g+'"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';};if($a.indexOf('|'+$m+'|')!=-1){if(($n||$j!='')&&!$i)$j+='\n';}else{$n=true;};$j+='<'+$m;var $t=$p.attributes;var $u=$t.length;var $v;var $w=false;var $x=false;var $y=false;var $z=false;for(j=0;j<$u;j++){var $A=$t[j].nodeName.toLowerCase();if(!$t[j].specified&&($A!='selected'||!$p.selected)&&($A!='style'||$p.style.cssText=='')&&$A!='value')continue;if($A=='_moz_dirty'||$A=='_moz_resizing'||$m=='br'&&$A=='type'&&$p.getAttribute('type')=='_moz')continue;var $B=true;switch($A){case "style":$v=$p.style.cssText;break;case "class":$v=$p.className;break;case "http-equiv":$v=$p.httpEquiv;break;case "noshade":break;case "checked":break;case "selected":break;case "multiple":break;case "nowrap":break;case "disabled":break;$v=$A;break;default:try{$v=$p.getAttribute($A,2);}catch(e){$B=false;};break;};if($A=='lang'){$w=true;$v=$f;};if($A=='xml:lang'){$x=true;$v=$f;};if($A=='xmlns')$y=true;if($B){if(!($m=='li'&&$A=='value')){$j+=' '+$A+'="'+fix_attribute($v)+'"';}};if($A=='alt')$z=true;};if($m=='img'&&!$z){$j+=' alt=""';};if($m=='html'){if(!$w)$j+=' lang="'+$f+'"';if(!$x)$j+=' xml:lang="'+$f+'"';if(!$y)$j+=' xmlns="http://www.w3.org/1999/xhtml"';};if($p.canHaveChildren||$p.hasChildNodes()){$j+='>';$j+=get_xhtml($p,$f,$g,true,$i||$m=='pre'?true:false);$j+='</'+$m+'>';}else{if($m=='style'||$m=='title'||$m=='script'){$j+='>';var $s;if($m=='script'){$s=$p.text;}else{$s=$p.innerHTML;};if($m=='style'){$s=String($s).replace(/[\n]+/g,'\n');};$j+=$s+'</'+$m+'>';}else{$j+=' />';}}};break;}case 3:{if(!$i){if($p.nodeValue!='\n'){$j+=fix_text($p.nodeValue);}}else{$j+=$p.nodeValue;};break;}case 8:{$j+=fix_comment($p.nodeValue);break;};default:break;}};if(!$h&&!$o){$j=$j.replace(/<\/?$C>[\n]*/gi,"");$j=$j.replace(/<head \/>[\n]*/gi,"");$j=$j.replace(/<\/?$D>[\n]*/gi,"");}return $j;}function fix_comment($j){$j=$j.replace(/--/g,"__");if($d.exec($j)){$j+=" ";}return "<!--"+$j+"-->";}function fix_text($j){return String($j).replace(/\n{2,};/g,"\n").replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00A0/g,"&nbsp;");};function fix_attribute($j){return String($j).replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;");}

