<?php

function confirm_query(){
	
if (!$result_set){
	die("Database query failed ". mysql_query());
}
}
function mysql_prep($value){
	
$magic_quotes_active = get_magic_quotes_gpc();
$new_enough_php	= function_exists("mysql_real_escape_string");
if ($new_enough_php){
	
	if ($magic_quotes_active){
		$value = stripslashes($value);
	}
		$value = mysql_real_escape_string($value);
	}else {
	if (!$magic_quotes_active){
		$value = addslashes($value);
	}
	}
	return $value;
}
function strip_from_zero($marked_string){
	
$no_zero = str_replace('*0','',$marked_string);
$cleaned_string = str_replace('*','',$no_zero);
return $cleaned_string;	
}

function redirect_to($location=NULL){
if ($location !=NULL){
header("Location: {$location}");
exit;
}
}
function output_message($message=""){
if (!empty($message)){
return "<p style=\"color:#F00; font-weight:bolder; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:15px\">$message</p>";
}else {
	return "";
}
}
function __autoload($class_name){
	$class_name= strtolower($class_name);
	$path = LIB_PATH.DS."{$class_name}.php";
	if (file_exists($path)){
		require_once($path);
	}else {
		die("The file {$class_name}.php could not be found");
		}
	}
	function include_layout_template($template=""){
		
	include(SITE_ROOT.DS.'template'.DS.$template);	
	}
?>