 var openToken = "{?";
 var closeToken = "?}";
 var assignamentToken = "{?=";
 
 //Javascript replaceAll function
 function replaceAll( text, busca, reemplaza ){
	  while (text.toString().indexOf(busca) != -1)
	      text = text.toString().replace(busca,reemplaza);
	  return text;
 }
 
  
 //Replace tokens 
 function changeIt(){ 
 
	 var markup = document.body.innerHTML;
	 var middleString;
	 var replacedMarkup="";
	 var iniPos = markup.indexOf(openToken); 
	 

	 replacedMarkup=markup.substring(0,iniPos+2);	 
	 while(iniPos > -1){
	   var endPos = markup.indexOf(closeToken,iniPos);
	   middleString= markup.substring(iniPos+2,endPos);	   	   
	   if(middleString.indexOf("if")>0 || middleString.indexOf("else")>0 ){	     
		 middleString = middleString.substring(0,middleString.length-1);		   	     
  	     replacedMarkup+= middleString;
	     iniPos = markup.indexOf(openToken,endPos); 	   
		 middleString = markup.substring(endPos+2,iniPos);	
         middleString = replaceAll(middleString,"\"","'");
		 middleString = replaceAll(middleString,"\n","");
		 
	     replacedMarkup+= " document.write(\""+middleString+"\"); ";
       }
       else{
	     replacedMarkup += middleString;	
           		 
	     iniPos = markup.indexOf(openToken,endPos); 	
         if(iniPos!=-1)    		 
		    middleString = markup.substring(endPos,iniPos+2);	   	   
		 else
            middleString = markup.substring(endPos,markup.length+1);	   	   		 
	     replacedMarkup+= middleString;
	   }	        
	   
	 }
	
	 replacedMarkup = replaceAll(replacedMarkup,closeToken,"</script>");
	 replacedMarkup = replaceAll(replacedMarkup,assignamentToken,"<script type='text/javascript'>document.write"); 
	 replacedMarkup = replaceAll(replacedMarkup,openToken,"<script type='text/javascript'>");
	 
	 
	 document.body.innerHTML = ""; 
	 
	 paramsStr="var prmstr = window.location.search.substr(1);"+
	"var prmarr = prmstr.split('&');"+
	"var params = {};	"+	
	"for(var i = 0;i < prmarr.length; i++){"+
	"	var tmparr = prmarr[i].split('=');"+
	"   params[tmparr[0]] = tmparr[1];		"+
	"}"	
	 document.open("text/html");
	 document.write("<style type='text/css'> body {font-family:arial;} </style><script>"+paramsStr+";</scri"+"pt>"+replacedMarkup);
	 document.close();
 }