function createhtml(idpopup){
	
	if(idpopup=='0'){
	var popup = "<div id='popupbr' style='width:520px; right:0; top:50%;  height:240px; z-index:3000; position:fixed'><a href='http://productivityshop.net/category.php?ref=5' target='_blank'><div  id='popupisi'style=\"height:200px; float:right; width:0px; background:url('http://directivecommunication.com/popup/arthur1.png')\"></div></a><div id='openpopupbr' onclick=\"buka('460px');\"  style='cursor:pointer;float:right; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/open.png' /> </div><div id='closepopupbr' onclick=\"keluar('250px');\"  style='display:none; cursor:pointer;float:right; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/close.png' /> </div></div>";



	 $('#popupdisplay').html(popup);
	 panjang = '460px'
	buka(panjang);
	
	}
	
	
	else if(idpopup=='1'){
	var popup = "<div id='popupbr'  style='width:520px; right:0; bottom:0;  height:500px; z-index:3000; position:fixed'><a href='http://directivecommunication.com/products_page/colored_brain_communication_field_manual.php' target='_blank'><div  id='popupisi'  style=\"height:500px; float:right; width:0px; background:url('http://directivecommunication.com/popup/arthur2.png')\"></div></a><div id='openpopupbr' onclick=\"buka('224px');\"  style=' cursor:pointer;float:right; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/open.png' /> </div><div id='closepopupbr' onclick=\"keluar('100px');\"  style=' display:none; cursor:pointer;float:right; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/close.png' /> </div></div>";



	 $('#popupdisplay').html(popup);
	 panjang = '224px'
	buka(panjang);
	
	}
	
	
	
	
	else if(idpopup=='2'){
	var popup = "<div id='popupbr'  style='width:520px; left:0; bottom:0; width:0px;  height:500px; z-index:3000; position:fixed'><a href='http://directivecommunication.com/products_page/once_upon_a_time_for_manager.php?id_aff=dci178' target='_blank'><div  id='popupisi' style=\"height:500px; float:left; width:0px; background:url('http://directivecommunication.com/popup/arthur3.png')\"></div></a><div id='openpopupbr' onclick=\"buka('214px');\"  style='cursor:pointer;float:left;margin-top:8px;z-index:3002; position:fixed;width:40px'> <img src='http://directivecommunication.com/popup/open.png' /> </div><div id='closepopupbr' onclick=\"keluar('100px');\"  style=' display:none; cursor:pointer;float:left; margin-top:8px; width:40px;z-index:3002; position:fixed'> <img src='http://directivecommunication.com/popup/close.png' /> </div></div>";


	 $('#popupdisplay').html(popup);
	 panjang = '214px'
	buka(panjang);
	
	}
	
	
	
//leslie	
	
else if(idpopup=='3'){
	var popup = "<div id='popupbr'  style='width:520px; right:0; bottom:0;  height:400px; z-index:3000; position:fixed'><a href='http://directivecommunication.com/products_page/coloredbrain.php' target='_blank'><div  id='popupisi'  style=\"height:400px; float:right; width:0px; background:url('http://directivecommunication.com/popup/leslie3.png')\"></div></a><div id='openpopupbr' onclick=\"buka('268px');\"  style=' cursor:pointer;float:right; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/open.png' /> </div><div id='closepopupbr' onclick=\"keluar('100px');\"  style=' display:none; cursor:pointer;float:right; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/close.png' /> </div></div>";


	 $('#popupdisplay').html(popup);
	 panjang = '268px'
	buka(panjang);
	
	}
	
	
	
else if(idpopup=='4'){
	var popup = "<div id='popupbr'  style='width:280px; left:5%; bottom:0;  height:auto; z-index:3000; position:fixed'><div id='openpopupbr' onclick=\"bukabawah('400px');\"  style=' cursor:pointer;float:left; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/open.png' /> </div><div id='closepopupbr' onclick=\"keluarbawah();\"  style=' display:none; cursor:pointer;float:left; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/close.png' /> </div><a href='http://directivecommunication.com/products_page/interview_kit.php' target='_blank'><div  id='popupisi'  style=\"height:0px; float:left; width:242px; background:url('http://directivecommunication.com/popup/leslie2.png')\"></div></a></div>";


	 $('#popupdisplay').html(popup);
	 tinggi = '400px';
bukabawah(tinggi);
	
	}
	
	

else if(idpopup=='5'){
	var popup = "<div id='popupbr'  style='width:530px; left:50%; margin-left:-500px;  bottom:0;  height:auto; z-index:3000; position:fixed'><div id='openpopupbr' onclick=\"bukabawah('227px');\"  style=' cursor:pointer;float:left; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/open.png' /> </div><div id='closepopupbr' onclick=\"keluarbawah();\"  style=' display:none; cursor:pointer;float:left; margin-top:30px; width:40px'> <img src='http://directivecommunication.com/popup/close.png' /> </div><a href='http://directivecommunication.com/products_page/interview_kit.php' target='_blank'><div  id='popupisi'  style=\"height:0px; float:left; width:500px; background:url('http://directivecommunication.com/popup/leslie1.png')\"></div></a></div>";


	 $('#popupdisplay').html(popup);
	 tinggi = '227px';
bukabawah(tinggi);
	
	}	
		
	
	
	
	
	
	
	
	
//random	
else{
	var now = new Date();
	var second      = now.getSeconds();
	var idrd = second % 6;

	createhtml(idrd);
	
}
	
	
	
	
	
}


















function buka(panjang){
	
	
$('#popupisi').fadeIn('fast');

	 
	
	$('#popupisi').animate({
    width:  panjang, 
  
  }, 2000, 'linear',function(){
	  
	  
	
										   
	$('#openpopupbr').fadeOut('fast', function(){	
		document.getElementById('popupisi').style.display="inline";									   
		$('#closepopupbr').fadeIn('fast')								   
		
		
		
										   });
	
  });	


}





function keluar(panjang) {
 
	$('#popupisi').animate({
	width: '0px'
	


	
	
  
  }, 2000, 'linear',function(){
	  
	  $('#popupisi').animate({
	  
	  
	  		width: panjang
	  
	  
							 },2000,'linear',function(){
							
							
							
		
	  $('#popupisi').animate({
	  
	  
	  		width: '0px'
	  
	  
							 },2000,'linear',function(){
												
								 
								 
								 
								 
	  
	 
	  
	  
	  
	  									   
	$('#closepopupbr').fadeOut('fast', function(){										   
		$('#openpopupbr').fadeIn('fast')								   
			 
	  $('#popupisi').fadeOut('fast');
	  
	  document.getElementById('popupbr').style.width="0px";
	  
	  document.getElementById('popupisi').style.display="none";
	  
		
												});
												});
		
		
		
										   });
	  

  })

}
	 



//muncul  dari bawahhhhh

function bukabawah(tinggi){
	


$('#popupisi').animate({
    height: tinggi,
	
	
  }, 2000, 'linear',function(){
	 
	
										   
	$('#openpopupbr').fadeOut('fast', function(){										   
		document.getElementById('popupisi').style.display="inline";
		$('#closepopupbr').fadeIn('fast')								   
										   
										   });
	
  });	


}




function keluarbawah() {
	 $('#popupisi').animate({
    			height: '20px',
    }, 2000,
     
	 function(){
	       
		    		$('#popupisi').animate({
    				height: '80px',
    			}, 400, function(){
		
		
					$('#popupisi').animate({
    				height: '0px',
    			}, 400, function(){		
		
		   
		   
		   $('#closepopupbr').fadeOut('fast', function(){
													
					$('#openpopupbr').fadeIn('fast');
					$('#popupisi').fadeOut('fast');
					document.getElementById('popupbr').style.width="0px";
					 document.getElementById('popupisi').style.display="none";
													
													});
	
	
				});
      });
			
	  });
	 
	 
	 
}


//load xml

function readxml(site){
	
	
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.open("GET","http://directivecommunication/popup/popupdisplay.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 


var x=xmlDoc.getElementsByTagName("SITE");

for (i=0;i<x.length;i++)
  {
	  
	  alert(site);

	if(x[i].getElementsByTagName("HOST")[0].childNodes[0].nodeValue == site){
		var nilai = x[i].getElementsByTagName("POPUP")[0].childNodes[0].nodeValue;
		
		return nilai;
		
		
	}else {
		return false;	
		
	}
 
  }

}