// JavaScript Document
chrome.extension.sendRequest({greeting: "rrq"}, function(response) {  var resfrombackground=response.farewell;   	var str = resfrombackground; 	var showtopad = str.charAt(0);  dynamicval=str.split(',');    	 if (showtopad == 'Y') 		{  	mydiv=document.createElement("DIV"); 	mydiv.setAttribute('id',"tlyr1"); 	mydiv.style.width = dynamicval[4];     mydiv.style.height = dynamicval[5];  	mydiv.setAttribute("align","center"); 	mydiv.style.marginLeft="auto"; 	mydiv.style.marginRight="auto"; 	 	myidiv=document.createElement("DIV"); 	myidiv.setAttribute('id',"tilyr1"); 	myidiv.style.position='absolute';      ifrm = document.createElement("IFRAME");     var page_src=dynamicval[6]; 	    ifrm.setAttribute("src", page_src);    ifrm.setAttribute("id",'tifrm');    ifrm.style.width = dynamicval[4];    ifrm.style.height = dynamicval[5];    ifrm.setAttribute("frameborder","0");    ifrm.setAttribute("scrolling","no");    
   cimg=document.createElement("IMG"); 	cimg.setAttribute('id',"tcimg"); 	cimg.setAttribute('src',chrome.extension.getURL("close.jpg")); 	cimg.style.position="absolute"; 	cimg.style.bottom="7px"; 	cimg.style.right="0px"; 	cimg.style.width="15px"; 	cimg.style.height="15px"; 	cimg.style.zIndex="1000001"; 	cimg.style.display="none";       
var firsttaginbody=document.body.firstChild; document.body.insertBefore(mydiv,firsttaginbody);  document.getElementById('tlyr1').appendChild(myidiv);  document.getElementById('tilyr1').appendChild(ifrm); document.getElementById('tilyr1').appendChild(cimg);   function closeall()   { 	  	document.getElementById('tlyr1').style.display='none'; 			} 		 document.getElementById('tcimg').onclick=closeall;	  function showrcimg()  { document.getElementById('tcimg').style.display='block'; document.getElementById('tlyr1').style.border="1px solid #bfbfbf"; }
document.getElementById('tifrm').onload=showrcimg;  		}   		 	var showbotad = str.charAt(4); 	 if (showbotad == 'Y') 		{    	mydiv_bottom=document.createElement("DIV"); 	mydiv_bottom.setAttribute('id',"lyr1_bottom"); 	mydiv_bottom.style.display='none'; 	mydiv_bottom.style.width = dynamicval[7];     mydiv_bottom.style.height = dynamicval[8];  	mydiv_bottom.setAttribute("align","center"); 	 	myidiv=document.createElement("DIV"); 	myidiv.setAttribute('id',"bilyr1"); 	myidiv.style.position='absolute'; 	 				     ifrm_bottom = document.createElement("IFRAME"); 	var page_src_bottom=dynamicval[9]; 	    ifrm_bottom.setAttribute("src", page_src_bottom);    ifrm_bottom.setAttribute("id",'bifrm');    ifrm_bottom.style.width = dynamicval[7];    ifrm_bottom.style.height = dynamicval[8];    ifrm_bottom.setAttribute("frameborder","0");    ifrm_bottom.setAttribute("scrolling","no");           cimg_bottom=document.createElement("IMG"); 	cimg_bottom.setAttribute('id',"bcimg"); 	cimg_bottom.setAttribute('src',chrome.extension.getURL("close.jpg")); 	cimg_bottom.style.position="absolute"; 	cimg_bottom.style.top="7px"; 	cimg_bottom.style.right="0px"; 	cimg_bottom.style.width="15px"; 	cimg_bottom.style.height="15px"; 	cimg_bottom.style.zIndex="1000001"; 	cimg_bottom.style.display="none";       
   
document.getElementsByTagName('body')[0].appendChild(mydiv_bottom);   var firsttagindiv=document.getElementById('lyr1_bottom').firstChild; document.getElementById('lyr1_bottom').insertBefore(myidiv,firsttagindiv);   document.getElementById('bilyr1').appendChild(ifrm_bottom); document.getElementById('bilyr1').appendChild(cimg_bottom);  function bcloseall()   { 	  	document.getElementById('lyr1_bottom').style.display='none'; 			} 		 document.getElementById('bcimg').onclick=bcloseall;	  function bshowrcimg()  { document.getElementById('bcimg').style.display='block'; document.getElementById('lyr1_bottom').style.border="1px solid #bfbfbf"; }
document.getElementById('bifrm').onload=bshowrcimg;   var wid=window.innerWidth; var midadwid=dynamicval[7].split('p'); var result=(wid/2)-(midadwid[0]/2);  	mydiv_bottom.style.position='fixed'; 	mydiv_bottom.style.zIndex="1000000";	 	mydiv_bottom.style.bottom="0px"; 	mydiv_bottom.style.left=result+"px";   window.onload=mydiv_bottom.style.display='block';      		}  }); 