/**
Opens the html image editor for the provided image id.

@param id The id of the image.
@param imageType The Image type of the photo, for example PROFESSIONAL.
*/
function editFlashBuilderPhoto(id, imageType){
  window.open("/photoeditor_popup.aspx?imageId=" + id + "&imageType=" + imageType, "flashPopup", "width=400,height=515,location=0,status=0,menubar=0,toolbar=0,resizable=0");
}

/**
Opens the html image editor for the provided image id.

@param id The id of the image.
@param imageType The Image type of the photo, for example PROFESSIONAL.
*/
function enlargeFlashBuilderPhoto(id, imageType){
  window.open("/photostore_zoom.aspx?imageId=" + id + "&imageType=" + imageType, "flashPopup", "width=400,height=440,location=0,status=0,menubar=0,toolbar=0,resizable=0");
}

/**
Sends the user to the cart page.
*/
function gotoCartFromBuilder(){
  window.location.href = "/Cart.aspx";
}

/**
Sends the flash builder the command to refresh the photobin.

@param photopassId Optional photopass to refresh from.
*/
function refreshPhotoBin(photopassId){
try
{ 
 document.getElementById("flashBuilder").onExternalCommand("REFRESH_BIN", {photopass:photopassId});
 }
 catch(error1)
 {
 refreshPhotoBinHTML();
 }
}

/**
Sends the flash builder the command to refresh the photobin by refreshing/adding the given items.

@param photoId The id to refresh.
*/
function refreshPhotoBinByIds(photoId){
  document.getElementById("flashBuilder").onExternalCommand("REFRESH_BIN_ITEMS", {id:photoIds});
}

/**
Sends the flash builder the command to delete a photo from the photobin.

@param photoIds The ids to refresh. This must be an array.
*/
function deletePhotoBinItems(photoIds){
  document.getElementById("flashBuilder").onExternalCommand("DELETE_BIN_ITEMS", {ids:photoIds});
}

/**
Sends the flash builder the command to navigate to the given page if possible.

@param url The url to navigate to.
*/
function navigateFromBuilder(url){
  document.getElementById("flashBuilder").onExternalCommand("NAVIGATE", {url:url});
}

/**
Opens the html photo uploader for the given user id.

@param id The id of the current user.
*/
function uploadPhoto(id){
	window.open("/upload/upload.aspx?AccountId=" + id, "flashPopup");
}
               
// These methods are required for PhotoShirt Add To Cart functionality
function removesuccess(obj)
{
 document.getElementById("flashBuilder").onExternalCommand("addToCart", true);
}

function FailResult(obj)
{
 document.getElementById("flashBuilder").onExternalCommand("addToCart", false);
}