///////////////////////////////////////////////////
///POPBOX1.2 BY GADAWEB www.gadaweb.com///
///////////////////////////////////////////////////
function popbox(widthu, heightu, html, bg, bgtop, border, colorborder, scrolling, title) { 
   var newdivbackground = document.createElement('div');
   newdivbackground.id = "popupboxidbackground";
   newdivbackground.style.position = "absolute";
   var heightvar=window.screen.height;
   var widthtvar=window.screen.width;
   var SCREENscrolltop = $(window).scrollTop();
   newdivbackground.style.width = widthtvar-23;
   newdivbackground.style.height = heightvar+SCREENscrolltop+500;
   newdivbackground.style.top = 0;
   newdivbackground.style.left = 0;
   
   document.body.appendChild(newdivbackground);
	
   var newdiv = document.createElement('div');
   newdiv.id = "popupboxid"; 
   
   newdiv.style.position = "absolute";
   newdiv.style.display = "none";
   
   if (widthu=="") 
   {
	   newdiv.style.width = 200+"px";
       var width = 200+"px"; 
   } 
   else 
   {
		newdiv.style.width = widthu+"px"; 
		var width = widthu; 
   }
   
   if (heightu=="") {
       newdiv.style.height = 300+"px";
	   var height = 300+"px";
   }   
   else 
   {
		newdiv.style.height = heightu+"px"; 
		var height = heightu; 
   }
	
	var heightvar=window.screen.height;
	var heightvar2=(heightvar-height)/2+SCREENscrolltop-140;
	if(heightvar2<=0)
	{
		heightvar2=10;	
	}
	var widthtvar=window.screen.width;
	var widthvar2=(widthtvar-width)/2;
	newdiv.style.left = widthvar2+"px";
	newdiv.style.border = border+"px solid #"+colorborder;
	newdiv.style.background = "#"+bg;
	newdiv.style.top = heightvar2+"px";   
	newdiv.style.zIndex = "100000";   
	
   if (html!="") {
       newdiv.innerHTML = html;
   } else {
       newdiv.innerHTML = "nothing";
   }   
   
   var heightframe=heightu-28;
   
   newdiv.innerHTML = "<div id='popbox' style='clear:both; background:#"+bgtop+"' id='popupbox_top' align='right'><div style='padding:2px; padding-left:6px; font-size:1px; float:left;'><span style=\"color:#ffffff; font-size:18px\">"+title+"</span></div><div style='padding:2px; padding-right:6px; font-size:1px; float:right'><span onclick='popboxclose();' id='chiudidiv'><img src='close.png' border='0' style='cursor:pointer'></span></div></div></div><iframe id='popupboxcontent' src='"+html+"' marginwidth='0' marginheight='0' width='100%' height='"+ heightframe+"' scrolling=\""+scrolling+"\" frameborder=\"0\" style=\"overflow-y:auto; overflow-x:hidden;\"></iframe>";
   document.body.appendChild(newdiv);
   $('#popupboxid').fadeTo('slow',1.0);
   //Drag.init(document.getElementById("popupboxid"));
} 

function popboxclose()
{
    iframe = document.getElementById('popupboxcontent');
  	iframe.src = 'sms_video.php?t=1';
  	//iframe.reload(true); 
	//document.getElementById('popupboxcontent').contentWindow.location.reload();
	var el = document.getElementById("popupboxid");
	$('#popupboxid').fadeTo('slow',0.0, function() {
	el.parentNode.removeChild(el);
	});
		
		
	//el.parentNode.removeChild(el);
	var el2 = document.getElementById("popupboxidbackground");
	el2.parentNode.removeChild(el2);
};

function newsletter()
{
	nlvalue=document.getElementById('newsletter').value;
	popbox('450', '310', 'newsletter.php?v='+nlvalue, '0461a7', 'ccc', '4', 'ccc', 'no', 'Newsletter') 
}
