// JavaScript Document
function changePID(id, value) {
  partNum = value.substring(value.lastIndexOf("=")+1);
  document.getElementById(id).innerHTML=partNum;
}
//
// This function is called when the user changes the size in the Size options menu on a product page.
// We have to reload the form (webpage) so the other options menus that are dependent on the size get reloaded.
// 
function reload(fileName, value){
	partID = value.substring(0, value.lastIndexOf("="));
	// if we already have an ?edit on the end of the file name, have to use the other separator...
	pos = fileName.search("edit");
  if (pos != -1) 
	  sep = '&';
	else 
		sep = '?';
  self.location=fileName + sep + 'resize=' + partID ;
}
/**
* Set a cookie
* @param string cookie name
* @param string cookie value
* @param string cookie expiration counter in days
* @param string cookie path
* @param string cookie domain
* @param bool secure?
*/
function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	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" : "" );
}