                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                if(!window.__td){window.__MT=100;window.__ti=0;window.__td=[];window.__td.length=__MT;window.__noTrace=false;}







if(typeof vp=="undefined")
{
var vp={};
}

if(!vp.gallery)
{
vp.gallery={};
}



vp.gallery.Dictionaries=function gallery_Dictionaries()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me=this;






this.addProperty=function pb_this_addProperty(sName,sJSONValue)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
me[sName]=sJSONValue;
};






this.addDictionary=function pb_this_addDictionary(sDictionaryName,oDictionary)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var newDict=new vp.gallery.Dictionary();
newDict.addValues(oDictionary);
me.addProperty(sDictionaryName,newDict);
};






this.add=function pb_this_add(sName,oValue)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(typeof(oValue)=="string")
{
me.addDictionary(sName,oValue);
}
else
{
me.addProperty(sName,oValue);
}
};
};




var GalleryData=new vp.gallery.Dictionaries();




vp.gallery.Dictionary=function gallery_Dictionary()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me=this;




var values=null;





this.addValues=function pb_this_addValues(oNameValueCollection)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
values=oNameValueCollection;
for(var i=0;i<values.length;i++)
{
if(isNaN(parseInt(values[i][0])))
{
me[values[i][0]]=values[i][1];
}
}
};





this.getValue=function pb_this_getValue(oKey)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(values===null)
{
return null;
}

for(var i=0;i<values.length;i++)
{
if(values[i][0]==oKey)
{
return values[i][1];
}
}
return null;
};




this.getKeys=function pb_this_getKeys()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(values===null)
{
return null;
}

var keys=[];
for(var i=0;i<values.length;i++)
{
keys.add(values[i][0]);
}
return keys;
};






this.getKeyByPropertyValue=function pb_this_getKeyByPropertyValue(sPropertyName,oValue)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
for(var i=0;i<values.length;i++)
{
var oItem=values[i][1];
if(oItem[sPropertyName]!==null&&oItem[sPropertyName]==oValue)
{
return values[i][0];
}
}
return null;
};
};




vp.gallery.WebRequest=function gallery_WebRequest()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me=this;




this.requestUrl="/gallery_web_service.aspx";




this.parameters=[];




this.callbackFunction=null;




this.errorHandlerFunction=null;




this.enableNoCache=true;






this.addParameter=function pb_this_addParameter(sName,sValue)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
me.parameters.push([sName,sValue]);
};




this._buildRequestString=function pb_this__buildRequestString()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var reqStr=this.requestUrl;

for(var i=0;i<me.parameters.length;i++)
{
var sep=(i===0?"?":"&");
if(me.parameters[i][1]!==null)
{
reqStr="{0}{1}{2}={3}".format(reqStr,sep,me.parameters[i][0],me.parameters[i][1]);
}
else
{
reqStr="{0}{1}{2}".format(reqStr,sep,me.parameters[i][0]);
}
}


if(this.enableNoCache)
{
reqStr="{0}{1}{2}={3}".format(reqStr,(me.parameters.length===0?"?":"&"),"timestamp",new Date().getTime());
}

return reqStr;
};




this.ping=function pb_this_ping()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.http.ping(me._buildRequestString());
};




this.executeAsync=function pb_this_executeAsync()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var reqStr=me._buildRequestString();

var fnCallBackOriginal=me.callbackFunction;
var fnCallback=function pv_fnCallback(oResponseText)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oResponse=null;

try
{
oResponse=vp.http.parseJSON(oResponseText);
}
catch(e)
{
oResponse=new Object();
oResponse["rc"]=-1;
}

if(fnCallBackOriginal)
{
fnCallBackOriginal(oResponse);
}
};

vp.http.getAsync(reqStr,fnCallback,this.errorHandlerFunction);

};
};













vp.gallery.hideShowElements=function gallery_hideShowElements(sElementToHideId,sElementToShowId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
try
{
document.getElementById(sElementToHideId).style.display="none";
document.getElementById(sElementToShowId).style.display="block";
}
catch(e)
{
}
return false;
};





vp.gallery.addMask=function gallery_addMask(oElement)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!oElement)
{
return;
}
var oRect=vp.ui.getRect(oElement);
var oMask=document.createElement("DIV");
oMask.style.zIndex=10000;
oMask.style.position="absolute";
oMask.style.left=oRect.left+"px";
oMask.style.top=oRect.top+"px";
oMask.style.height=oRect.height+"px";
oMask.style.width=oRect.width+"px";
oMask.style.backgroundImage="url(/vp/images/s.gif)";
document.body.appendChild(oMask);
};




vp.gallery.isIE6=function gallery_isIE6()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
return vp.browser.isIE&&vp.browser.ver==6;
};






vp.gallery.trackAction=function gallery_trackAction(sVSRef,oAdditionalParameters)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oRequest=new vp.gallery.WebRequest();
oRequest.requestUrl="/vp/vissci.aspx";
oRequest.addParameter("vsref",sVSRef);

if(oAdditionalParameters)
{
for(var i=0;i<oAdditionalParameters.length;i++)
{
oRequest.addParameter(oAdditionalParameters[i].name,oAdditionalParameters[i].value);
}
}

oRequest.addParameter("log","1");
oRequest.ping();
};








vp.gallery.errorHandler=function gallery_errorHandler(sMessage,sUrl,iLine,sAdditionalInfo)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oRequest=new vp.gallery.WebRequest();


oRequest.addParameter("request_type",3);
oRequest.addParameter("message",escape(sMessage));
oRequest.addParameter("url",escape(sUrl));

var sBrowserName;
if(vp.browser.isIE)
{
sBrowserName="IE";
}
else if(vp.browser.isFirefox)
{
sBrowserName="FF";
}
else if(vp.browser.isGecko)
{
sBrowserName="Gecko";
}
else if(vp.browser.isNetscape)
{
sBrowserName="Netscape";
}
else if(vp.browser.isOpera)
{
sBrowserName="Opera";
}
else if(vp.browser.isSafari)
{
sBrowserName="Safari";
}
else
{
sBrowserName="Unknown";
}

sBrowserName=sBrowserName+"-"+vp.browser.ver;
oRequest.addParameter("browser",sBrowserName);

if(iLine)
{
oRequest.addParameter("line",iLine);
}
else
{
oRequest.addParameter("line",-1);
}

if(sAdditionalInfo)
{
oRequest.addParameter("additionalinfo",escape(sAdditionalInfo));
}
else
{
oRequest.addParameter("additionalinfo","");
}


oRequest.ping();


return true;
};
