// ajax loading image function	
	var loaded = false;
  function startLoading() {
    loaded = false;
    window.setTimeout('showLoadingImage()', 10);
  }

  function showLoadingImage() {
    var el = document.getElementById("loading_box");
    if (el && !loaded) {
        el.innerHTML = '<img src="http://localhost/shiplands/images/spinner.gif">';
       // document.getElementById('loading_box').style.display = 'block';
				//new Effect.Appear('loading_box');
				
    }
  }
	
	 function stopLoading() {
    //document.getElementById('loading_box').style.display = 'none';
		Element.hide('loading_box');
		loaded = true;
  };
	
	Ajax.Responders.register({
    onCreate : startLoading,
    onComplete : stopLoading
  });
// ajax loading image function
	
	

// ajax for advance search
   var request = false;
   try {
     request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         request = false;
       }  
     }
   }

   if (!request)
     alert("Error initializing XMLHttpRequest!");

   function getAdvanceSearchBox() {
   var id = document.getElementById("searchby").value;
   var url = "http://localhost/shiplands/views/modules/advance_search_loaded.php?searchby=" + escape(id);
	 request.open("GET", url, true);
	 request.onreadystatechange = updatePage;
	 request.send(null);
   }
 
  function updatePage() {
	  if(request.readyState == 1)
      {
        var pic = document.getElementById( 'loading' );
        pic.src = "http://localhost/shiplands/images/spinner.gif";
				document.getElementById("searchload").innerHTML = '';
			} 
			
     if (request.readyState == 4) {
       if (request.status == 200) {
         var response = request.responseText.split("|");
				 
				  var pic = document.getElementById( 'loading' );
        	pic.src = "http://localhost/shiplands/images/spacer.gif";
			
	//		new Effect.SlideDown('yahoo');
		//	new Effect.Highlight('yahoo');
			document.getElementById("searchload").innerHTML = response;
		 		
			
       } else
         alert("status is " + request.status);
     }
   }

// ajax for advance search




// ajax for email alerts system
   var request = false;
   try {
     request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         request = false;
       }  
     }
   }

   if (!request)
     alert("Error initializing XMLHttpRequest!");

   function getEmailAlertBox() {
   var id = document.getElementById("searchby").value;
   var url = "http://localhost/shiplands/views/modules/emailalert_search_loaded.php?searchby=" + escape(id);
	 request.open("GET", url, true);
	 request.onreadystatechange = updatePage;
	 request.send(null);
   }
 
  function updatePage() {
	  if(request.readyState == 1)
      {
        var pic = document.getElementById( 'loading' );
        pic.src = "http://localhost/shiplands/images/spinner.gif";
				document.getElementById("searchload").innerHTML = '';
			} 
			
     if (request.readyState == 4) {
       if (request.status == 200) {
         var response = request.responseText.split("|");
				 
				  var pic = document.getElementById( 'loading' );
        	pic.src = "http://localhost/shiplands/images/spacer.gif";
			
	//		new Effect.SlideDown('yahoo');
		//	new Effect.Highlight('yahoo');
			document.getElementById("searchload").innerHTML = response;
		 		
			
       } else
         alert("status is " + request.status);
     }
   }

// ajax for email alerts system

// ajax to load the email alert step two with forms varibles
function GetEmailAlertStepTwo()
	{
		var url = 'http://localhost/shiplands/views/modules/emailalerts-two.php';
		var pars = Form.serialize($("GetTwo"));
		var myAjax = new Ajax.Request( url, { method: 'get', parameters : pars, onComplete: ShowNewPage });
		}
		function ShowNewPage(originalRequest)
		{	document.getElementById('emailalertbox').innerHTML = originalRequest.responseText; }
// ajax to load the email alert step two with forms varibles


// ajax to load the email alert step three with forms varibles
function GetEmailAlertStepThree()
	{
		var url = 'http://localhost/shiplands/views/modules/emailalerts-three.php';
		var pars = Form.serialize($("GetThree"));
		var myAjax = new Ajax.Request( url, { method: 'get', parameters : pars, onComplete: ShowNewPage1 });
		}
		function ShowNewPage1(originalRequest)
		{	document.getElementById('emailalertbox').innerHTML = originalRequest.responseText; }
// ajax to load the email alert step three with forms varibles



// ajax to load the packages and form varibles
function GetMemberPackages()
	{
		var url = 'http://localhost/shiplands/views/ajax/packagechoose-two.php';
		var pars = Form.serialize($("package"));
		var myAjax = new Ajax.Request( url, { method: 'get', parameters : pars, onComplete: ShowNewPage2 });
		}
		function ShowNewPage2(originalRequest)
		{	document.getElementById('loadform').innerHTML = originalRequest.responseText; }
// ajax to load the email alert step two with forms varibles



// ajax for vertical search bar
function getAdvanceSearchBoxVertical() {
   var id = document.getElementById("searchby").value;
   var url = "http://localhost/shiplands/views/modules/advance_search_loaded_vertical.php?searchby=" + escape(id);
	 request.open("GET", url, true);
	 request.onreadystatechange = updatePage;
	 request.send(null);
   }
 
  function updatePage() {
	  if(request.readyState == 1)
      {
        var pic = document.getElementById( 'loading' );
        pic.src = "http://localhost/shiplands/images/spinner.gif";
				document.getElementById("searchload").innerHTML = '';
			} 
			
     if (request.readyState == 4) {
       if (request.status == 200) {
         var response = request.responseText.split("|");
				 
				  var pic = document.getElementById( 'loading' );
        	pic.src = "http://localhost/shiplands/images/spacer.gif";
			
	//		new Effect.SlideDown('yahoo');
		//	new Effect.Highlight('yahoo');
			document.getElementById("searchload").innerHTML = response;
			}
			
			else
        { alert("status is " + request.status); }
     }
   }
	 

// ajax for vertical search bar


// ajax for inline popups
Pop = {timer : null, current : null};
Pop.getStyle = function(name)
{
    if(document.getElementById) return document.getElementById(name).style;
    else if(document.all) return document.all[name].style;
    else if(document.layers) return document.layers[name];
}
Pop.show = function(name)
{
    if(this.timer) clearTimeout(this.timer);
    this.getStyle(name).visibility = "visible";
    this.current = name;
}
Pop.hide = function()
{
    this.timer = setTimeout("Pop.doHide()",0);
}
Pop.doHide = function()
{
    if(this.current)
    {
        this.getStyle(this.current).visibility = "hidden";
        this.current = null;
    }
}
// ajax for inline popups


// ajax to load the current packages
function GLoadMemberPackages()
	{
			//document.getElementById('ss').innerHTML = 'Loading...';
     new Ajax.Updater('contentload', 'http://localhost/shiplands/views/modules/upgrade_package-one.php', {asynchronous:true});
	}
// ajax to load the current packages for admin
function GLoadMemberPackages2()
	{
			//document.getElementById('ss').innerHTML = 'Loading...';
     new Ajax.Updater('contentload', 'http://localhost/shiplands/views/modules/upgrade_package-one2.php', {asynchronous:true});
	}

// ajax to load the forget password thing on header
function LoadForgetPassHeader()
	{
			//document.getElementById('ss').innerHTML = 'Loading...';
     new Ajax.Updater('login-box', 'http://localhost/shiplands/views/ajax/forgetpassword_header.php', {asynchronous:true});
	}
// ajax to load the forget password thing on header


// ajax to load page
function LoadThePageInDIV(divname, pagename)
{
	new Ajax.Updater(divname, 'http://localhost/shiplands/members/'+pagename+'.php', {asynchronous:true});
}
// ajax to load page


// ajax to go back
function LoadTheBackPageMyItems()
{
	new Ajax.Updater('boom2page1', 'http://localhost/shiplands/views/modules/my_posted_items.php?headerinfo=yes', {asynchronous:true});
}


// ajax to make total for the packages
function GetTotalofPackages()
		{
		var url = 'http://localhost/shiplands/views/ajax/makepricetotal.php';
		var pars = Form.serialize($("package"));
		var myAjax = new Ajax.Request( url, { method: 'post', asynchronous : true, contentType : 'application/x-www-form-urlencoded',  parameters : pars, onComplete: ShowTotalRefresh });
		}
		function ShowTotalRefresh(originalRequest)
		{	document.getElementById('totalprice').innerHTML = originalRequest.responseText; }
// ajax to make total for the packages




// ajax to load the packages and form varibles
function GetMemberPackagesInline()
	{
		var url = 'http://localhost/shiplands/views/modules/upgrade-package-two.php';
		var pars = Form.serialize($("formid"));
		var myAjax = new Ajax.Request( url, { method: 'get', parameters : pars, onComplete: ShowNewPage255 });
		}
		function ShowNewPage255(originalRequest)
		{	document.getElementById('loadform').innerHTML = originalRequest.responseText; }
// ajax to load the email alert step two with forms varibles

// ajax to load the packages and form varibles for admin
function GetMemberPackagesInline2()
	{
		var url = 'http://localhost/shiplands/views/modules/upgrade-package-two2.php';
		var pars = Form.serialize($("formid"));
		var myAjax = new Ajax.Request( url, { method: 'get', parameters : pars, onComplete: ShowNewPage255 });
		}
		function ShowNewPage255(originalRequest)
		{	document.getElementById('loadform').innerHTML = originalRequest.responseText; }
// ajax to load the email alert step two with forms varibles


// ***** SHORTLIST **************************************************************************************
// insert to ship for sale fav
function ShipSaleAddToFav(shipid, md5hash)
	{
		$('l'+shipid).innerHTML = '<a href="javascript:ShipSaleDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_ship_sale_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for sale fav
	
	// inser to ship for pruchase to fav
	function ShipPurAddToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipPurDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_ship_purchase_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for pruchase to fav
	
		// inser to ship for open vessel
	function OpenVesselAddToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:OpenVesselDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_openvessels_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for open vessel
	
	// inser to ship for Cargo TC
	function CargoTCAddToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:CargoTCDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_cargotc_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for Cargo TC
	
	// inser to ship for Shipyard
	function ShipyardAddToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipyardDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_shipyard_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for Shipyard
	
	// inser to ship for Shipbuilding
	function ShipbuildingAddToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipbuildingDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_shipbuilding_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for Shipbuilding	
	
		// inser to ship for Shipbusiness
	function ShipbusinessAddToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipbusinessDeleteToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-shortlist-icon.gif" alt="Remove From Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_shipbusiness_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// inser to ship for Shipbusiness	
	
	// **** DELETE *****
	
		// delete the shortlist list for Shipbusiness
		function ShipbusinessDeleteToFav(shipid, md5hash)
	{
		$('l'+shipid).innerHTML = '<a href="javascript:ShipbusinessAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_shipbusiness_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	
	}
	// delete the shortlist list for Shipbusiness
	
		
		// delete the shortlist list for ship for sale
		function ShipbuildingDeleteToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipbuildingAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_shipbuilding_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// delete the shortlist list for ship for sale
	
	
	// delete the shortlist list for ship for sale
		function ShipSaleDeleteToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipSaleAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_ship_sale_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// delete the shortlist list for ship for sale
	
		// delete the shortlist list for ship for purchase
		function ShipPurDeleteToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipPurAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_ship_purchase_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// delete the shortlist list for ship for purchase
	
	// delete the shortlist list for Cargo TC
		function CargoTCDeleteToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:CargoTCAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_cargotc_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// delete the shortlist list for Cargo TC
		
		// delete the shortlist list for open vessel
		function OpenVesselDeleteToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:OpenVesselAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_openvessels_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// delete the shortlist list for openvessel
	
		// delete the shortlist list for Shipyard
		function ShipyardDeleteToFav(shipid, md5hash)
	{
    $('l'+shipid).innerHTML = '<a href="javascript:ShipyardAddToFav(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-shortlist-icon.gif" alt="Add To Shortlist" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/add_shipyard_ajax_shortlist.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E6EFF8', endcolor:'#FFFFFF'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	// delete the shortlist list for Shipyard
	
// ***** SHORTLIST **************************************************************************************	
	
// ship for sale form loading things
function ShowFormDIV(mainvessel, addmethod)
	{
		var mainvessel = $F(mainvessel);
		var addmethod = $F(addmethod);
		var url = 'http://localhost/shiplands/views/ajax/shipforsale_formdisplay_ajax.php';
		var pars = 'mainvessel='+mainvessel+'&addmethod='+addmethod+'';
		var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: ShowForm });
	}
	
	function ShowFormDIV(maineq, addmethod)
	{
		var maineq = $F(maineq);
		var addmethod = $F(addmethod);
		var url = 'http://localhost/shiplands/views/ajax/shipforsale_formdisplay_ajax.php';
		var pars = 'maineq='+maineq+'&addmethod='+addmethod+'';
		var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: ShowForm });
	}
	
	function ShowForm(originalRequest)
	{
		new Effect.Appear(('loadedform'), {duration:1});
		document.getElementById('loadedform').innerHTML = originalRequest.responseText;
	}
// ship for sale form loading things
	
	
// ship for sale basic / advace combo box function
function S4SAddMode(addmethod)
	{
		var addmethod = $F(addmethod);
			
			if (addmethod = 'normal')
			{
				document.getElementById('loadedform').style.display = 'none';
			}
	}
	function searching(){

  document.getElementById('loading_box').style.display = "block";
  }

// set vessle types and subtypes

var ajax = new sack();

function getVesselSubs(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('subvessletype').options.length = 0;	// Empty main vessel types select box
	if(countryCode.length>0){
		ajax.requestFile = 'http://localhost/shiplands/views/modules/vessle_types_for_sale.php?cat='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createSubtypes;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function geteqSubs(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('subvessletype').options.length = 0;	// Empty main vessel types select box
	if(countryCode.length>0){
		ajax.requestFile = 'http://localhost/shiplands/views/modules/eq_types_for_sale.php?cat='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createSubtypes;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function getoilSubs(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('subvessletype').options.length = 0;	// Empty main vessel types select box
	if(countryCode.length>0){
		ajax.requestFile = 'http://localhost/shiplands/views/modules/eqoil_types_for_sale.php?cat='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createSubtypes;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function getmailSubs(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('subvessletype').options.length = 0;	// Empty main vessel types select box
	if(countryCode.length>0){
		ajax.requestFile = 'http://localhost/shiplands/views/modules/mail_types_for_sale.php?cat='+countryCode;	// Specifying which file to get
		ajax.onCompletion = createSubtypes;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createSubtypes()
{
	var obj = document.getElementById('subvessletype');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}
// set vessle types and subtypes


// engine types and models

var ajax = new sack();

function getEngineModels(sel)
{
	var EngineMaker = sel.options[sel.selectedIndex].value;
	document.getElementById('engine_model').options.length = 0;	// Empty main vessel types select box
	if(EngineMaker.length>0){
		ajax.requestFile = 'http://localhost/shiplands/views/modules/engine_makers_models.php?engine_maker='+EngineMaker;	// Specifying which file to get
		ajax.onCompletion = createSubEginesModels;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createSubEginesModels()
{
	var obj = document.getElementById('engine_model');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}
// engine types and models


// ****** CART FUNCTIONS ******************************************************************************************

// insert to ship for sale to cart
function AddShip4SaleToCart(shipid, md5hash)
	{
    
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteShip4SaleToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		
		var url = 'http://localhost/shiplands/views/ajax/functions_shipforsale_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	
	
// insert to open vessel to cart
function AddOpenVesselToCart(shipid, md5hash)
	{
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteOpenVesselToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_openvessel_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// insert to open vessel to cart


// insert to open vessel to cart
function AddCargoTCToCart(shipid, md5hash)
	{
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteCargoTCToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_cargotc_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// insert to open vessel to cart


// insert to shipyard to cart
function AddShipyardToCart(shipid, md5hash)
	{
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteShipyardToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_shipyard_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// insert to shipyard to cart

// insert to Shipbuilding to cart
function AddShipbuildingToCart(shipid, md5hash)
	{
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteShipbuildingToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_shipbuilding_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// insert to shipyard to cart

// insert to Shipbusiness to cart
function AddShipbusinessToCart(shipid, md5hash)
	{
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteShipbusinessToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_shipbusiness_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// insert to shipyard to cart

// delete the Shipbuilding from cart	
function DeleteShipbusinessToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddShipbusinessToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_shipbusiness_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the Shipbuilding from cart


// delete the Shipbuilding from cart	
function DeleteShipbuildingToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddShipbuildingToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_shipbuilding_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the Shipbuilding from cart



// delete the Shipyard from cart	
function DeleteShipyardToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddShipyardToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_shipyard_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the shipyard from cart




// delete the open vessel from cart	
function DeleteOpenVesselToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddOpenVesselToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_openvessel_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the open vessel from cart

// delete the cargo and tc to cart
function DeleteCargoTCToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddCargoTCToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
		var url = 'http://localhost/shiplands/views/ajax/functions_cargotc_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the open vessel from cart


// delete the ship for sale from cart	
function DeleteShip4SaleToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddShip4SaleToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
	
		var url = 'http://localhost/shiplands/views/ajax/functions_shipforsale_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the ship for sale from cart


// delete the item from cart and table row too
function DeleteCartRow(itemcode, md5hash, secategory)
	{
	var url = 'http://localhost/shiplands/views/ajax/functions_cart.php';
	var pars = 'itemcode='+itemcode+'&md5hash='+md5hash+'&action=deleterow&secategory='+secategory;
	//new Effect.Highlight($('d'+itemcode), {duration:3, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
new Effect.Highlight($('d'+itemcode), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
document.getElementById('d'+itemcode).style.display = "none";
//alert("Item has been deleted.");
	}
// delete the item from cart and table row too


// delete the item from shortlist and table row too
function DeleteShortlistRow(itemcode, md5hash, secategory)
{

var url = 'http://localhost/shiplands/views/ajax/functions_shortlist.php';
var pars = 'itemcode='+itemcode+'&md5hash='+md5hash+'&action=deleterow&secategory='+secategory;
//new Effect.Highlight($('d'+itemcode), {duration:3, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
new Effect.Highlight($('d'+itemcode), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
document.getElementById('d'+itemcode).style.display = "none";
}
// delete the item from shortlist and table row too



// insert to ship for purchase to cart
function AddShip4PurchaseToCart(shipid, md5hash)
	{
    
		$('c'+shipid).innerHTML = '<a href="javascript:DeleteShip4PurchaseToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/remove-cart-icon.gif" alt="Remove From Cart" border="0" /></a>';
		
		var url = 'http://localhost/shiplands/views/ajax/functions_shipfopurchase_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=add';
		
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
	
	// delete the ship for Purchase from cart
	
function DeleteShip4PurchaseToCart(shipid, md5hash)
	{
	$('c'+shipid).innerHTML = '<a href="javascript:AddShip4PurchaseToCart(&#39;'+shipid+'&#39;, &#39;'+md5hash+'&#39;)"><img src="http://localhost/shiplands/images/add-cart-icons.gif" alt="Add To Cart" border="0" /></a>';
	
		var url = 'http://localhost/shiplands/views/ajax/functions_shipfopurchase_cart.php';
		var pars = 'shipid='+shipid+'&md5hash='+md5hash+'&action=delete';
		
		new Effect.Highlight($('d'+shipid), {duration:2, startcolor:'#E9F4F9', endcolor:'#F6F6F6'});
		
		var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars});
	}
// delete the ship for Purchase from cart

// ****** CART FUNCTIONS ******************************************************************************************


// checking user name exists or not
    function check_user_exist() {
        
				//var username = $F(username);
				var username = document.getElementById('username1').value;
				var url = 'http://localhost/shiplands/views/ajax/check_username_ajax.php';
				var pars = 'username='+username;
        var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete: ShowUSRmsg });
	}
	
	function ShowUSRmsg(originalRequest)
	{
		//new Effect.Appear(('userinfo'), {duration:3});
		document.getElementById('userinfo').innerHTML = originalRequest.responseText;
	}
// checking user name exists or not