<?php
// $Id: contact.html.php,v 1.8 2003/12/08 18:16:05 rcastley Exp $
/**
* Content code
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.8 $
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

class contact_html {
	function contactpage($contact_id_sel, $contact_name_sel, $contact_pos_sel, $id, $con_name, $con_position, $address, $suburb, $state, $country, $postcode, $telephone, $fax, $misc, $image, $imagepos, $hasEmail, $_sitename, $Itemid, $ordering) {
		global $mosConfig_live_site;
		?>
<script language="JavaScript" type="text/javascript">
<!--
	function validate(){
		if ((document.emailForm.text.value=="") || (document.emailForm.email.value.search("@")==-1) || (document.emailForm.email.value.search("[.*]")==-1)){
			alert("<?php echo _CONTACT_FORM_NC; ?>");
		} else {
		document.emailForm.action = "<?php echo sefRelToAbs("index.php?option=com_contact&Itemid=$Itemid"); ?>"
		document.emailForm.submit();
		}
	}
//-->
</script>
<script type="text/javascript">
<!--
	function ViewCrossReference (selSelectObject){
		if (selSelectObject.options[selSelectObject.selectedIndex].value != "")
		{
		location.href=selSelectObject.options[selSelectObject.selectedIndex].value
		}
	}
//-->
</script>
 
<form action="<?php echo sefRelToAbs("index.php?option=com_contact&amp;Itemid=$Itemid"); ?>" method="post" name="selectForm" target="_top" id="selectForm">
  <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">
    <tr>
      <td colspan="2" class="componentheading"><?php echo(_CONTACT_TITLE);?> </td>
    </tr>
    <tr>
		<?php
		if (count($contact_id_sel)>"1") {
			?>
      <td colspan="2"> <?php echo (_CONTACT_SEL); ?> <select name="contact_id" class="inputbox" onChange="ViewCrossReference(this);">
          <?php
			for ($x=0;$x<count($contact_id_sel);$x++) {
				if ($contact_id_sel[$x]==$id) {
      				?>
          <option value="<?php echo sefRelToAbs("index.php?option=com_contact&amp;Itemid=$Itemid&amp;contact_id=".$contact_id_sel[$x]); ?>" selected="selected"><?php echo $contact_name_sel[$x]." - ".$contact_pos_sel[$x]; ?></option>
          <?php
				} else {
				?>
          <option value="<?php echo sefRelToAbs("index.php?option=com_contact&amp;Itemid=$Itemid&amp;contact_id=".$contact_id_sel[$x]); ?>"><?php echo $contact_name_sel[$x]." - ".$contact_pos_sel[$x]; ?></option>
          		<?php
				}
			}
			?>
		</select>
		<?php
		} else {
			?>	
      <td>
        <?php
		}
		?>
      <input type="hidden" name="op" value="" /></td>
    </tr>
    <tr>
      <td width="900"></td>
      <td></td>
    </tr>
  </table>
</form>
<table width="100%" cellpadding="2" cellspacing="0" border="0" align="center" class="contact">
  <tr>
	<td height="0"></td>
    <td width="100%" height="0"></td>
  </tr>
  <?php
		if (trim($image)!="" and trim($imagepos)=='top') {
  			?>
  <tr>
    <td colspan="2"><img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $image; ?>" align="middle" alt="Contact" /></td>
  </tr>
  		<?php
		}
		if (trim($con_name)!=""){
  			?>
  <tr>
    <td class="details" colspan="2"><?php echo "<b>".$con_name."</b>"; if (trim($con_position)!=""){?></td>
  </tr>
  <tr>
    <td colspan="2"><?php echo $con_position;}?></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <?php
		}
		if ((trim($address)!="") || (trim($suburb)!="") || (trim($state)!="") || (trim($postcode)!="")){
  			?>
  <tr>
    <td width="16" align="center" class="icons"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/con_address.png" width="16" height="16" align="middle" alt="Address" />&nbsp;
    </td>
    <?php
  			if (trim($address)!="") {
          		?>
    <td width="100%" class="details"> <?php echo $address;?> </td>
  </tr>
    
  			<?php
  			}
  			if ((trim($suburb)!="") && (trim($state)!="") && (trim($postcode)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$suburb, $state, $postcode";?> </td>
  </tr>
  			<?php
  			} elseif ((trim($suburb)!="") && (trim($state)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$suburb, $state";?> </td>
  </tr>
  			<?php
  			} elseif ((trim($suburb)!="") && (trim($postcode)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$suburb, $postcode";?> </td>
  </tr>
  			<?php
  			} elseif ((trim($state)!="") && (trim($postcode)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$state, $postcode";?> </td>
  </tr>
  			<?php
  			} elseif ((trim($state)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$state";?> </td>
  </tr>
  			<?php
  			} elseif ((trim($suburb)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$suburb";?> </td>
  </tr>
  			<?php
  			} elseif ((trim($postcode)!="")) {
				?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$postcode";?> </td>
  </tr>
  			<?php
  			}
  			if (trim($country)!="") {
    			?>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details"> <?php echo "$country";?> </td>
    		<?php
  			}
			?>
  </tr>
  <tr>
    <td class="icons">&nbsp;</td>
    <td class="details">&nbsp;</td>
  </tr>
  		<?php
		}
		if (trim($telephone)!="") {
			?>
  <tr>
    <td class="icons"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/con_tel.png" align="middle" width="16" height="16" alt="Tel" />&nbsp;
    </td>
    <td class="details"><?php echo $telephone;?></td>
  </tr>
  		<?php
		}
		if (trim($fax)!="") {
			?>
  <tr>
    <td class="icons"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/con_fax.png" align="middle" width="16" height="16" alt="Fax" />&nbsp;
    </td>
    <td class="details"><?php echo $fax;?></td>
  </tr>
  		<?php
		}
		if (trim($misc)!="") {
			?>
  <tr>
    <td class="icons"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/con_info.png" align="middle" width="16" height="16" alt="Info" />&nbsp;
    </td>
    <td class="details"><?php echo $misc;?></td>
  </tr>
  		<?php
		}
		if (trim($image)!="" and trim($imagepos)=='bottom') {
     		?>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $image; ?>" align="middle" alt="Contact" /></td>
  </tr>
  		<?php
		}
		?>
</table>
		<?php
		if ($hasEmail) {
			?>
<br />
<form action="<?php echo sefRelToAbs("index.php?option=com_contact&amp;Itemid=$Itemid"); ?>" method="post" name="emailForm" target="_top" id="emailForm">
  <table width="100%" cellpadding="2" cellspacing="0" border="0" align="center" class="contentpane">
    <tr>
      <td colspan="3"><?php echo(_NAME_PROMPT);?><br /> <input type="text" name="name" size="30" class="inputbox" value="" />
      </td>
    </tr>
    <tr>
      <td colspan="3"><?php echo(_EMAIL_PROMPT);?><br /> <input type="text" name="email" size="30" class="inputbox" value="" />
      </td>
    </tr>
    <tr>
      <td colspan="3"><?php echo(_MESSAGE_PROMPT);?></td>
    </tr>
    <tr>
      <td colspan="3" valign="top"> <textarea cols="50" rows="5" name="text" class="inputbox"></textarea>
      </td>
    </tr>
    <tr>
      <td colspan="3" valign="bottom">
		<input type="hidden" name="con_id" value="<?php echo $id; ?>" />
        <input type="hidden" name="sitename" value="<?php echo $_sitename; ?>" />
        <input type="hidden" name="op" value="sendmail" />
        <input type="hidden" name="option" value="com_contact" />
        <input type="button" name="send" value="<?php echo(_SEND_BUTTON); ?>" class="button" onclick="validate()" />
      </td>
    </tr>
  </table>
</form>
<?php
		}
		
	}
}
?>