function get_random()
{
    var ranNum= Math.floor(Math.random()*999999);
    return ranNum;
}
function show_user_image(id) {
	return ddrivetip('<div style=\'width: 100px; text-align: center;\'><img src=\'/user_images/' + id + '.jpg\' /></div>', '#fff', 100);
}
function ismaxlength(obj){
	var mlength=250;
	if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}
function doso(which, x, v) {
	AjaxRequest.post(
	  {
	  	'parameters' : {'0' : x, '1' : v},
	  	'AJAX_add_comments':'true',
	  	'comments_name': which.comments_name.value,
	  	'comments':which.comments.value,
	  	'security-code':which.number_code.value,
	  	'onLoading':function(req){
	  		document.getElementById('confirmation').style.display = 'block';
	  		document.getElementById('confirmation').innerHTML = "<div id=\"confirm_box\"><img src=\"/images/warning.gif\" align=\"left\">Please Wait...</div>";
	  		which.submit.disabled = true;
	  	},
		'onSuccess':function(req){
			var random = get_random();
			var s = req.responseText.split("|");
			document.getElementById('confirmation').innerHTML = s[0];
			document.getElementById('all_comments').innerHTML = s[1];
			document.getElementById('securityimage').innerHTML = "<img src=\"/security-image.php?width=144&height=20&rand=" + random + "\" width=\"144\" height=\"20\" alt=\"Security Image\" style=\"border: 1px solid #7f9db9; margin: 0px 0px;\" />";
			which.submit.disabled = false;
		},
		'onError':function(req){
			alert('Error!!\nStatusText='+req.statusText+'\nContents='+req.responseText);
		}
	  }
	);
return false;
}
function send_message(which) {
	AjaxRequest.post(
		  {
	  	'AJAX_send_message':'true',
	  	'url' : '/contact.php',
	  	'contact_name': which.contact_name.value,
	  	'contact_email': which.contact_email.value,
	  	'contact_message': which.contact_message.value,
	  	'contact_code': which.contact_code.value,
	  	'onLoading':function(req){
	  		document.getElementById('confirmation').style.display = 'block';
	  		document.getElementById('confirmation').innerHTML = "<div id=\"confirm_box\"><img src=\"/images/warning.gif\" align=\"left\">Please Wait...</div>";
	  		which.submit.disabled = true;
	  	},
		'onSuccess':function(req){
			var random = get_random();
			if (req.responseText == "1") {
				document.getElementById('confirmation').innerHTML = "<div id=\"confirm_box\"><img src=\"/images/green-checkmark.gif\" align=\"left\">Thankyou, your comments have been received.</div>";
			} else if (req.responseText == "2") {
				document.getElementById('confirmation').innerHTML = "<div id=\"confirm_box\"><img src=\"/images/warning.gif\" align=\"left\">The Security Code entered is not correct.</div>";
			} else {
				document.getElementById('confirmation').innerHTML = "<div id=\"confirm_box\"><img src=\"/images/warning.gif\" align=\"left\">An error occured and your message was not sent. Please try again.</div>";
			}
			document.getElementById('securityimage').innerHTML = "<img src=\"/security-image.php?width=144&height=20&rand=" + random + "\" width=\"144\" height=\"20\" alt=\"Security Image\" style=\"border: 1px solid #7f9db9; margin: 0px 0px;\" />";
			which.submit.disabled = false;
		}
		
	  }
	);
return false;
}
function report_post(id) {
	AjaxRequest.post(
	  {
	  	'AJAX_report_post':'true',
	  	'post_id': id,
		'onSuccess':function(req){
			document.getElementById('all_comments').style.display = 'block';
			document.getElementById('all_comments').innerHTML = req.responseText;
		},
		'onError':function(req){
			alert('Error!!\nStatusText='+req.statusText+'\nContents='+req.responseText);
		}
	  }
	);
return false;
}
function tell_a_friend(which) {
	AjaxRequest.post(
		  {
	  	'AJAX_tell_a_friend':'true',
	  	'contact_f_name': which.contact_f_name.value,
	  	'contact_l_name': which.contact_l_name.value,
	  	'contact_email': which.contact_email.value,
	  	'friend_name': which.friend_name.value,
	  	'friend_email': which.friend_email.value,
	  	'message': which.message.value,
	  	'send_copy': which.send_copy.value,
	  	'send_receipt': which.send_receipt.value,
	  	'security_code': which.security_code.value,
	  	'onLoading':function(req){
	  		document.getElementById('confirmation_top').style.display = 'block';
	  		document.getElementById('confirmation_bottom').style.display = 'block';
	  		document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">Please Wait...</div>";
	  		document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">Please Wait...</div>";
	  		which.submit.disabled = true;
	  	},
		'onSuccess':function(req){
			var random = get_random();
			if (req.responseText == "1") {
				document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/green-checkmark.gif\" align=\"left\">Thankyou, an email has been sent to your friend.</div>";
				document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/green-checkmark.gif\" align=\"left\">Thankyou, an email has been sent to your friend.</div>";
			} else if (req.responseText == "code_problem") {
				document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">The Security Code entered is not correct.</div>";
				document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">The Security Code entered is not correct.</div>";
			} else if (req.responseText == "email_problem") {
				document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">Either your or your friends' email address is not correct.</div>";
				document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">Either your or your friends' email address is not correct.</div>";
			} else if (req.responseText == "from_name_problem") {
				document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">You must enter Your Name.</div>";
				document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">You must enter Your Name.</div>";
			} else if (req.responseText == "to_name_problem") {
				document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">You must enter Your Friends' Name.</div>";
				document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">You must enter Your Friends' Name.</div>";
			} else {
				document.getElementById('confirmation_top').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">An error occured and your message was not sent. Please try again.</div>";
				document.getElementById('confirmation_bottom').innerHTML = "<div id=\"confirm_box\"><img src=\"./images/warning.gif\" align=\"left\">An error occured and your message was not sent. Please try again." + req.responseText + "</div>";
			}
			document.getElementById('securityimage').innerHTML = "<img src=\"security-image.php?width=144&height=20&rand=" + random + "\" width=\"144\" height=\"20\" alt=\"Security Image\" style=\"border: 1px solid #7f9db9; margin: 0px 0px;\" />";
			which.submit.disabled = false;
		},
		'onError':function(req){
			alert('Error!!\nStatusText='+req.statusText+'\nContents='+req.responseText);
		}
	  }
	);
return false;
}
function toggle_div(which) {
	if (document.getElementById('round1').style.display == 'block') {
		$('#round1').SlideOutUp(500); var wait = 600; var shrink = 'round1';
	}
	if (document.getElementById('round2').style.display == 'block') {
		$('#round2').SlideOutUp(500); var wait = 600; var shrink = 'round2';
	}
	if (document.getElementById('round3').style.display == 'block') {
		$('#round3').SlideOutUp(500); var wait = 600; var shrink = 'round3';
	}
	if (document.getElementById('round4').style.display == 'block') {
		$('#round4').SlideOutUp(500); var wait = 600; var shrink = 'round4';
	}
	if (document.getElementById('round5').style.display == 'block') {
		$('#round5').SlideOutUp(500); var wait = 600; var shrink = 'round5';
	}
	if (document.getElementById('round6').style.display == 'block') {
		$('#round6').SlideOutUp(500); var wait = 600; var shrink = 'round6';
	}
	if (document.getElementById('deals').style.display == 'block') {
		$('#deals').SlideOutUp(500); var wait = 600; var shrink = 'deals';
	}
	if (document.getElementById('boxes').style.display == 'block') {
		$('#boxes').SlideOutUp(500); var wait = 600; var shrink = 'boxes';
	}
	if (which != shrink) {
		if (wait) {
			window.setTimeout("toggle_div2('" + which + "')", wait);
		} else {
			toggle_div2(which);
		}
	}
	return false;
}
function toggle_div2(which) {
	//alert(which);
	$('#' + which).SlideToggleUp(500, null, 'bounceout');
}
function write_object(embedded_object)
{
	document.write(embedded_object);
	document.write('\n');
}