/*
  $Id: general.js,v 1.5 2005/03/29 22:59:11 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2005 osCommerce

  Released under the GNU General Public License
*/

function updateDatePullDownMenu(objForm, fieldName) {
  var pdmDays = fieldName + "_days";
  var pdmMonths = fieldName + "_months";
  var pdmYears = fieldName + "_years";

  time = new Date(objForm[pdmYears].options[objForm[pdmYears].selectedIndex].text, objForm[pdmMonths].options[objForm[pdmMonths].selectedIndex].value, 1);

  time = new Date(time - 86400000);

  var selectedDay = objForm[pdmDays].options[objForm[pdmDays].selectedIndex].text;
  var daysInMonth = time.getDate();

  for (var i=0; i<objForm[pdmDays].length; i++) {
    objForm[pdmDays].options[0] = null;
  }

  for (var i=0; i<daysInMonth; i++) {
    objForm[pdmDays].options[i] = new Option(i+1);
  }

  if (selectedDay <= daysInMonth) {
    objForm[pdmDays].options[selectedDay-1].selected = true;
  } else {
    objForm[pdmDays].options[daysInMonth-1].selected = true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function checkBox(object) {
  document.account_newsletter.elements[object].checked = !document.account_newsletter.elements[object].checked;
}

function sizePicture(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop)
 {if (screen.width < imageWidth )
 	{var imageWidth =screen.width;}
	if(screen.height < imageHeight)
	{var imageHeight =screen.height;}
 	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=yes,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onClick="self.close()" onBlur="self.close()">'); 
	newWindow.document.write('<img src="'+imageName+'"alt="Click to close"></body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function setVariables() {
if (navigator.appName == "Netscape") {
v=".top=";
dS="document.";
sD="";
y="window.pageYOffset";
}
else {
v=".pixelTop=";
dS="";
sD=".style";
y="document.body.scrollTop";
   }
}

function checkLocation() {
object="object1";
yy=eval(y);
eval(dS+object+sD+v+yy);
setTimeout("checkLocation()",50);
}

function addBookmark() {
bookmarkurl="http://www.surf4swimwear.com/index.php"
bookmarktitle="Stunners Designer Swimwear"
        if (window.sidebar) { // firefox
              window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
        } else if( document.all ) { //MSIE
                window.external.AddFavorite(bookmarkurl,bookmarktitle)
        } else {
               alert("Sorry, your browser doesn't support this");
        }
}
 

function mailadd()
{
      var starter = 'mail';
	var second = 'to';
	var third = ':';
	var address = 'info';
	var domain = 'development.plus';
	var ext = 'com';
      var subj = '?SUBJECT=Website enquiry supermarket dot com'
      window.location = (starter+second+third+address+'@'+domain+'.'+ext+subj)

}

function mailoff()
{
      var starter = 'mail';
	var second = 'to';
	var third = ':';
	var address = 'stunners';
	var domain = 'surf4swimwear';
	var ext = 'com';
      var subj = '?SUBJECT=Off Mailing List please'
      window.open(starter+second+third+address+'&#64;'+domain+'.'+ext+subj)
}

