<?php

defined('_JEXEC') or die('Restricted Access'); 

function com_install() 
{
  ?>
<div class="componentheader">ALFcontact v1.9.3</div>
  <p>Installation completed successfully !</p>
  <p>For more information about ALFcontact, check out the website at http://www.alfsoft.com</p>
  <?php
	
	// if 0 records, then it's a new install and set up some sample data
	$db = & JFactory::getDBO();
	$query = "SELECT * FROM #__alfcontact";
	$db->setQuery( $query );
    $rows= $db->LoadObjectList($query);
	$count = count($rows);
	
	if ($count < 1)
	{
		$db = & JFactory::getDBO();
		$query = "INSERT INTO `#__alfcontact` VALUES (1, 'Webmaster', 'webmaster@yoursite.com', '', '', '', '', 1, 0, 1)";
		$db->setQuery( $query );
		$result = $db->query();
		
		$db = & JFactory::getDBO();
		$query = "INSERT INTO `#__alfcontact` VALUES (2, 'Sales', 'info@yoursite.com', '[Sales]', 'Order number', 'Sales inquiry', '', 0, 0, 0)";
        $db->setQuery( $query );
		$result = $db->query();
		
		$db = & JFactory::getDBO();
		$query = "INSERT INTO `#__alfcontact` VALUES (3, 'Billing', 'info@yoursite.com','[Billing]','Invoice number', 'About my invoice', '',0, 1, 1)";
		$db->setQuery( $query );
		$result = $db->query();
	}
}
?>