<?php

	include "/home/academi1/m-m-ventures.com/common_code/common_library.php";

	include "/home/academi1/m-m-ventures.com/common_code/forms_library.php";



	function start_code( $first=false, $db="" )
	{
			/* set up paths */

		$domain = val( $_SERVER, "HTTP_HOST" );

//		$domain_root = substr( $domain, 4, strlen( $domain ) - 4 );
//		$domain_root = substr( $domain_root, 0, strlen( $domain_root ) - 4 );

		session_start();

		$_SESSION['domain'] = $domain;

		$_SESSION['pathroot'] = "/home/academi1/m-m-ventures.com/intbusinessesforsale";


			/* set up variables */

		$database = "academi1_intbusinessesforsale";

        if ($db != "")
	        $database = $db;
    	
    		    
        $_SESSION['database'] = $database;
		

		$user = val( $_GET, "user" );


			/* remember user across pages */

			/* set config options */

		ini_set( "error_log", $_SESSION['pathroot']."/error_log.txt" );

			// don't enable these options as they my expose technical details of the site to viewers
		ini_set( "display_errors", "on" );
		ini_set( "display_startup_errors", "on" );

        error_reporting( E_ALL & ~E_DEPRECATED );
        
		ini_set( "gc_maxlifetime", 1*60*60 );		/* set session timeout to 1 hour */

		ini_set( "date.timezone", "Australia/Melbourne" );
		
		if (! $first )
			check_url();

		$cxn = db_login( $database );

//                if ($cxn == 0)
//                    echo $domain."<br>";


		return ($cxn);
	}

		
		/* generate the heading line for a page */

		/* NOTE: don't call this before any jump_to_page's or the jumps wont work */

	function page_header( $heading, $cxn, $cxn_common, $on_load="", $dont_jump=false, $home_page=false, $bg_color="", $show_heading_bar=false )
	{

//		echo "<html><head><meta http-equiv='expires' content='".date( "D, d M Y", time() + 60*60*24*2 )." 00:00:00 GMT'>";

//		echo "<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0'><meta http-equiv='expires' content='".date( "D, d M Y", time() - 60*60*24 )." 00:00:00 GMT'>";
		
		echo "<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0'>";

                echo "<meta name=\"keywords\" content='Business,Businesses,Listing,Listings,Sale'>";

		echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
		

			/* javascript functions for chat etc. */


// commented out due to crashes. previously fully functional
//
//		write_js_functions();


			/* define styles */

		write_common_styles();
		
		$data = define_styles( $home_page );

		$bg = $data['bg'];
		$rose = $data['rose'];



		if ($bg_color != "")
			$bg = $bg_color;

		if ($heading != "")
		{
			if ($on_load != "")
				echo "<title>".$_SESSION['sitename'].": ".$heading."</title></head><body bgcolor='".$bg."' onLoad=\"".$on_load."\">";
			else
				echo "<title>".$_SESSION['sitename'].": ".$heading."</title></head><body bgcolor='".$bg."'>";
		}
		else
		{
			if ($on_load != "")
				echo "<title>".$_SESSION['sitename']."</title></head><body bgcolor='".$bg."' onLoad=\"".$on_load."\">";
			else
				echo "<title>".$_SESSION['sitename']."</title></head><body bgcolor='".$bg."'>";
		}

		if ($heading != "")
		{
            if ($show_heading_bar)
            {
            	echo "<style> html, body {";
            	echo "margin:0;";
            	echo "padding:0;";
            	echo "}";
            	echo "</style>";

        		echo "<table cellspacing='0' width='100%'><tr><td style='padding-top: 3; padding-bottom: 3; font-family: Calibri; font-size: 13pt; color: #ffffff; background-color: #004499' valign='middle' align='left'>&nbsp;&nbsp;International Businesses For Sale</td></tr></table>";
            }
            else
            {
    			echo "<table width='100%'><td width='30%'><span class='pgheading' valign='center'>".$heading."</span></td>";
    
    			if (! low_res_screen())
    			{
        			echo "<td width='10%' valign='center'><a class='redlink' href='".url_encode( "search_listings.php" )."'>search</a></td>";
        			echo "<td width='10%'></td>";
        			echo "<td width='10%' valign='center'><a class='redlink' href='".url_encode( "mailboxes.php", "box", "inbox" )."'>messages</a></td>";
        			echo "<td width='10%'></td>";
    			}
    			
    			echo "<td width='5%'></td>";
            }

			if ($show_heading_bar)
			    echo "<table width='100%'><tr>";
            
//			if (! low_res_screen())
				show_google_translate();

			if ($show_heading_bar)
			    echo "<td width='55%' align='left'></td>";
			    
    		echo "<td width='20%' align='center'>";
    		
    		show_green_button( "Home", 80, "index.php", "internaljump", "true" );
    		
    		echo "</td></tr></table>";

			echo "<br>";
		}
		else
		{
    		if (! low_res_screen() && ! $home_page)    		
			{
				echo "<table width='100%'><tr><td width='80%'></td><td>";

				show_google_translate();

				echo "</td></tr></table>";
			}
		}
				
	}

		/* define the CSS styles */

	function define_styles( $home_page )
	{
		echo "<style type='text/css'>";
//		echo "<!--";

		$color_scheme = val( $_SESSION, 'color_scheme' );

				/* standard */

//		if ($color_scheme == "" || $color_scheme == 0 || $color_scheme == 3)

		{
			if ($home_page)
				$bg = '#ffffff';
//				$bg = '#ccffff';
			else
				$bg = '#ffffff';

			$rose = "images/rose.gif";
			
			echo "body   		{ color: #000000; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo "a:visited	{color: #0000bb; text-decoration: underline}";
			echo "a:link	{color: #0000bb; text-decoration: underline}";

			if (! low_res_screen())
			{			
				echo ".mainmenuheading    { color: #cc0000; background-color: #dddddd; font-family: verdana; font-size: ".fs( 12 )."pt}";
							
				echo ".mainmenuitem		{color: #0000cc; background-color: #f3f3f3; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
				echo ".mainmenuitem:visited	{color: #0000cc; background-color: #f3f3f3; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
				echo ".mainmenuitem:link	{color: #0000cc; background-color: #f3f3f3; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
				echo ".mainmenuitem:hover	{color: #cc0000; background-color: #f3f3f3; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
			}
			else
			{
				echo ".mainmenuheading    { color: #cc0000; font-family: verdana; font-size: ".fs( 12 )."pt}";
							
				echo ".mainmenuitem		{color: #0000cc; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
				echo ".mainmenuitem:visited	{color: #0000cc; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
				echo ".mainmenuitem:link	{color: #0000cc; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
				echo ".mainmenuitem:hover	{color: green; font-size: ".fs( 12 )."pt; font-family:verdana; text-decoration:none}";
			}
			echo ".hl {cursor: pointer; color: #bb0000; background-color: #e0e0e0; font-size:".fs( 12 )."pt; font-family:verdana; text-decoration: none}";
			echo ".uhl {color: #0000bb; background-color: #f3f3f3; font-size:".fs( 12 )."pt; font-family:verdana; text-decoration: none}";

			echo ".gblack         { color: #000000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".gblue          { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".gred           { color: #bb0000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".gwatermark     { color: #999999; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".gpink          { color: #FF69B4; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".gmidgreen      { color: #008000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".gwhite         { color: #ffffff; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".ggrey          { color: #bbbbbb; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".fprompt        { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".finput         { color: #000000; padding-left: 2px; border-style: solid; border-width: 1px; border-color: #cccccc; background-color: #ffffff; font-family: verdana; font-size: ".fs( 12 )."pt}";			
			echo ".fradio         { color: #000000; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".fprompt_error  { color: #ff0000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".finput_error   { color: #000000; padding-left: 2px; border-style: solid; border-width: 1px; border-color: #cccccc; background-color: #ff9999; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".fradio_error   { color: #000000; background-color: #ff9999; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".dprompt        { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".dtext          { color: #000000; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".paraheading    { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".pgheading      { color: #0000bb; font-family: verdana; font-size: ".fs( 16 )."pt}";
			
			if (! low_res_screen())
				echo ".homeheading    { color: #0000bb; font-family: times; font-size: ".fs( 26 )."pt}";
			else
				echo ".homeheading    { color: #0000bb; font-family: times; font-size: ".fs( 20 )."pt}";
				
			echo ".glink		  { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".glink:visited  { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".glink:link     { color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".glink:hover    { color: darkgreen; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".pinklink:visited { text-decoration: none; color: #FF69B4; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".pinklink:link  { text-decoration: none; color: #FF69B4; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".pinklink:hover { text-decoration: underline; color: #FF69B4; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".redlink:visited { text-decoration: none; color: #bb0000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".redlink:link  { text-decoration: none; color: #bb0000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".redlink:hover { text-decoration: underline; color: #bb0000; font-family: verdana; font-size: ".fs( 12 )."pt}";
			
			echo ".lpinklink:visited { text-decoration: none; color: #ffd7ff; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".lpinklink:link  { text-decoration: none; color: #ffd7ff; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".lpinklink:hover { text-decoration: underline; color: #ffd7ff; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".whitelink:visited { text-decoration: underline; color: #ffffff; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".whitelink:link  { text-decoration: underline; color: #ffffff; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".whitelink:hover { text-decoration: underline; color: #ffffff; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".bluelink:visited { text-decoration: underline; color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".bluelink:link  { text-decoration: underline; color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";
			echo ".bluelink:hover { text-decoration: underline; color: #0000bb; font-family: verdana; font-size: ".fs( 12 )."pt}";

			echo ".chat		      { color: #000000; font-family: verdana; font-size: ".fs( 10 )."pt}";

		}
		

//		echo "//-->";
		echo "</style>";


			/* mouseover highlight bar */

		echo "<script>";
		echo "function hl( idx )	{	document.getElementById(idx).className = \"hl\"; }";
		echo "function uhl( idx )	{	document.getElementById(idx).className = \"uhl\"; }";
		echo "</script>";

		$data['bg'] = $bg;
		$data['rose'] = $rose;

		return ($data);
	}


		/* create a list of industries for a drop-down list */

	function build_industry_list( $cxn )
	{
//		$query = "SELECT * FROM static_data WHERE type = 'industry' ORDER BY value";
		$query = "SELECT * FROM industry ORDER BY display_name";
		
		$result = run_query( $query, $cxn );

		$industries = "<option></option>";

		for ($i=0; $i < query_num_rows($result); $i++)
		{
			$data = get_row( $result );

			$industries = $industries."<option>".$data['display_name']."</option>";
		}

		return $industries;
	}



	function show_photo( $listing_id, $height, $photo_number, $allow_zoom, $large, $cxn )
	{
		if ($photo_number == -1)
			$query = "SELECT * FROM photos WHERE listing_id = ".$listing_id." AND primary_photo = 'yes'";
		else
			$query = "SELECT * FROM photos WHERE listing_id = ".$listing_id." AND photo_number = ".$photo_number;

		$result = run_query( $query, $cxn );

		if (query_num_rows($result) == 0)
		{
			if ($height == 120)
				$filename = url_encode_file( "photos/v1_no_photo_120.gif" );
			else
			if ($height == 100)
				$filename = url_encode_file( "photos/v1_no_photo_100.gif" );
			else
			if ($height == 80)
				$filename = url_encode_file( "photos/v1_no_photo_80.gif" );
			else
				$filename = url_encode_file( "photos/v1_no_photo_100.gif" );
				
			echo "<img src='".$filename."' width='".$height."' height='".$height."'>";
		}
		else
		{
			$data = get_row( $result );

			$width = $height * $data['aspect_ratio'];
			
			$version = $data['version'];
			
			
			    // allow for revised versions of photos due to rotating them etc.
			    
			if ($version == "")
			    $version_str = "";
			else
			    $version_str = "_v".$version;

			if ($large)
				$filename = "/photos/photo_".$listing_id."_".$data['photo_number']."_l".$version_str.".".$data['file_extension'];
			else
				$filename = "/photos/photo_".$listing_id."_".$data['photo_number']."_sm".$version_str.".".$data['file_extension'];

			if ($allow_zoom)
			{
				echo "<a href='".url_encode( "show_large_photo.php", "showid", $listing_id, "photonumber", $photo_number )."'>";
				echo "<img alt='Member Photo' src='".url_encode_file( $filename )."' width='".$width."' height='".$height."' border='0'>";
				echo "</a>";
			}
			else
				echo "<img alt='Member Photo' src='".url_encode_file( $filename )."' width='".$width."' height='".$height."'>";
		}
	}



//	function show_photo( $listing_id, $height, $photo_number, $allow_zoom, $large, $cxn )
//	{
//		if ($photo_number == -1)
//			$query = "SELECT * FROM photos WHERE listing_id = ".$listing_id." AND primary_photo = 'yes'";
//		else
//			$query = "SELECT * FROM photos WHERE listing_id = ".$listing_id." AND photo_number = ".$photo_number;
//
//		$result = run_query( $query, $cxn );
//
//		if (query_num_rows($result) == 0)
//		{
//			if ($height == 120)
//				$filename = url_encode_file( "photos/v1_no_photo_120.gif" );
//			else
//			if ($height == 100)
//				$filename = url_encode_file( "photos/v1_no_photo_100.gif" );
//			else
//			if ($height == 80)
//				$filename = url_encode_file( "photos/v1_no_photo_80.gif" );
//			else
//				$filename = url_encode_file( "photos/no_photo.gif" );
//
//			echo "<img src='".$filename."' width='".$height."' height='".$height."'>";
//		}
//		else
//		{
//			$data = get_row( $result );
//
//			$width = $height * $data['aspect_ratio'];
//
//			if ($large)
////				$filename = "/photos/photo_".$member_id."_".$data['photo_number'].".".$data['file_extension'];
//
//				$filename = "/photos/photo_".$listing_id."_".$data['photo_number']."_l.".$data['file_extension'];
//			else
//				$filename = "/photos/photo_".$listing_id."_".$data['photo_number']."_sm.".$data['file_extension'];
//
//			if ($allow_zoom)
//			{
//				echo "<a href='".url_encode( "show_large_photo.php", "showid", $listing_id, "photonumber", $photo_number )."'>";
//				echo "<img src='".url_encode_file( $filename )."' width='".$width."' height='".$height."' border='0'>";
//				echo "</a>";
//			}
//			else
//				echo "<img src='".url_encode_file( $filename )."' width='".$width."' height='".$height."'>";
//		}
//	}



	function show_listing_number( $listing_id, $returnpoint, $startpos )
	{
		if ($startpos == "")
			$startpos = "x";

		$url = url_encode( "display_listing.php", "showid", $listing_id, "returnpoint", $returnpoint, "startpos", $startpos );

		return ("<a href='".$url."'><span class='glink'>".$listing_id."</span></a>");
	}


	function show_listing_heading( $listing_id, $headline_title, $returnpoint, $startpos )
	{
		if ($startpos == "")
			$startpos = "x";

		$url = url_encode( "display_listing.php", "showid", $listing_id, "returnpoint", $returnpoint, "startpos", $startpos );

		return ("<a class='glink' href='".$url."'>".$headline_title."</a>");
	}



		// don't put in the common library because there is a different tracking ID for each site
		
		// currently uses the Academic Dating tracking ID
		
	function show_google_translate()
        {
            echo "<td width='15%' valign='top'>";
            echo ' <div id="google_translate_element"></div><script type="text/javascript"> ';
            echo ' function googleTranslateElementInit() { ';
//            echo " new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, gaTrack: true, gaId: 'UA-97849346-2'}, 'google_translate_element'); ";
            echo " new google.translate.TranslateElement({pageLanguage: 'en', gaTrack: true, gaId: 'UA-97849346-2'}, 'google_translate_element'); ";            
            echo ' } ';
            echo ' </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> ';
            echo "</td>";
        }



		// Don't put this function in the common library because it's different for SSL and non SSL connections
		
		/* log into the database and return the connection */
		

	function db_login( $database )
	{
			// azure login credentials
		
//		$host="mlmlocalhost.mysql.database.azure.com";
//		$user="mlm1@mlmlocalhost";
//		$password="Tree$%12";
		
		$host="localhost";
		$user="academi1_mlm1";
		$password="plastic1";

//		if (val( $_SESSION, "site_cxn" ) != "")
//			$cxn = val( $_SESSION, "site_cxn" );
//		else

		{
//			$cxn = mysql_connect( $host, $user, $password );			
//			$cxn = mysql_connect( $host, $user, $password, false, MYSQL_CLIENT_SSL );

            $cxn = new mysqli( $host, $user, $password, $database );
	
			if ($cxn->connect_errno)
			{
				echo "The system is currently unavailable.<br><br>Please try again in half an hour.";
				
				echo "Error number: ".$cxn->connect_errno."<br>";
				echo "Error text: ".$cxn->connect_error."<br>";

				exit();
			}
	
//			if ($cxn === false)
//			{
//				echo "The system is currently unavailable.<br><br>Please try again in half an hour.";
//				exit();
//			}
//	
//			$stat = mysql_select_db( $database, $cxn );
//			
//			if ($stat == false)
//			{
//				$error = mysql_error( $cxn );
//				
//				echo "ERROR: can't connect to database: ".$error."<br><br>";
//			}

//			$_SESSION['site_cxn'] = $cxn;
		}
				
		return $cxn;
	}




		// Log into the common database. Must happen AFTER the login to the normal local database $cxn as it's set up for this
		// function only to create a second connection
		
	function db_common_login()
	{
		$host="localhost";
		$user="academi1_mlm1";
		$password="plastic1";


//		if (val( $_SESSION, "site_cxn_common" ) != "")
//			$cxn_common = val( $_SESSION, "site_cxn_common" );
//		else

		{
            $cxn_common = new mysqli( $host, $user, $password, "academi1_commondata" );
          
			if ($cxn_common->connect_errno)
			{
				echo "The system is currently unavailable.<br><br>Please try again in half an hour.";
				
				echo "Error number: ".$cxn_common->connect_errno."<br>";
				echo "Error text: ".$cxn_common->connect_error."<br>";

				exit();
			}


//			$cxn_common = mysql_connect( $host, $user, $password, true );			// 'true' to establish a second connection after $cxn. doesn't work without this
//            
//			if ($cxn_common === false)
//			{
//				echo "The system is currently unavailable.<br><br>Please try again in half an hour.";
//				exit();
//			}
//	
//			$stat = mysql_select_db( "academi1_commondata", $cxn_common );
//			
//			if ($stat == false)
//			{
//				$error = mysql_error( $cxn_common );
//				
//				echo "ERROR: can't connect to database: ".$error."<br><br>";
//			}

//			$_SESSION['site_cxn_common'] = $cxn_common;
		}
				
		return $cxn_common;
	}	


		/* send an email to a member */

	function send_external( $to_id, $subject, $text_body, $html_body, $cxn, $cxn_common, $queue )
	{
		$from_name = $_SESSION['sitename'];
		$from_addr = "noreply@intbusinessesforsale.net";
		$reply_name = $_SESSION['sitename'];
		$reply_addr = "noreply@intbusinessesforsale.net";

		$query = "SELECT email_address FROM account WHERE id = ".$to_id;

		$result = run_query( $query, $cxn );

		$data = get_row( $result );

			/* for prod use the live address, otherwise redirect */

		$domain = val( $_SERVER, "HTTP_HOST" );

		$to_addr = $data['email_address'];


		send_email( $from_name, $from_addr, $to_addr, $reply_name, $reply_addr, $subject, $text_body, $html_body, $cxn, $cxn_common, $queue );

//	    send_email_actual( $from_name, $from_addr, $to_addr, $reply_name, $reply_addr, $subject, $text_body, $html_body, $cxn );


		return ($to_addr);
	}


	function additional_screen_initialisations( $id, $newrecord, $form_name, $table_name, &$screen_data, $cxn, $cxn_common )
	{
	
		if ($form_name == "ibfs_account")
		{
			$screen_data['confirm_email_address'] = $screen_data['email_address'];
			
			$screen_data['confirm_password'] = $screen_data['password'];
			
			if ($newrecord == "false")
				$screen_data['accepts_conditions'] = "on";
		}
		
	}


	function additional_validations( $id, $form_name, $newrecord, &$validation_errors, &$screen_data, &$screen_data_error, $cxn, $cxn_common )
	{
		
//		$handle = $screen_data['handle'];
//		
//		if ($handle != "")
//		{
//			if (! check_handle( $newrecord, $handle, $id, $cxn ))
//			{
//				$validation_errors = $validation_errors."This handle name has already been used by an existing member<br>";
//				$screen_data_error['handle'] = "true";
//			}
//		}
		

		if ($form_name == "ibfs_account" || $form_name == "ibfs_listing")
		{
			if ($screen_data['accepts_conditions'] != "on")
			{
				$validation_errors = $validation_errors."You must tick the checkbox at the bottom of the page signifying that you accept the conditions of use of this website.<br>";
	
				$screen_data_error['accepts_conditions'] = "true";
			}
		}
		
	}


		// don't delete this function it is called by the general save function
		
	function additional_changes_before_database_save( $id, $newrecord, $form_name, $table_name, &$screen_data, $cxn, $cxn_common )
	{
	}


	function show_ads( $cxn )
	{
		echo "<table width='100%'><tr><td align='center'>\n";

			// 'repsonsive' ad a unit that adjusts to page size

		echo "<script async src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>\n";
		echo "<!-- New Ads 2 (International Businesses For Sale) -->\n ";
		echo "<ins class='adsbygoogle'\n";
		echo "style='display:block'\n";
		echo "data-ad-client='ca-pub-7728790744816510'\n";
		echo "data-ad-slot='2971722203'\n";
		echo "data-ad-format='auto'></ins>\n";
		echo "<script>\n";
		echo "(adsbygoogle = window.adsbygoogle || []).push({});\n";
		echo "</script>\n";

		echo "</td></tr></table>\n";
	}



	function show_ads_narrow_banner()
	{
		echo "<table width='100%'><tr><td align='center'>\n";

		echo "<script async src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>\n";
		echo "<!-- New Ads 2 Narrow Banner (International Businesses For Sale) -->\n ";
		echo "<ins class='adsbygoogle'\n";
		echo "style='display:block'\n";
		echo "data-ad-client='ca-pub-7728790744816510'\n";
		echo "data-ad-slot='8543613087'\n";
		echo "data-ad-format='auto'></ins>\n";
		echo "<script>\n";
		echo "(adsbygoogle = window.adsbygoogle || []).push({});\n";
		echo "</script>\n";

		echo "</td></tr></table>\n";
	}



		// don't put in the common library because different sites have different color schemes
		
	function form_start( $handler, $param1="", $value1="", $param2="", $value2="", $param3="", $value3="" )
	{
			//lightskyblue  #cceeff azure
			// lighter color first
			
		echo "<form id='form' name='form' action='".url_encode( $handler, $param1, $value1, $param2, $value2, $param3, $value3 )."' method='POST'><table style='border: 1px solid #bbbbbb; background: linear-gradient(#fcfcfc, #fcfcfc)'>\n";

	}

        // show the menu bar for the FAQ, Policies etc pages
        
	function show_info_menu( $cxn )
	{
		$bg = "#73b8bb";

        echo "<style>";
        echo "table.infomenubartable td {";
        echo "    color: #000000;";
//        echo "    line-height: 25pt;";
        echo "    font-size: ".fs( 12) ."pt;";
        echo "    font-family:verdana;";
        echo "    background-color: #73b8bb;";
        echo "}";
        
        echo "table.infomenubartable td:hover {";
        echo "      background-color: #eeeeee;";
        echo "      cursor: pointer;";
        echo "}";        
        echo "</style>";

		echo "<table class='infomenubartable' width='100%' border='0' cellspacing='0'>";

		echo "<tr bgcolor='".$bg."' >";

		echo show_one_info_menu_item( "FAQ", "faq.php" );
		
		echo show_one_info_menu_item( "Policies", "policies.php" );		
		
		echo show_one_info_menu_item( "Costs", "charges.php" );		

		echo show_one_info_menu_item( "About Us", "about_us.php" );		

		echo show_one_info_menu_item( "Contact Us", "contact_us.php" );		
		
//		echo show_one_info_menu_item( "Tips", "tips.php" );

		echo "</tr>";

		echo "</table>";
	}


        // show one item on the information menu bar
        
	function show_one_info_menu_item( $prompt, $page )
	{
		return "<td height='40' style='background-color: #73b8bb' width='4%'></td><td width='6%' align='center' onclick='location.href=\"".url_encode( $page )."\"'>".$prompt."</td><td style='background-color: #73b8bb' width='4%'></td>";
	}

