/*********************************************
**
** Payment / PayPal Related
**
************************************************/

function closePaypal()
{
  self.opener.location = "http://www.tropicalflowerfarm.com";
  self.opener.focus();
  self.close();
}

/**********************/

function closeWindowMessage()
{
  document.write('Close this window and return to TropicalFlowerFarm.com by clicking below.<p><a href="javascript: closePaypal();">Close this Window</a>');
}


/**************************************************************
**
** used for checking CONTACT US message
**
******************************************************************/

function checkContactInfo()
{
if ((document.contactinfo.user_realname.value == '') ||
    (document.contactinfo.user_email.value == '') ||
    (document.contactinfo.msg.value == ''))
  {
    alert('Please provide values for all required fields');
    return false;
  }

else
  return true;
}

function submitContactInfo()
{
  if (checkContactInfo())
  {
    document.contactinfo.redirect.value = 'http://www.tropicalflowerfarm.com'; /* return user to HOME page */
    alert('Thank you for your message. We will get back to you ASAP. Please continue to browse through our web site.');
    return true;
  }
  
  else
    return false;
    
} /* submitContactInfo */


/**************************************************************
**
** used for checking WEBSITE COMMENTS message
**
******************************************************************/

function checkWebsiteComments()
{
if ((document.commentform.user_realname.value == '') ||
    (document.commentform.user_email.value == '') ||
    (document.commentform.location.value == '') ||
    (document.commentform.comments.value == ''))
  {
    alert('Please provide values for all required fields');
    return false;
  }

else
  return true;
}

function submitWebsiteComments()
{
  if (checkWebsiteComments())
  {
    document.commentform.redirect.value = 'http://www.tropicalflowerfarm.com'; /* return user to HOME page */
    alert('Thank you for your comments. Your comments should be posted within 24 hours. Please continue to browse through our web site.');
    return true;
  }
  
  else
    return false;
    
} /* submitWebsiteComments */

/**************************************************************
**
** used for checking SUBSCRIPTION info
**
******************************************************************/

function checkSubscription()
{
if (document.subscription.user_email.value == '')
  {
    alert('Please provide your email address');
    return false;
  }

else
  return true;
}

/****/

function submitSubscription()
{
  if (checkSubscription())
  {
    document.subscription.redirect.value = location.href; /* return user to same page */
    alert('Thank you for subscribing. Please continue to browse through our web site.');
    return true;
  }
  
  else
    return false;
    
} /* submitSubscription */

/**************************************************************
**
** used for checking LINK SUGGESTION info
**
******************************************************************/

function checkLinkSuggestion()
{
if ((document.linksuggestion.user_email.value == '') ||
    (document.linksuggestion.user_realname.value == '') ||
    (document.linksuggestion.sitetitle.value == '') ||
    (document.linksuggestion.siteurl.value == '') ||
    (document.linksuggestion.sitedescrip.value == '') ||
    (document.linksuggestion.recipurl.value == '')
   )
  {
    alert('Please provide values for all required fields');
    return false;
  }

else
  return true;
}

/****/

function submitLinkSuggestion()
{
  if (checkLinkSuggestion())
  {
    document.linksuggestion.redirect.value = 'http://www.tropicalflowerfarm.com/'; /* return user to HOME page */
    alert('Thank you for your suggestion. We will contact once we have reviewed your suggestion. Please continue to browse through our web site.');
    return true;
  }
  
  else
    return false;
    
} /* submitLinkSuggestion */


/**************************************************************
**
** used for randomizing ads
**
******************************************************************/
// original content taken from Nic's JavaScript Page with permission
// lack of these three lines will result in copyright infringment
// made by: Nic's JavaScript Page - http://www.javascript-page.com

var currentdate = 0;
var core = 0;

function initArray() {

this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
  }
}

/**********/

function showAd()
{
link = new initArray(
"http://www.tropicalflowerfarm.com/catalog/heliconia.html",
"http://www.tropicalflowerfarm.com/catalog/ginger.html",
"http://www.tropicalflowerfarm.com/catalog/fragrant.html",
"http://home.coqui.net/tciendre/",
"http://www.mozilla.org/products/firefox/",
"http://www.mozilla.org/products/thunderbird/",
"http://www.nslplus.com/",
"skype",
"http://www.exoticgardening.com/index.php",
"http://www.exoticrainforest.com/"
);

image = new initArray(
"http://www.tropicalflowerfarm.com/banner-ads/got-heliconias-120x270.jpg",
"http://www.tropicalflowerfarm.com/banner-ads/got-gingers-120x270.jpg",
"http://www.tropicalflowerfarm.com/banner-ads/got-fragrance-120x270.jpg",
"http://www.tropicalflowerfarm.com/banner-ads/zing-soc-pr.jpg",
"http://www.tropicalflowerfarm.com/banner-ads/rediscover.png",
"http://www.tropicalflowerfarm.com/banner-ads/reclaimyourinbox_small.png",
"http://www.tropicalflowerfarm.com/banner-ads/nsl-sp.jpg",
"skype",
"http://www.tropicalflowerfarm.com/banner-ads/exotic-gardening.jpg",
"http://www.tropicalflowerfarm.com/banner-ads/exotic-rainforest.jpg"
);

text = new initArray(
"Tropical Flower Farm",
"Tropical Flower Farm",
"Tropical Flower Farm",
"Zingiberales Society of Puerto Rico",
"Get Firefox",
"Get Thunderbird",
"NSL Languages Plus",
"skype",
"Exotic Gardening",
"Exotic Rainforest"
);

target = new initArray(
"_self",
"_self",
"_self",
"_blank",
"_blank",
"_blank",
"_blank",
"skype",
"_blank",
"_blank"
);


var currentdate = new Date();
var core = currentdate.getSeconds() % image.length;
var ranlink  = link[core];
var ranimage = image[core];
var rantext  = text[core];
var rantarget = target[core];

if (ranlink == "") // if no link, just show image
{
  document.write('<img src=\"' +ranimage+ '\" border="0" alt=\"'+rantext+'\">');
}
else if (ranlink == "skype") // special case
{
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"  width="120" height="60" id="skype-banner-29"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="http://share.skype.com/show/flash/?id=29&clickTag=http%3A%2F%2Fshare.skype.com%2Fin%2F29%2Fraybentz" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed src="http://share.skype.com/show/flash/?id=29&clickTag=http%3A%2F%2Fshare.skype.com%2Fin%2F29%2Fraybentz"   menu="false" quality="high" bgcolor="#ffffff" width="120" height="60"   id="skype-banner-embed" allowScriptAccess="sameDomain"   type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <noembed><div><a href="http%3A%2F%2Fshare.skype.com%2Fin%2F29%2Fraybentz" target="_blank"><img src=" http://share.skype.com/show/flash/?id=29" border="0" alt="Share Skype" id="skype-banner-img" width="120" height="60" /></a></div></noembed> </embed> </object>');
}
else
{
  document.write('<a href=\"' +ranlink+ '\" target=\"' +rantarget+ '\" title=\"' +rantext+ '\"><img src=\"'+ranimage+'\" border="0" alt=\"'+rantext+'\"></a>');
}

} /* showAd */


/************************************************************
** for use in BACK link
************************************************************/

/*** NOT USED RIGHT NOW
function goBack()
{
  history.go(-1);
  return (false);
}

function writeBackLink()
{
  document.write('<a href=\"' + window.history.previous + '\">&lt;&lt;Back</a>');
}
*******/

/************************************************************
**
** used in popping up large photo
**
**************************************************************/

/*
** these functions are for extracting values from the QUERYSTRING
*/

function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; }
}

/* -------------------------- */

function queryString(key)
{
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}

/* ------------------------- */

function displayItem(key)
{
if(queryString(key)=='false')
{
document.write("no ?name=value for ", key);
}
else
{
document.write(queryString(key));
}
}

/*
** used to pop up large photo
*/

function popupPhoto(name, photo)
{
  var url='http://www.tropicalflowerfarm.com/imagepopup.html?name=' + name + '&photo=' + photo;
  
  //alert(url);
  window.open(url,
  'popupPhoto',
  'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=525,height=580,screenX=10,screenY=10,top=10,left=10').focus();
}

/****************************************/

