<!--
var variable = "";
function popup_open_orders()
{
	//window.open("open_orders_print.php","Message Board","");
	
	var generator=window.open("open_orders_print.php",'name','height=500,width=900,status=0,resize=0,scrollbars=1,menubar=1');
	//notes
}

function message_board()
{
    window.open("http://www.stanforddistributing.no-ip.com/","Message Board","");
}

function visit_a_store()
{
    window.open("http://www.babynewsstores.com/stores.php","Visit a Store","");
}


function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
		{
			expires = expires * 1000 * 60 * 60 * 24;
		}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function hide_customer_list()
{
	cust_list_hide = document.getElementById('cust_list_hide');
	cust_list_show = document.getElementById('cust_list_show');
	customer_table = document.getElementById('customer_table');
	//change properties NOW
	cust_list_hide.style.display = 'none';
	cust_list_show.style.display = '';
	customer_table.style.display = 'none';
	Set_Cookie( 'customer_list', '1', 30, '/main/', '', '' )
		
	return;
}

function show_customer_list()
{
	cust_list_hide = document.getElementById('cust_list_hide');
	cust_list_show = document.getElementById('cust_list_show');
	customer_table = document.getElementById('customer_table');
	//change properties NOW
	cust_list_hide.style.display = '';
	cust_list_show.style.display = 'none';
	customer_table.style.display = '';
	Set_Cookie( 'customer_list', '0', 30, '/main/', '', '' )
	return;
}
//menu navigation buttions
/*
function sdc_window()
{

	location.href = "index.php?sdc=12345";
		
}
function baby_carriers_and_backpacks()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=4";
		
}
function bassinets_and_playyards()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=1";
		
}
function bathing_and_healthcare()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=2";
		
}
function books_music_and_videos()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=5";
		
}
function breastfeeding()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=3";
		
}
function car_seat()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=6";
		
}
function clothing()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=7";
		
}
function diapering_and_potty_training()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=8";
		
}
function feeding()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=9";
		
}
function furniture()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=10";
		
}
function gift_items()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=11";
		
}
function high_chairs_and_boosters()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=12";
		
}
function nursery_bedding()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=13";
		
}
function playtime_and_exercise()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=14";
		
}
function safety()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=15";
		
}
function strollers()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=16";
		
}
function supplies()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=18";
		
}
function toys()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=17";
		
}
function liquidation()
{

	location.href = "http://www.sdcpda.no-ip.com/main/details/top_category.php?top_category=19";
		
}

*/






//to make the images get larger and then smaller on the mouseover and mouseout thing

/**
The JavaScript functions below will gradually enlarge or shrink an image
on the current page. I use this for mouseover effects, but there might be
some other interesting applications of it as well.

You can use these scripts in any way you'd like.

*/

/**** adjust these two parameters to control how fast or slow
 **** the images grow/shrink ****/
// how many milliseconds we should wait between resizing events
var resizeDelay = 20;
// how many pixels we should grow or shrink by each time we resize
var resizeIncrement = 5;

// this will hold information about the images we're dealing with
var imgCache = new Object();


/**
The getCacheTag function just creates a (hopefully) unique identifier for
each <img> that we resize.
*/
function getCacheTag (imgElement) {
	return imgElement.src + "~" + imgElement.offsetLeft + "~" + imgElement.offsetTop;
}


/**
We're using this as a class to hold information about the <img> elements
that we're manipulating.
*/
function cachedImg (imgElement, increment) {
	this.img = imgElement;
	this.cacheTag = getCacheTag(imgElement);
	this.originalSrc = imgElement.src;
	
	var h = imgElement.height;
	var w = imgElement.width;
	this.originalHeight = h;
	this.originalWidth = w;
	
	increment = (!increment) ? resizeIncrement : increment;
	this.heightIncrement = Math.ceil(Math.min(1, (h / w)) * increment);
	this.widthIncrement = Math.ceil(Math.min(1, (w / h)) * increment);
}


/**
This is the function that should be called in the onMouseOver and onMouseOut
events of an <img> element. For example:

<img src='onesmaller.gif' onMouseOver='resizeImg(this, 150, "onebigger.gif")' onMouseOut='resizeImg(this)'>

The only required parameter is the first one (imgElement), which is a
reference to the <img> element itself. If you're calling from onMousexxx, 
you can just use "this" as the value.

The second parameter specifies how much larger or smaller we should resize
the image to, as a percentage of the original size. In the example above,
we want to resize it to be 150% larger. If this parameter is omitted, we'll
assume you want to resize the image to its original size (100%).

The third parameter can specify another image that should be used as the
image is being resized (it's common for "rollover images" to be similar but
slightly different or more colorful than the base images). If this parameter
is omitted, we'll just resize the existing image.
*/
function resizeImg (imgElement, percentChange, newImageURL) 
{
	// convert the percentage (like 150) to an percentage value we can use
	// for calculations (like 1.5)
	var pct = (percentChange) ? percentChange / 100 : 1;
	
	// if we've already resized this image, it will have a "cacheTag" attribute
	// that should uniquely identify it. If the attribute is missing, create a
	// cacheTag and add the attribute
	var cacheTag = imgElement.getAttribute("cacheTag");
	if (!cacheTag) {
		cacheTag = getCacheTag(imgElement);
		imgElement.setAttribute("cacheTag", cacheTag);
	}
	
	// look for this image in our image cache. If it's not there, create it.
	// If it is there, update the percentage value.
	var cacheVal = imgCache[cacheTag];
	if (!cacheVal) {
		imgCache[cacheTag] = new Array(new cachedImg(imgElement), pct);
	} else {
		cacheVal[1] = pct;
	}
	
	// if we're supposed to be using a rollover image, use it
	if (newImageURL)
		imgElement.src = newImageURL;
	
	// start the resizing loop. It will continue to call itself over and over
	// until the image has been resized to the proper value.
	resizeImgLoop(cacheTag);
	return true;
}


/**
This is the function that actually does all the resizing. It calls itself
repeatedly with setTimeout until the image is the right size.
*/

function resizeImgLoop (cacheTag) 
{
	// get information about the image element from the image cache
	var cacheVal = imgCache[cacheTag];
	if (!cacheVal)
		return false;
	var cachedImageObj = cacheVal[0];
	var imgElement = cachedImageObj.img;
	var pct = cacheVal[1];
	var plusMinus = (pct > 1) ? 1 : -1;
	var hinc = plusMinus * cachedImageObj.heightIncrement;
	var vinc = plusMinus * cachedImageObj.widthIncrement;
	var startHeight = cachedImageObj.originalHeight;
	var startWidth = cachedImageObj.originalWidth;
	
	var currentHeight = imgElement.height;
	var currentWidth = imgElement.width;
	var endHeight = Math.round(startHeight * pct);
	var endWidth = Math.round(startWidth * pct);
	
	// if the image is already the right size, we can exit
	if ( (currentHeight == endHeight) || (currentWidth == endWidth) )
		return true;
	
	// increase or decrease the height and width, making sure we don't get
	// larger or smaller than the final size we're supposed to be
	var newHeight = currentHeight + hinc;
	var newWidth = currentWidth + vinc;
	if (pct > 1) {
		if ((newHeight >= endHeight) || (newWidth >= endWidth)) {
			newHeight = endHeight;
			newWidth = endWidth;
		}
	} else {
		if ((newHeight <= endHeight) || (newWidth <= endWidth)) {
			newHeight = endHeight;
			newWidth = endWidth;
		}
	}
	
	// set the image element to the new height and width
	imgElement.height = newHeight;
	imgElement.width = newWidth;
	
	// if we've returned to the original image size, we can restore the
	// original image as well (because we may have been using a rollover
	// image in the original call to resizeImg)
	if ((newHeight == cachedImageObj.originalHeight) || (newWidth == cachedImageObj.originalwidth)) {
		imgElement.src = cachedImageObj.originalSrc;
	}
	
	// shrink or grow again in a few milliseconds
	setTimeout("resizeImgLoop('" + cacheTag + "')", resizeDelay);
}


//functions list for all javascript
var count = 0;
function resize_function()
{
	count++;
	if(count < 2)
	{
		resizeImg(this, 185);
	}
	if(count > 2)
	{
		resizeImg(this);
		count = 0;
	}

}

/* This is the javascript function that will run to make the whole menu visitble. */
function toggleview(element1)
{

	element1 = document.getElementById(element1);
	
	if (element1.style.display == 'block' || element1.style.display == '')
		{
			element1.style.display = 'none';
		}
		else
			{
				element1.style.display = 'block';
			}
		
	return;
}




function confirm_catalog()
	{
	
		if(confirm("This catalog page will generate slowly.\n We are bringing up your past order history.\n Click OK to continue.") == true)
			{
				location = "complete_catalog.php";
			}
			else
			{
				window.history.back();
				window.history.back();
			}
	}
	
	
//mouse over for the images to display at the bottom of the page

function show_image_lowwer_right(div) 
	{
		if (document.getElementById)
		{
			
			document.getElementById(div).style.display = "block";
			
		}
	return true;
	}
	function hide_image_lowwer_right(div) 
	{
		if (document.getElementById)
		{
			
			document.getElementById(div).style.display = "none";
			
		}
	return true;
	}
	
	
	
//detech if image has loaded correctley
function IsImageOk(img)
{
    // During the onload event, IE correctly identifies any images that
    // weren't downloaded as not complete. Others should too. Gecko-based
    // browsers act like NS4 in that they report this incorrectly.
    if (!img.complete)
	{
        return false;
    }

    // However, they do have two very useful properties: naturalWidth and
    // naturalHeight. These give the true size of the image. If it failed
    // to load, either of these should be zero.
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0)
	{
        return false;
    }

    // No other way of checking: assume it's ok.
    return true;
}


function CheckForBrokenImages(callback)
{
    AddEvent(window, "load", function()
	{
        for (var i = 0; i < document.images.length; i++)
		{
            if (!IsImageOk(document.images[i]))
			{
                callback(document.images[i]);
            }
        }
    });
}

/*
//my modifications
function ImageLoadFailed(imgName)
{
	if (document.images)
	{
		//var imgName = document[imgName];
		//var new_src = "";
		var new_src = "http://www.stanford.no-ip.com/main/images/";
		//combine the two
		var change_image = new_src + imgName;
		document.getElementById(imgName).src = change_image;
	}
	
	//window.event.srcElement.src = new_location_img_name;
}
*/
var count = 0;
var ele_name_old = 0;
var ele_name;
function ImageLoadFailed(ele_name,imgName)
{
	//var ele_name;
	if(ele_name_old == ele_name)
	{
		//do nothing, becasue it is working correctley
	}
	else
	{
		count = 0;
		ele_name_old = ele_name;
		//alert('Variable ele_old: ' + ele_name_old + ' Variable ele_name:' + ele_name + '\n');
	}
	
	/*
	if(count == 0)
	{
		var new_src = "http://home.comcast.net/~gregcaulder/images/";
		//combine the two
		var change_image = new_src + imgName;
		document.getElementById(ele_name).src = change_image;
		
	}
	*/
	
	if(count == 0)
	{
		var new_src = "http://www.stanforddistributing.com/images/";
		//var new_src = "http://www.nfistudios.com/StanfordProductImages/images/";
		//defining what image to change it to now
		//imgName = "nopic.gif";
		//combine the two
		var change_image = new_src + imgName;
		document.getElementById(ele_name).src = change_image;
	}
	
	if(count == 1)
	{
		var new_src = "http://www.stanforddistributing.com/images/";
		//var new_src = "http://www.nfistudios.com/StanfordProductImages/images/";
		//defining what image to change it to now
		imgName = "nopic.gif";
		//combine the two
		var change_image = new_src + imgName;
		document.getElementById(ele_name).src = change_image;
		//var count = 0;
	}
	ele_name_old = ele_name;
	count++;
	return ele_name_old;
	
}


/* Select Customer Javascript */
function Select_Customer( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
		{
			expires = expires * 1000 * 60 * 60 * 24;
		}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
	window.location = "http://reps.stanforddistributing.com/main/acct/"
	//history.go(0);
}

function show_image_upload(image_number)
{
	//display the upload div
	//add or change the image number value
	//update or change the visible image number value
	
	
	
	//cust_list_hide = document.getElementById('cust_list_hide');
	//image_number_v = document.getElementById('image_number_v');
	//customer_table = document.getElementById('customer_table');
	//change properties NOW
	//cust_list_show.value = '1';
	//makes the upload div table visible
	document.getElementById('add_product_div').style.display = '';
	document.getElementById('image_number_v').value = image_number;
	document.getElementById('image_number').value = image_number;
	//document.individualPricingDiscountForm.hiddenFinalPrice_1.value = totalPrice;
	
	//cust_list_hide.style.display = '';
	//cust_list_show.style.display = 'none';
	//customer_table.style.display = '';
	//Set_Cookie( 'customer_list', '0', 30, '/main/', '', '' )
	return;
}


function show_add_product(image_number)
{
	//display the upload div
	//add or change the image number value
	//update or change the visible image number value
	
	
	
	//cust_list_hide = document.getElementById('cust_list_hide');
	//image_number_v = document.getElementById('image_number_v');
	//customer_table = document.getElementById('customer_table');
	//change properties NOW
	//cust_list_show.value = '1';
	//makes the upload div table visible
	document.getElementById('add_product_div').style.display = '';
	//document.getElementById('image_number_v').value = image_number;
	//document.getElementById('image_number').value = image_number;
	//document.individualPricingDiscountForm.hiddenFinalPrice_1.value = totalPrice;
	
	//cust_list_hide.style.display = '';
	//cust_list_show.style.display = 'none';
	//customer_table.style.display = '';
	//Set_Cookie( 'customer_list', '0', 30, '/main/', '', '' )
	return;
}



//select all checkbox


checked=false;
function checkedAll (forum_name)
{
	var aa = document.getElementById(forum_name);
	 if (checked == false)
          {
           checked = true
          }
        else
          {
          checked = false
          }
	for (var i =0; i < aa.elements.length; i++) 
	{
	 aa.elements[i].checked = checked;
	}
}


