
/////////////////////////////////////CPhotoBookAssetsDataComponent   ///////////////////////

var CPhotoBookAssetsDataComponent = Class.create({
    //m_url : undefined ,
    initialize: function(url, topicName) {
        this.m_url = url;
        this.topicName = topicName ;
    },
    subscribe :function(_topicName)
    {
        CEventDispatcher.subscribe(this.topicName, this , this.load );
    } ,
    load :  function()
    {
      if(typeof(loadDataFromDataHost) != "function") throw "util method  loadDataFromDataHost is not defined!" ;
      var jsonData = loadDataFromDataHost(null, this);

    } ,
    setUrl : function (url)
    {
      this.m_url = url;
    } ,
    getReadUrl : function ()
    {
      return this.m_url ;
    } ,
    callbackDataHandler : function (dataObject)
    {
        if(typeof(CEventDispatcher) != "object") throw  "please include clientv2.js!" ;
		setBookData(dataObject);
		
    }
})//   end of function

function __updatePhotoBookAction(xmlhttp, parameterObj)
{
    if(xmlhttp)
    {
        show_response(xmlhttp);
    }// end of if
}// end of __updatePixacoCaption


/**
*    This is Slideshow parameter object, used for Ajax calls
*/
function CPhotoBookParameter(url ,action, callbackHandler)
{

    this.parameterObj = CParameterObject.getInstance(url , action) ;
    this.parameterObj.setControllerHandler(callbackHandler) ;

    this.parameterObj.setCaption = _CPhotoBookParameter_setCaption ;
    this.parameterObj.getCaption = _CPhotoBookParameter_getCaption ;

    this.parameterObj.setRotation = _CPhotoBookParameter_setRotation ;
    this.parameterObj.getRotation = _CPhotoBookParameter_getRotation ;

    this.parameterObj.setIndex = _CPhotoBookParameter_setIndex ;
    this.parameterObj.getIndex = _CPhotoBookParameter_getIndex ;

    this.parameterObj.setXMLDOMObject = _CPhotoBookParameter_setXMLDOMObject ;
    this.parameterObj.getXMLDOMObject= _CPhotoBookParameter_getXMLDOMObject ;

    // skeptical about the following 2, do we need them  ?
    this.parameterObj.setDocumentObj = _CPhotoBookParameter_setDocumentObj ;
    this.parameterObj.getDocumentObj = _CPhotoBookParameter_getDocumentObj ;

    this.parameterObj.setOldPictOid = _CPhotoBookParameter_setOldPictOid ;
    this.parameterObj.getOldPictOid = _CPhotoBookParameter_getOldPictOid ;

    return this.parameterObj ;
}   //end of CPhotoBookParameter() ;

function _CPhotoBookParameter_setIndex(idx)
{
    this.m_index = idx ;
}

function _CPhotoBookParameter_getIndex()
{
    return this.m_index ;
}

function _CPhotoBookParameter_setCaption(caption)
{
    this.m_caption = caption ;
}

function _CPhotoBookParameter_getCaption()
{
    return this.m_caption ;
}

function _CPhotoBookParameter_setOldPictOid(pictOid)
{
    this.m_oldPictOid = pictOid;
}

function _CPhotoBookParameter_getOldPictOid()
{
    return this.m_oldPictOid;
}

function _CPhotoBookParameter_setRotation(rotation)
{
    this.m_rotation = rotation ;
}

function _CPhotoBookParameter_getRotation()
{
    return this.m_rotation ;
}

function _CPhotoBookParameter_setDocumentObj(docObj)
{
    this.m_docObj = docObj ;
}

function _CPhotoBookParameter_getDocumentObj()
{
    return this.m_docObj ;
}

function _CPhotoBookParameter_setXMLDOMObject(domObj)
{
    this.m_xmlDomObj = domObj ;
}

function _CPhotoBookParameter_getXMLDOMObject()
{
    return this.m_xmlDomObj ;
}


//This will be called once AJAX request is back.
function callbackBooksAction(parameterObj)
{
	data = eval(response.responseText);
}

//This function makes a call to server to add the current picture to cart and dispays the message.
function getBooksInfo(url)
{
        //var photoBookParameter = new CPhotoBookParameter(
        //               url, IActionConstants.GET_PHOTO_BOOK_DETAILS, "callbackBooksAction");
        //doRequest(photoBookParameter);
		(new CPhotoBookAssetsDataComponent(url,'photobooks')).load();
}
//Displays the DIV saying updatefailed and hide all the DIVs.
function showUpdateFaliedDiv()
{
}



