<style>
body {
	background-color: #083940;
	background-image: url(images/bg_patterns/habbo.gif);
	margin: 0;
	padding: 0;
	font-size: 11px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	text-align: left;
}

img {
	position: absolute;
	border: 0;
}
</style>
<div id="submenu">
<?php if($habboname == $homez && !$edithome=="true" && $page == 'home'){ ?>
<a href="edit/<?php echo $homez; ?>"><div id="edit-button"></div></a>
<?php } ?><?php if($habboname==$homez && $edithome=="true"){ ?>
<table height="2px" width="900px" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><a href="../stickershop" class="lbOn" id="sticker"><img src="<?php echo("$imgpath") ?>images/button/stickers.gif" border="0"></a></td>
<td valign="top"><a href="../bgshop" class="lbOn" id="sticker"><img src="<?php echo("$imgpath") ?>images/button/backgrounds.gif" border="0"></a></td>
<td valign="top"><a href="../noteshop" class="lbOn"><img src="<?php echo("$imgpath") ?>images/button/notes.gif" border="0"></a></td>
<td valign="top"><a href="../widgetshop" class="lbOn"><img src="<?php echo("$imgpath") ?>images/button/widgets.gif" border="0"></a></td>
<td valign="top"><a href="#" onClick="document.deletes=true;"><img src="<?php echo("$imgpath") ?>images/button/delete.gif" border="0"></a></td>
<td valign="top"><a href="javascript:save();"><img src="<?php echo("$imgpath") ?>images/button/save.gif" border="0"></a></td>
<td valign="top"><a href="../../<?php echo("$homez"); ?>" target="_parent"><img src="<?php echo("$imgpath") ?>images/button/canceledit.gif" border="0"></a></td>
</tr>
</table>
<?php } ?>
             <div class="subnav">
	         </div>
	     </div>
	   </div>
	</div>
<div id="main-content">
<?
$owner = $homez;
$owner = strtolower($owner);
$user = $_SESSION[habboname];
if($_POST['submit']){
$post = mysql_query("SELECT * FROM users WHERE name = '$user'");
$my = mysql_fetch_array($post);
$user = $my['name'];
$comment = $_POST['comment'];
$time = date("d-M-Y H:i:s");
mysql_query("INSERT INTO guestbook VALUES ('','$user','$homez','$comment','$time')");
}
?>
<style>
a.colorlink {
	clear: right;
	float: right;
	display: block;
	height: 18px;
	color: black;
	font-size: 10px;
	text-decoration: none;
	background-image: url(<?php echo ("$imgpath") ?>images/colorlink/orange.gif);
	background-repeat: no-repeat;
	background-position: top right;
	padding-right: 20px;
	margin: 0 0 6px 10px;
	white-space: nowrap;
}

a.colorlink.noarrow {
	background-image: url(<?php echo ("$imgpath") ?>images/colorlink/noarrow.gif);
}

a.colorlink.dialogbutton {
	clear: none;
}

a.colorlink.last {
	margin-bottom: 0;
}

a.colorlink span {
	font-weight: bold;
	float: left;
	display: block;
	height: 18px;
	background-image: url(<?php echo ("$imgpath") ?>images/colorlink/bg.gif);
	background-repeat: no-repeat;
	padding: 3px 8px 0 15px;
	cursor: pointer;
	color: black;
}

a.colorlink.noarrow span {
	padding-right: 0;
	padding-left: 19px;
}

a.colorlink.narrowbutton {
	padding-right: 8px;
}
a.colorlink.narrowbutton span {
	padding-right: 0;
	padding-left: 8px;
}
div.inventory-item {
	background-color: white;
	border: 1px solid #6F6F6F;
	padding: 2px;
	margin: 0 2px 2px 0;
	float: none;
	background-position: center;
	width: 75px;
	height: 75px;
	background-repeat: no-repeat;
	padding-right: 4px;
}
.home-title, .home-title a{
	color: white;
	font-weight: bold;
	font-size: 12px;
	margin: 0 3px;
	text-decoration: none;
}
.sticker{
cursor: move;
}
</style>
</head>

<body bgcolor="47839D">
<script type="text/javascript" src="<?php echo ("$imgpath") ?>js/wz_dragdrop.js"></script>
<script type="text/javascript" language="javascript">
document.deletes=false;

var websiteurl=false;

function GetXmlHttpObject(handler)
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}


function loadurl(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = triggered;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

      
function triggered() {
// if the readyState code is 4 (Completed)
// and http status is 200 (OK) we go ahead and get the responseText
// other readyState codes:
// 0=Uninitialised 1=Loading 2=Loaded 3=Interactive
if ((http_request.readyState == 4) && (http_request.status == 200)) {
	// xmlhttp.responseText object contains the response.
	if(http_request.responseText=='1'){
		window.parent.hideloadingbar();
		if(websiteurl==true){
			window.parent.loadwindow("Your selected website has now loaded.",250,150);
			websiteurl=false;			
		}else{
		window.location = "<?php echo $user; ?>";		
		}
	}else{
		window.location = "<?php echo $user; ?>";
	}
	
}
}
   
var activefurni = new Array();
<?
$rowconn = mysql_query("SELECT * FROM stickers WHERE home = '$user'");
while($row = mysql_fetch_array($rowconn)){ ?>activefurni.push('S_<?php echo $row['id']; ?>'); <?php } ?>

function save(){
	var x=0; 
	var data='';
for (x=0; x<activefurni.length; x++) 
{ 
	data = data + activefurni[x] + "," + dd.elements[activefurni[x]].y + "," + dd.elements[activefurni[x]].x + "," + dd.elements[activefurni[x]].z + "---" ;
}

loadurl('<?php echo("$sitepath") ?>home/save',"datastrip=" + data);
}
</script>
<?php $uexist = mysql_query("SELECT * FROM users WHERE name = '" . $homez . "'");
$uexist2 = mysql_fetch_array($uexist);
if(mysql_num_rows($uexist)=="0"){ ?>
<div id="myspan"></div>
<center>
<div class="v3box orange" style="width: 50%">
	<div class="v3box-top"><h3><?php echo("$name"); ?> Homes</h3></div>
	<div class="v3box-content">
		<div class="v3box-body">
	Oh no! Looks like <b><?php echo $homez; ?></b> hasn't got a <?php echo("$name"); ?> home yet! Are you <?php echo $homez; ?>? If you are, <a href="../index.php">get a <?php echo("$name"); ?> home today</a>!
	</div>
	</div>
<div class="v3box-bottom"><div></div></div>
</div>
</center>
<?php }
elseif($uexist2['ban']=="1"){ ?>
<center>
<div class="v3box orange" style="width: 50%">
	<div class="v3box-top"><h3>Sorry!</h3></div>
	<div class="v3box-content">
		<div class="v3box-body">
	This page is not available any more, <b><?php echo $propowner['name']; ?></b> was banned.
	</div>
	</div>
<div class="v3box-bottom"><div></div></div>
</div>
</center>

<?php }
else{
$user = strtolower($user);
$home = mysql_fetch_array(mysql_query("SELECT * FROM homes WHERE owner = '$owner'"));
$usr = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE name = '$owner'"));
?>
<div style="margin: 0px 0px 0px 4px;align: left;height: 800px; width: 920px; position: relative;" class="<?php echo $home['bg']; ?>">
<?php $notecheck = mysql_query("SELECT * FROM stickers WHERE home = '$owner' AND type = 'note'");
if(!mysql_num_rows($notecheck)=="0"){
while($row = mysql_fetch_array($notecheck)){
?>
<div class="movable stickie" style=" left: <?php echo $row['x']; ?>px; top: <?php echo $row['y']; ?>px; z-index: 3;" id="S_<?php echo $row['id']; ?>">
	<div class="n_skin_<?php echo $row['skin']; ?>skin" >

		<div class="stickie-header">
			<h3><a href="../skins?id=<?php echo $row['id']; ?>" class="lbOn"><img src="<?php echo("$imgpath") ?>images/button/icon_edit.gif" border="0"></a>			</h3>
			<div class="clear"></div>
		</div>
		<div class="stickie-body">
			<div class="stickie-content">
				<p><?php echo $row['content']; ?></p>
				<div class="stickie-footer">

				</div>
			</div>
		</div>
	</div>
</div>
<?php } } ?>
<?php $profilecheck = mysql_query("SELECT * FROM stickers WHERE home = '$owner' AND type = 'profile'");
if(!mysql_num_rows($profilecheck)=="0"){ 
$profile = mysql_fetch_array(mysql_query("SELECT * FROM stickers WHERE home = '$owner' AND type = 'profile'"));
?>
<div class="movable widget ProfileWidget" id="S_<?php echo $profile['id']; ?>" style=" left: <?php echo $profile['x']; ?>px; top: <?php echo $profile['y']; ?>px; z-index: <?php echo $profile['z']; ?>; position: absolute;">
<div class="w_skin_<?php echo $profile['skin']; ?>skin">
	<div class="widget-corner" id="widget-<?php echo $profile['id']; ?>-handle">
		<div class="widget-headline"><h3>
		<span class="header-left">&nbsp;</span><span class="header-middle">MY PROFILE</span><span class="header-right">&nbsp;</span><a href="../skins?id=<?php echo $profile['id']; ?>" class="lbOn"><img src="<?php echo("$imgpath") ?>images/button/icon_edit.gif" border="0"></a></h3>
		</div>	
	</div>
	<div class="widget-body">
		<div class="widget-content">
	<div class="profile-info">
		<div class="name" style="float: left">
		<span class="name-text"><?php echo $home['owner']; ?></span>
		</div>

		<br class="clear" />
		<br class="clear" />
		<div class="birthday text">
		<?php echo("$name"); ?> Name:
		</div>
		<div class="birthday date">
		<?php echo $usr['name']; ?>
		</div>
		<?php if($home['badge']){
		$chk = mysql_query("SELECT * FROM badges WHERE code = '" . $home['badge'] . "'");
		if(mysql_num_rows($chk)=="0"){
		?>
		<div>
		<img src="http://images.habbohotel.co.uk/c_images/album1584/<?php echo $home['badge']; ?>.gif">
		</div>
		<?php } else { 
		$chkrow = mysql_fetch_array($chk);
		?>
		<div>
		<img src="<?php echo $chkrow['url']; ?>">
		</div>
		<?php } } ?>
	</div>
	<div class="profile-figure">
			<img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?user=<?php echo $home['habboname']; ?>&action=std&frame=3&direction=4&head_direction=4&gesture=sml&img_format=gif" />
	</div>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>
	<br>

	<div class="profile-motto">
		<?php echo $usr['mission']; ?>
		<div class="clear"></div>
	</div>
		<div class="clear"></div>
		</div>
	</div>
</div>
</div>
<?php } ?>
<?php $guestcheck = mysql_query("SELECT * FROM stickers WHERE home = '$owner' AND type = 'guestbook'");
if(!mysql_num_rows($guestcheck)=="0"){ 
$guest = mysql_fetch_array(mysql_query("SELECT * FROM stickers WHERE home = '$owner' AND type = 'guestbook'"));
$gbpostd = mysql_query("SELECT * FROM guestbook WHERE home = '$owner'");
?>
<div class="movable widget GuestbookWidget" id="S_<?php echo $guest['id']; ?>" style=" left: <?php echo $guest['x']; ?>px; top: <?php echo $guest['y']; ?>px; z-index: <?php echo $guest['z']; ?>;">
<div class="w_skin_<?php echo $guest['skin']; ?>skin">
	<div class="widget-corner" id="widget-1939270-handle">
		<div class="widget-headline"><h3><span class="header-left">&nbsp;</span><span class="header-middle">My Guestbook(<?php echo mysql_num_rows($gbpostd); ?>) <span id="guestbook-type" class="public"><img src="/images/groups/status_exclusive.gif" title="Friends only" alt="Friends only"/></span></span><span class="header-right">&nbsp;</span><a href="../skins?id=<?php echo $guest['id']; ?>" class="lbOn"><img src="<?php echo("$imgpath") ?>images/button/icon_edit.gif" border="0"></a></h3>
		</div>	
	</div>
	<div class="widget-body">
		<div class="widget-content">
<div id="guestbook-wrapper" class="gb-public">
<ul class="guestbook-entries" id="guestbook-entry-container">
<?	
while($row = mysql_fetch_array($gbpostd)){ 
?>
	<li id="guestbook-entry-<?php echo $row['id']; ?>" class="guestbook-entry">
		<div class="guestbook-author">
		</div>
			<div class="guestbook-actions">
			</div>
		<div class="guestbook-message">
				<a href="home/<?php echo $row['poster']; ?>" target="_parent"><?php echo $row['poster']; ?></a>
			<p><?php echo $row['content']; ?></p>
		</div>
		<div class="guestbook-cleaner">&nbsp;</div>
		<div class="guestbook-entry-footer metadata"><?php echo $row['time']; ?></div>
	</li>
<?php } ?>
	<?php if(mysql_num_rows($gbpostd)=="0"){ ?>
	This user has no guestbook comments :(
	<?php } ?>
</div>
</ul>
	<?php if($_SESSION[login] == 'true'){ ?>
	<a href="edit/gbpost/<?php echo("$homez") ?>" class="lbOn colorlink orange">
	<span><img src="http://images.habbohotel.com/habboweb/16/11/web-gallery/images/myhabbo/buttons/icon_envelope.gif" />Post new message</span>
	</a>
	<?php } ?>
		<div class="clear"></div>
		</div>
	</div>
</div>
</div>
<?php }
$pillows = mysql_query("SELECT * FROM stickers WHERE home = '$owner'");
while($row = mysql_fetch_array($pillows)){
if($row['type']==""){
$row['z'] = str_replace("Â","",$row['z']);
?>
<div class="<?php echo $row['class']; ?>" style="left: <?php echo $row['x']; ?>px; top: <?php echo $row['y']; ?>px; z-index: <?php echo $row['z']; ?>; position: absolute;" id="S_<?php echo $row['id']; ?>">
</div>
<?php } } ?>
</div>
<?php 
   if($user==$owner && $edithome=="true") {
   $pillows = mysql_query("SELECT * FROM stickers WHERE home = '$owner'"); 
?>
<script type="text/javascript">
SET_DHTML(<?php while($row = mysql_fetch_array($pillows)){ ?>"S_<?php echo $row['id']; ?>",<?php } ?>"blank");
function my_DragFunc(){ 
	var divmainlocy=21;
	var divmainlocx=5;
	
	
	
	if(dd.obj.x<divmainlocx){ 
		dd.obj.moveTo(divmainlocx, dd.obj.y); 
	}else if(dd.obj.x>((923)-dd.obj.w))
	{
		dd.obj.moveTo(((923)-dd.obj.w), dd.obj.y); 
	} 
	
	if(dd.obj.y<divmainlocy){ 
		dd.obj.moveTo(dd.obj.x, divmainlocy);
	 }else if(dd.obj.y>((800)-dd.obj.h))
	 { 
	 	dd.obj.moveTo(dd.obj.x, ((800)-dd.obj.h));
	  }
 }
<?php 
$delay = 0;
$pillows = mysql_query("SELECT * FROM stickers WHERE home = '$owner'");
while($row = mysql_fetch_array($pillows)){
$delay = $delay+0.5;
?>
function sticker_<?php echo $row['id']; ?>_click(){ 
if(document.deletes){
dd.elements.S_<?php echo $row['id']; ?>.hide();
dd.elements.S_<?php echo $row['id']; ?>.moveTo(1,1); 
document.deletes=fauls;
}
}
<?php } ?>
<?
$pillows = mysql_query("SELECT * FROM stickers WHERE home = '$owner'");
while($row = mysql_fetch_array($pillows)){ ?>
dd.elements.S_<?php echo $row['id']; ?>.setPickFunc(sticker_<?php echo $row['id']; ?>_click);
<?php } ?>
</script>
<?php } } ?>