/* *********** Begin Quixtar.Web.UI.WebControls.Resources.ClientScripts.CountryControlSelector.js  from Quixtar.Web.UI.WebControls.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
function SetCookie(country, language, cookieName, sDomain, iExpMilliSeconds, targetUrl)
{
     var cookieValues = Get_Cookie(cookieName);
      if (cookieValues == null)
        var newCookieValue = "LanguageCode=" + language + "&CountryCode=" + country + "&MemberType=05&BusinessNature=V";
      else
      {
        var cookieValuesSplitResult = cookieValues.split("&");
        if (cookieValuesSplitResult.length == 4)
            var newCookieValue = "LanguageCode=" + language + "&CountryCode=" + country + "&" + cookieValuesSplitResult[2] + "&" + cookieValuesSplitResult[3];
        else
           var newCookieValue = "LanguageCode=" + language + "&CountryCode=" + country + "&MemberType=05&BusinessNature=V";
      }
      
      //set the expire date in milliseconds so add milliseconds to current date
      var sExpires;
      if (iExpMilliSeconds > 0)
      {
        var dExpires = new Date();
        dExpires.setTime(dExpires.getTime() + iExpMilliSeconds);
        sExpires = dExpires.toGMTString();
      }
      
      var sCookie = newCookieValue;
      var sPath = "/";
      
      if (sExpires)
      {
        sCookie += ("; expires=" + sExpires);
      }
      if (sDomain)
      {
        sCookie += ("; domain=" + sDomain);
      }
      if (sPath)
      {
        sCookie += ("; path=" + sPath);
      }
      
      document.cookie = cookieName + "=" + sCookie;
     
      if (typeof(targetUrl) != "string" || targetUrl == null || targetUrl == "")
      {
        window.location.reload();
      }
      else
      {
        window.location.href = targetUrl;
      }
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) 
{
	var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
        return null;
    
    if ( start == -1 ) 
        return null;

    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) 
        end = document.cookie.length;

    return unescape( document.cookie.substring( len, end ) );
}

/* *********** End Quixtar.Web.UI.WebControls.Resources.ClientScripts.CountryControlSelector.js  from Quixtar.Web.UI.WebControls.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.Order.Resources.ClientScripts.CartItemCountControl.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/

// JS Used to Update Cart Icon
 function CIC_UpdateCount() {
    
    Quixtar.Web.UI.WebControls.Order.CartItemCountControl.GetAjaxCartCount(m_CICCartTypeName, m_CICCartName, CIC_UpdateCountCallback, null, null, null, CIC_UpdateCountTimeout);
}

function CIC_UpdateCountCallback(ajaxResponse)
{
  
    var obj = document.getElementById(m_CICLinkCartClientID); 
    obj.innerHTML = '' + ajaxResponse.value; 

    var anim = new YAHOO.util.ColorAnim(obj.parentNode, {backgroundColor: { from:"#eae0d7", to:"#ffffff" } }, 2);
    anim.animate();
}

function CIC_UpdateCountTimeout()
{
    document.forms[0].submit();
}
/* *********** End Quixtar.Web.UI.WebControls.Order.Resources.ClientScripts.CartItemCountControl.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.Resources.ClientScriptHelper.YahooUI.ClientScripts.animation-min.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.0
*/

YAHOO.util.Anim=function(el,attributes,duration,method){if(!el){}
this.init(el,attributes,duration,method);};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName||el;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}
YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}
var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}
return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}
return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}
start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i]*1;}}else{end=start+attributes[attr]['by']*1;}}
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);return true;},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=!YAHOO.lang.isUndefined(duration)?duration:1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.setEl=function(element){el=YAHOO.util.Dom.get(element);};this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}
this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;if(this.duration===0&&this.useSeconds){this.totalFrames=1;}
YAHOO.util.AnimMgr.registerElement(this);return true;};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}
YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}
isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}
actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=1000;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index==-1){return false;}
queue.splice(index,1);tweenCount-=1;if(tweenCount<=0){this.stop();}
return true;};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[0].isAnimated()){this.unRegister(queue[0],0);}}
queue=[];thread=null;tweenCount=0;}
else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
tween._onTween.fire();}
else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}
return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}
var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}
c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}
c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}
return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}
val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}
else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}
return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}
return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d)==1){return b+c;}
if(!p){p=d*.3;}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d)==1){return b+c;}
if(!p){p=d*.3;}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d/2)==2){return b+c;}
if(!p){p=d*(.3*1.5);}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
if(t<1){return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}
return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;}
return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}
control=tmp;}
if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}
if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}
else{Y.Dom.setXY(el,Y.Dom.getXY(el));}
start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}
this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}
else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.3.0",build:"442"});
/* *********** End Quixtar.Web.UI.Resources.ClientScriptHelper.YahooUI.ClientScripts.animation-min.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.AjaxMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
//Override the Ajax handlers
function ajaxInit()
{
    if ( typeof Ajax == "object" ) 
	{
        Ajax.onTimeout = function ( b, res )
			{ 
			alert ( "Timeout" );
			return true; 
			} 
        
        Ajax.onLoading = function ( b )
			{ 
			//Show spinner 
			} 
        
        Ajax.onError = function ( err, res )
			{ 
			if ( err.Status == 302 )
				{
				document.forms[0].submit();
				}
			else
				{
				LogAjaxError ( err, res );
				alert ( "An error has occurred" );
				}
			} 
    }
}

function ExecuteAjax ( func ) 
{
	try 
		{
		var result = func();
		
		if ( result == null || result.value == null ) 
			{
			throw ( "Error" );
			}
		
		return result;
		} 
	catch ( ex ) 
		{
		window.location.href = CSHELPER_AJAX_LOGOUT_URL;
		return false;
		}
}

function LogAjaxError ( error, response )
{
    // Attempt to log the error - if it doesn't work add the message to a cookie and let the server log it later
    var browserVersion = "";

	if ( typeof navigator == "object" )
		{
		browserVersion = navigator.userAgent;
		}

    var context = {"Status":error.Status, "Name":response.url + "." + response.method, "Description":error.Type + ": " + error.Message + ". Client: " + browserVersion };
   
    Quixtar.Web.UI.AjaxUtility.LogError(context.Status,
        context.Name,
        context.Description,
        300,
        function(){},
        context,
        null,
        LogAjaxError_onerror);
}

function LogAjaxError_onerror ( error, response )
{
	//add a cookie so the server can log this later
	var cookieValues = Get_Cookie("qxtrErrors");

	if ( cookieValues != null )
		{
		cookieValues += "&";
		}
	else
		{
		cookieValues = "";
		}

	//set the expire date in milliseconds so add milliseconds to current date
	var sExpires;
	var dExpires = new Date();
	dExpires.setTime(dExpires.getTime() + (30*60*1000));
	sExpires = dExpires.toGMTString();
	var context = response.context[3][1];

	cookieValues += "Status=" + context.Status +
		"&Name=" + context.Name +
		"&Description=" + context.Description +
		"; expires=" + sExpires +
		"; domain=" + ajax_host +
		"; path=/";
	    
	document.cookie = "qxtrErrors=" + cookieValues;
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) 
{
	var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    
    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
		{
        return null;
        }
    
    if ( start == -1 ) 
        {
        return null;
        }

    var end = document.cookie.indexOf( ";", len );
    
    if ( end == -1 ) 
		{
        end = document.cookie.length;
        }

	return unescape( document.cookie.substring( len, end ) );
}
/* *********** End Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.AjaxMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.Order.Resources.ClientScripts.CopyCartItemsControl.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
var m_CopyCartItemsControl_ItemList;

function CopyCartItemsContext(refreshCartCount, redirectUrl)
{
    this.refreshCartCount = refreshCartCount;
    this.redirectUrl = redirectUrl;
}

function CopyCartItemsState(pnlTargetsId, fraTargetsId, txtNewShoppingListId, lnkAddId, lblMessageId, newDittoUrl, orderIManageDittoUrl, copyMessage, newListText, newListMessage, source, teaLeafId, teaLeafHId, sourceType, sourceName)
{
    this.pnlTargetsId = pnlTargetsId;
    this.fraTargetsId = fraTargetsId;
    this.txtNewShoppingListId = txtNewShoppingListId;
    this.lnkAddId = lnkAddId;
    this.lblMessageId = lblMessageId;
    this.newDittoUrl = newDittoUrl;
    this.orderIManageDittoUrl = orderIManageDittoUrl;
    this.copyMessage = copyMessage;
    this.newListText = newListText;
    this.newListMessage = newListMessage;
    this.source = source;
    this.teaLeafId = teaLeafId;
    this.teaLeafHId = teaLeafHId;
    this.sourceType = sourceType;
    this.sourceName = sourceName;
}

function CopyCartItems_ShowLists(evt, triggerControl)
{
    var topPos,
		leftPos,
		topAbsolute,
		leftAbsolute,
		scrollHeight = eval(YAHOO.util.Dom.getViewportHeight() + YAHOO.util.Dom.getDocumentScrollTop()),
		scrollWidth = eval(YAHOO.util.Dom.getViewportWidth() + YAHOO.util.Dom.getDocumentScrollLeft()),
		targetPanel = document.getElementById(m_copyCartItemsState.pnlTargetsId);
	
	if (targetPanel)
	{
	    if (!triggerControl)
	    {
            if (window.event)
            {
                triggerControl = window.event.srcElement;
            }
            else
            {
                triggerControl = evt.target;
            }
        }

        if (triggerControl)
        {
			var coords = YAHOO.util.Dom.getXY(triggerControl);
				topAbsolute = coords[1];
				leftAbsolute = coords[0];
		    
			
			topPos = eval(topAbsolute + triggerControl.offsetHeight);
			leftPos = leftAbsolute;
            
            var height;
            var width;
            var exp = /px/g;
            
            if (targetPanel.style.height)
            {
                height = targetPanel.style.height.replace(exp, '');
                height = height * 1;
            }
            
            if (targetPanel.style.width)
            {
                width = targetPanel.style.width.replace(exp, '');
                width = width * 1;
            }
            
            if (eval(topPos + height) > scrollHeight)
            {
                topPos = eval(topPos - (height + triggerControl.offsetHeight + 12));
            }
            
            if (eval(leftPos + width) > scrollWidth)
            {
                if (width > triggerControl.offsetWidth)
                {
                    leftPos = eval(leftPos - (width - triggerControl.offsetWidth));
                }
            }
        }
        else
        {
            if (window.event) // Internet Explorer
            {
                topPos = eval(event.y);
                leftPos = eval(event.x);
            }
            else
            {
                topPos = eval(evt.pageY);
                leftPos = eval(evt.pageX);
            }
        }

	    targetPanel.style.display = "block";
	    YAHOO.util.Dom.setXY(targetPanel, [leftPos, topPos]);
    
	    var targetFrame = document.getElementById(m_copyCartItemsState.fraTargetsId);
	    if (targetFrame)
	    {
			targetFrame.style.display = "block";
			YAHOO.util.Dom.setXY(targetFrame, [leftPos, topPos]);
	    }
	}
	
	return false;
}

function CopyCartItems_HideLists()
{
    var targetPanel = document.getElementById(m_copyCartItemsState.pnlTargetsId);
    
    if (targetPanel)
    {
        targetPanel.style.display = 'none';
    }
    
    var targetFrame = document.getElementById(m_copyCartItemsState.fraTargetsId);
    
    if (targetFrame)
    {
        targetFrame.style.display = 'none';
    }
    
    var txtNewShoppingList = document.getElementById(m_copyCartItemsState.txtNewShoppingListId);
    
    if (txtNewShoppingList)
    {
        txtNewShoppingList.value = m_copyCartItemsState.newListText;
    }
    
    var lblMessage = document.getElementById(m_copyCartItemsState.lblMessageId);
    
    if (lblMessage)
    {
        lblMessage.innerHTML = '';
    }
    
    return false;
}

function CopyToShoppingCart()
{
    var context = new CopyCartItemsContext(true, '');
    Quixtar.Web.UI.WebControls.Order.CopyCartItemsControl.CopyItemsToShoppingCart(m_CopyCartItemsControl_ItemList, m_copyCartItemsState.source, m_copyCartItemsState.teaLeafId, m_copyCartItemsState.teaLeafHId, m_copyCartItemsState.sourceType, m_copyCartItemsState.sourceName, CopyCartItemsCallback, context, null, null, CopyCartItemsTimeout);
    
    return false;
}

function CopyToShoppingList(shoppingListName)
{
    Quixtar.Web.UI.WebControls.Order.CopyCartItemsControl.CopyItemsToShoppingList(m_CopyCartItemsControl_ItemList, shoppingListName, m_copyCartItemsState.source, m_copyCartItemsState.teaLeafId, m_copyCartItemsState.teaLeafHId, m_copyCartItemsState.sourceType, m_copyCartItemsState.sourceName, CopyCartItemsCallback, null, null, null, CopyCartItemsTimeout);
    
    return false;
}

function CopyToNewShoppingList()
{
    var txtNewShoppingList = document.getElementById(m_copyCartItemsState.txtNewShoppingListId);
    
    if (txtNewShoppingList.value.toLowerCase() != m_copyCartItemsState.newListText.toLowerCase())
    {
        if (txtNewShoppingList)
        {
            CopyToShoppingList(txtNewShoppingList.value);
        }
    }
    else
    {
        var lblMessage = document.getElementById(m_copyCartItemsState.lblMessageId);
        
        if (lblMessage)
        {
            lblMessage.innerHTML = m_copyCartItemsState.newListMessage;
            lblMessage.style.color = "red";
            var anim = new YAHOO.util.ColorAnim(lblMessage, {backgroundColor: { from:"#eae0d7", to:"#ffffff" } }, 2);
            anim.animate();
            var focusString = "document.getElementById('" + m_copyCartItemsState.txtNewShoppingListId + "').focus();";
            var selectString = "document.getElementById('" + m_copyCartItemsState.txtNewShoppingListId + "').select();";
            setTimeout(focusString, 1);
            setTimeout(selectString, 1);
        }
    }

    return false;
}

function CopyToScheduledOrder(profileNumber)
{
    Quixtar.Web.UI.WebControls.Order.CopyCartItemsControl.CopyItemsToScheduledOrder(m_CopyCartItemsControl_ItemList, profileNumber, m_copyCartItemsState.source, m_copyCartItemsState.teaLeafId, m_copyCartItemsState.teaLeafHId, CopyCartItemsCallback, null, null, null, CopyCartItemsTimeout);
    
    return false;
}

function CopyToNewScheduledOrder()
{
    var context = new CopyCartItemsContext(false, m_copyCartItemsState.newDittoUrl);
    Quixtar.Web.UI.WebControls.Order.CopyCartItemsControl.CopyItemsToNewScheduledOrder(m_CopyCartItemsControl_ItemList, m_copyCartItemsState.source, m_copyCartItemsState.teaLeafId, m_copyCartItemsState.teaLeafHId, CopyCartItemsCallback, context, null, null, CopyCartItemsTimeout);
    
    return false;
}

function CopyToScheduledOrderIManage()
{
    var context = new CopyCartItemsContext(false, m_copyCartItemsState.orderIManageDittoUrl);
    Quixtar.Web.UI.WebControls.Order.CopyCartItemsControl.CopyItemsToScheduledOrderIManage(m_CopyCartItemsControl_ItemList, m_copyCartItemsState.source, m_copyCartItemsState.teaLeafId, m_copyCartItemsState.teaLeafHId, CopyCartItemsCallback, context, null, null, CopyCartItemsTimeout);
    
    return false;
}

function CopyToSalesReport()
{
    Quixtar.Web.UI.WebControls.Order.CopyCartItemsControl.CopyItemsToSalesReport(m_CopyCartItemsControl_ItemList, m_copyCartItemsState.source, m_copyCartItemsState.teaLeafId, m_copyCartItemsState.teaLeafHId, m_copyCartItemsState.sourceType, m_copyCartItemsState.sourceName, CopyCartItemsCallback, null, null, null, CopyCartItemsTimeout);
    
    return false;
}

// Callback function for all of the copy items methods
function CopyCartItemsCallback(ajaxResponse)
{
    if (ajaxResponse.error != null)
    {
        if (ajaxResponse.error.Status == 302)
        {
            document.forms[0].submit();
        }
        else
        {
            alert(ajaxResponse.error.Message);
            LogAjaxError(ajaxResponse.error, ajaxResponse);
        }
    }
    else
    {
        var lblMessage = document.getElementById(m_copyCartItemsState.lblMessageId);
        
        if (lblMessage)
        {
            lblMessage.innerHTML = m_copyCartItemsState.copyMessage;
            lblMessage.style.color = "green";
            var anim = new YAHOO.util.ColorAnim(lblMessage, {backgroundColor: { from:"#eae0d7", to:"#ffffff" } }, 2);
            anim.animate();
        }
        
        if (ajaxResponse.context)
        {
            if (ajaxResponse.context.refreshCartCount == true)
            {
                // Refresh cart item count in the page header
                if (typeof(CIC_UpdateCount) == "function")
                {
                    CIC_UpdateCount();
                }
            }
            
            if (ajaxResponse.context.redirectUrl != '')
            {
                window.location.href = ajaxResponse.context.redirectUrl;
            }
        }
    }
}

function CopyCartItemsTimeout()
{
    document.body.style.cursor = "default";
    document.forms[0].submit();
}

function getAbsoluteLeft(e)
{
	return YAHOO.util.Dom.getX(e);
}

function getAbsoluteTop(e)
{
    return YAHOO.util.Dom.getY(e);
}
/* *********** End Quixtar.Web.UI.WebControls.Order.Resources.ClientScripts.CopyCartItemsControl.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.PVBVStar.js  from Quixtar.Web.UI.WebControls, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
function PVBVStarDisplayToggle (node, strTextID) {
	while (node.id != 'divPVBVStarParent') {
		node = node.parentNode;
	}
	
	var nodeText = SearchChildNodes(node, strTextID, true);
	if (!nodeText) { return; }
	
	nodeText.style.display = (nodeText.style.display == '') ? 'none' : '';
}

function SearchChildNodes(node, strSearch, blnRecurse) {
	try {
		var node;
		
		if (node.hasChildNodes()) {
			for (var i=0; i<node.childNodes.length; i++) {
				nodeChild = node.childNodes[i];
				if (nodeChild.nodeType != 1) continue;	// For Mozilla browsers
				
				if (nodeChild.id.search(strSearch) > 0) {
					return nodeChild;
				} else if (blnRecurse && nodeChild.hasChildNodes()) {
					nodeChild = SearchChildNodes(nodeChild, strSearch, blnRecurse);
					if (nodeChild) {
						return nodeChild;
					}
				}
			}
		}
		
		return null;
	} catch (ex) {
		alert(ex);
		// Do nothing
	}
}
/* *********** End Quixtar.Web.UI.WebControls.PVBVStar.js  from Quixtar.Web.UI.WebControls, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.Order.Resources.ProductControls.ClientScripts.ThumbnailBase.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
YAHOO.namespace('quixtar.controls');
(function() {
	var Event = YAHOO.util.Event,
		Dom = YAHOO.util.Dom;
	
	/**********************************************************
	 * ThumbnailBase                                          *
	 *                                                        *
	 * Acts as a base class for sub-classes to inherit from   *
	 * and extend thumbnail functionality from.               *
	 *                                                        *
	 **********************************************************/
	YAHOO.quixtar.controls.ThumbnailBase = function(thumbnailID) {
		// Properties
		this.ID = thumbnailID;
		this.Control = Dom.get(thumbnailID);
		this.HasErrors = false;
		this.Items = [];
		this.ActionMessageContentObject = null;
		this.ActionMessageToggleObject = null;
		this.ActionProgressImageToggleObject = null;
		this.CheckForFinancing = true;
		this.FinancingPopupID = null;
		this.FinancingPopUpPerformingAdd = false;
		this.FinancingContractTypeCode = null;
		this._financingHasBeenChecked = false;
		this._financingCartHasBeenAdded = false;
		
		// Initialize this object.
		this._initialize();
	};
	
	// Augment ThumbnailBase with the EventProvider functionality
	YAHOO.lang.augmentProto(YAHOO.quixtar.controls.ThumbnailBase, YAHOO.util.EventProvider); 
	
	// Static methods and properties
	YAHOO.quixtar.controls.ThumbnailBase.ActiveThumbnail = null;
	YAHOO.quixtar.controls.ThumbnailBase.ActiveWindow = null;
	
	YAHOO.quixtar.controls.ThumbnailBase.PopulateCopyItem = function() {
		var active = YAHOO.quixtar.controls.ThumbnailBase.ActiveThumbnail;
		try {
			if (active && !active.HasErrors) {
				active.CopyItemPopulateMethod(active);
			}
		} catch (ex) {
			if (active) { active.HasErrors = true; }
			alert("PopulateCopyItem: " + ex);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.OpenWindow = function(URL) {
		var _window = YAHOO.quixtar.controls.ThumbnailBase.ActiveWindow;
		
		if (_window == null || _window.closed) {
			_window = window.open (URL, 'Document','height=475,width=800,fullscreen=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no,top=40,left=35' );
		} else {
			var lastURL = _window.location.href
			// lastURL will contain the domain while strURL is usually relative, so only compare the URLs without the domain.
			if (lastURL.substring(lastURL.length - strURL.length) != strURL) {
				_window.location.href = strURL;
			}
		}
		
		_window.focus();
		YAHOO.quixtar.controls.ThumbnailBase.ActiveWindow = _window;
	};
	
	// Abstract methods below ...
	YAHOO.quixtar.controls.ThumbnailBase.prototype.ClickEvent = function(sender) {
		throw("'ClickEvent' is abstract and must be overridden.");
	};
	
	// Overridable methods below ...
	YAHOO.quixtar.controls.ThumbnailBase.prototype._initialize = function() {
		// Events
		this.createEvent('itemAdded');
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.GetItemNumber = function() {
		return this.Control.getAttribute('itemno');
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.GetClientID = function() {
		return (this.Control) ? this.Control.id : "";
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.AddItems = function(cartType, cartName, orderSourceType, orderSourceValue) {
		try {
			var TB = YAHOO.quixtar.controls.ThumbnailBase;
			
			if (!this.HasErrors && this.Items.length > 0) {
				// Initialize AJAX helper
				ajaxInit();

				for (var i=0; i < this.Items.length; i++) {
					var item = this.Items[i];
					
					var DTO = {
						Thumbnail : this,
						Item : item,
						CartType : cartType,
						CartName : cartName,
						OrderSourceType : orderSourceType,
						OrderSourceValue : orderSourceValue
					};
					
					// Check to see if it qualifies for financing
					if (this.CheckForFinancing && !this._financingHasBeenChecked) {
						this._financingHasBeenChecked = true;
						Quixtar.Web.UI.WebControls.Order.AjaxUtility.GetFinancing(item.ItemNumber, this.CheckForFinancing_CB, DTO);
					} else {
						var response = {
							context : DTO,
							error : false,
							value : (this._financingHasBeenChecked) ? this.FinancingContractTypeCode : null
						};
						this.CheckForFinancing_CB(response);
					}
				}
			}
			
			if (this.HasErrors && this.ActionMessageContentObject && this.ActionMessageContentObject.innerHTML === '') {
				// There's an error, but no message has been given to display, so just display a generic error message.
				this.DisplayMessage(TB_ErrorGeneric);
			}
		} catch (ex) {
			alert("AddItems: " + ex);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.CheckForFinancing_CB = function(response) {
		if (response) {
			var DTO = response.context,
				thumbnail = DTO.Thumbnail;
				
			if (!response.error) {
				thumbnail.FinancingContractTypeCode = response.value;
				
				if (!thumbnail.FinancingPopUpPerformingAdd
					&& thumbnail.FinancingContractTypeCode
					&& typeof(ShowPopUp) == "function"
					&& thumbnail.FinancingPopupID) {
					
					// this item qualifies for financing
					ShowPopUp(thumbnail.FinancingPopupID, null);
				} else {
					thumbnail.FinancingPopUpPerformingAdd = false;	// Reset the financing performing add switch
					thumbnail.PerformAddItem(DTO);
				}
			}
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.PerformAddItem = function(DTO) {
		if (!DTO.CartName) { DTO.CartName = ""; }	// If cartName is null, default it to empty; this is allowed
		
		// start the progress image
		this.ShowProgress();
		
		if (DTO.Item.SizeColorCode) {
			Quixtar.Web.UI.WebControls.Order.AjaxUtility.AddItemWithSizeColorAndName(DTO.Item.ItemNumber, DTO.Item.SizeColorCode, DTO.Item.Quantity, DTO.CartType, DTO.CartName, DTO.OrderSourceType, DTO.OrderSourceValue, DTO.Thumbnail.AddItems_CB, DTO);
		} else {
			Quixtar.Web.UI.WebControls.Order.AjaxUtility.AddItemWithName(DTO.Item.ItemNumber, DTO.Item.Quantity, DTO.CartType, DTO.CartName, DTO.OrderSourceType, DTO.OrderSourceValue, DTO.Thumbnail.AddItems_CB, DTO);
		}
		
		// register tealeaf event
		try {
			if (TB_TealeafID != null && TB_TealeafSource != null && TB_TealeafDest != null) {
				if (TB_CategoryId == "none") {
					TB_CategoryId = '';
				}
				
				// Log to TeaLeaf asynchronously.
				Quixtar.Web.TeaLeaf.TeaLeafHelper.RaiseTeaLeafAddEvent(TB_TealeafSource * 1, TB_TealeafDest * 1, TB_CategoryId, [DTO.Item.ItemNumber], TB_TealeafID, TB_TealeafHID, '', TB_TealeafIMC, 0, function(){});
			}
		} catch (err) {
			// if the tealeaf does not happen move on
			DTO.Thumbnail.HasErrors = true;
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.AddItems_CB = function(response) {
		try {
			if (response) {
				var DTO = response.context,
				thumbnail = DTO.Thumbnail;
				if (!response.error) {
					if (response.value.IsOperationSuccessful) {

					    // display special link for items added to finance cart
					    
					    var displayedListTxt = TB_ItemAdded;
					    
					    if(thumbnail._financingCartHasBeenAdded) {
					        thumbnail._financingCartHasBeenAdded = false;
					        displayedListTxt = TB_FinanceItemAdded;
					    }
					    
					    var urlStr = Quixtar.Web.UI.WebControls.Order.AjaxUtility.GetItemAddCartNavigateUrl(displayedListTxt, DTO.CartName, DTO.CartType);

						if (urlStr !== null && urlStr.value.length > 0) {
						    thumbnail.DisplayMessage(urlStr.value);
						}

						// Update and repaint the View Cart count if it exists.
						if (typeof(CIC_UpdateCount) == "function") {
							CIC_UpdateCount();
						}
						
						thumbnail.OnItemAdded(response);
						thumbnail.fireEvent("itemAdded", response);
					} else {
						thumbnail.HasErrors = true;
						if (response.value.WarningMessage !== null && response.value.WarningMessage.length > 0) {
							thumbnail.DisplayMessage(response.value.WarningMessage);
						}
					}
				} else {
					thumbnail.HasErrors = true;
				}
				
				try {
					HandleMetricsEvent(response);
				} catch (ex) { }
			}
		} catch (exp) {
			alert("AddItems_CB: " + exp);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.OnItemAdded = function(response) {
		try {
			var anim = new YAHOO.util.ColorAnim(this.ActionMessageToggleObject, {backgroundColor: { from:"#eae0d7", to:"#ffffff" } }, 2);
			anim.animate();
		} catch (ex) {
			alert("OnItemAdded: " + ex);
		}
	};

	YAHOO.quixtar.controls.ThumbnailBase.prototype.DisplayMessage = function(message) {
		try {
			if (this.ActionMessageContentObject && this.ActionMessageToggleObject) {
			    this.HideProgress();
				this.ActionMessageContentObject.innerHTML = message;
				this.ActionMessageToggleObject.style.display = 'block';
			}
		} catch (ex) {
			alert("DisplayMessage: " + ex);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.HideMessage = function() {
		try {
			if (this.ActionMessageContentObject && this.ActionMessageToggleObject) {
				this.ActionMessageContentObject.innerHTML = '';
				this.ActionMessageToggleObject.style.display = 'none';
			}
		} catch (ex) {
			alert("HideMessage: " + ex);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.ShowProgress = function () {
	    try {
	        if (this.ActionProgressImageToggleObject && this.ActionMessageToggleObject) {
	            this.HideMessage();
	            this.ActionProgressImageToggleObject.style.display = 'block';
	            this.ActionMessageToggleObject.style.display = 'block';
	        }
	    } catch (ex) {
	        alert("Show Progress: " + ex);
	    }
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.HideProgress = function () {
	    try {
	         if (this.ActionProgressImageToggleObject && this.ActionMessageToggleObject) {
                this.ActionProgressImageToggleObject.style.display = 'none';
                this.ActionMessageToggleObject.style.display = 'none';
	         }
	    } catch (ex) {
	        alert("Hide Progress: " + ex);
	    }
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.CopyItemPopulateMethod = function(thumbnail) {
		try {
			var arrDTOs = [];
			
			for (i=0; i < thumbnail.Items.length; i++) {
				var dto = new ItemDTO();
				var item = thumbnail.Items[i];
				
				dto.ItemNo = item.ItemNumber;
				dto.ItemQuantity = item.Quantity;
				dto.SizeColor = item.SizeColorCode;
				
				arrDTOs.push(dto);
			}
			
			if (arrDTOs.length > 0) {
				m_CopyCartItemsControl_ItemList = arrDTOs;
			}
		} catch (ex) {
			thumbnail.HasErrors = true;
			alert("CopyItemPopulateMethod: " + ex);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.ShowListsPopup = function(evt, sender) {
		try {
			if (!this.HasErrors) {
				this.HideMessage();
				CopyCartItems_ShowLists(evt, sender);
			}
		} catch (ex) {
			this.HasErrors = true;
			alert("ShowListsPopup: " + ex);
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.prototype.ShowAvailabilityHelp = function(sender) {
		try {
			var popupID = sender.getAttribute("popupid");
			if (popupID != null) {
				ShowPopUp(popupID);
			}
		} catch (ex) {
			this.HasErrors = true;
			this.DisplayMessage(TB_ErrorGeneric);
		}
	};
	
	/**********************************************************
	 * ThumbnailItem                                          *
	 *                                                        *
	 * Encapsulates an item object that can be added to any   *
	 * ordering destination.                                  *
	 *                                                        *
	 **********************************************************/
	YAHOO.quixtar.controls.ThumbnailBase.ThumbnailItem = function() {
		// Properties
		this.ItemNumber = null;
		this.Quantity = null;
		this.SizeColorCode = null;
	};
	
	/**********************************************************
	 * ThumbnailSet                                           *
	 *                                                        *
	 * Encapsulates an item object that can be added to any   *
	 * ordering destination.                                  *
	 *                                                        *
	 **********************************************************/
	YAHOO.quixtar.controls.ThumbnailBase.ThumbnailSet = function() {
		// Properties
		this.Thumbnails = {};
		Event.addListener(document, 'click', this._clickEvent, this, true);
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.ThumbnailSet.prototype._clickEvent = function (e, obj) {
		var sender = Event.getTarget(e),
			thumbID = sender.getAttribute('thumbid'),
			count = 0;
		
		// If we can't find it, look up the stack (StyledButtons, among other controls,
		// can be clicked on either the SPAN or parent A tag)
		while (!thumbID && count < 10 && sender.parentNode != document) {
			sender = sender.parentNode;
			thumbID = sender.getAttribute('thumbid');
			count++;
		}
		
		if (thumbID) {
			var thumbnail = this.Thumbnails[thumbID];
			if (thumbnail) {
				thumbnail.ClickEvent(sender);
			}
		}
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.ThumbnailSet.prototype.Add = function (thumbnail) {
		this.Thumbnails[thumbnail.ID] = thumbnail;
	};
	
	YAHOO.quixtar.controls.ThumbnailBase.ThumbnailSet.prototype.Remove = function (thumbnail) {
		delete this.Thumbnails[thumbnail.ID];
	};
})();
/* *********** End Quixtar.Web.UI.WebControls.Order.Resources.ProductControls.ClientScripts.ThumbnailBase.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.CoreMetricsMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
// This function interprets an itemDTO object returned for various AjaxUtility class calls.
// It calls a cm function (coremetrics provided) to generate <img> tags that send data to CM.
// If CoreMetrics is switched out, this function will need to be modified.
function HandleMetricsEvent(itemDTO) {
	try {
		cmCreateShopAction5Tag( itemDTO.value.ItemNo, 
		                        itemDTO.value.NameNoHTML, 
		                        itemDTO.value.ItemQuantity,
		                        itemDTO.value.DisplayPrice,
		                        itemDTO.value.MetricsCatId); 
		cmDisplayShop5s();
	} catch (ex) {
		// Swallow any exceptions as we do not want tagging problems to impact site performance
	}
}

function HandleMetricsUpdateEvent(itemUpdateDTO) {
	try {
	    // We are only interested in updates if the quantity has changed...
	    if(itemUpdateDTO.ItemQuantity != itemUpdateDTO.OriginalItemQuantity)
	    {
		    cmCreateShopAction5Tag( itemUpdateDTO.ItemNumber, 
		                            itemUpdateDTO.ItemDescription, 
		                            itemUpdateDTO.ItemQuantity,
		                            itemUpdateDTO.ItemDisplayPrice,
		                            itemUpdateDTO.MetricsCatId); 
		    cmDisplayShop5s();
		}
	} catch (ex) {
		// Swallow any exceptions as we do not want tagging problems to impact site performance
	}
}
/* *********** End Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.CoreMetricsMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.HelperMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
YAHOO.namespace ("Quixtar.Web.UI.CS.ClientScriptHelper");

YAHOO.Quixtar.Web.UI.CS.ClientScriptHelper.HelperMethods = {
	StopClick: function(evt) {
		if (!evt) {
			evt = window.event;
		}
		
		//evt.cancelBubble is supported by IE - this will kill the bubbling process.
		evt.cancelBubble = true;
		evt.returnValue = false;

		//evt.stopPropagation works only in Firefox.
		if (evt.stopPropagation) {
			evt.stopPropagation();
			evt.preventDefault();
		}
	}
};
/* *********** End Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.HelperMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.ValidationMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
function ValidateNumber(e) {
	if (window.event) {
		e = window.event;
	}

	if (e.keyCode) {
		code = e.keyCode;
	} else if (e.which) {
		code = e.which;
	}

	// Attempt to allow function keys, and edit keys
	if (e.charCode == 0) { return; }

	// Attempt to disallow the shift key.
	if (e.shiftKey) {
		e.preventDefault ? e.preventDefault() : e.returnValue = false;
	}

	// Only allow numbers (no decimal, etc )
	if ((code < 48 || code > 57)) {
		e.preventDefault ? e.preventDefault() : e.returnValue = false;
	}
}
/* *********** End Quixtar.Web.UI.Resources.ClientScriptHelper.ClientScripts.ValidationMethods.js  from Quixtar.Web.UI.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.Order.Resources.ProductControls.ClientScripts.Thumbnail.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
YAHOO.namespace('quixtar.controls');
(function() {
	var Event = YAHOO.util.Event,
		Dom = YAHOO.util.Dom;

	YAHOO.util.Event.onDOMReady(function() {
		YAHOO.quixtar.controls.Thumbnail = function(thumbnailID) {
			// chain the constructors
			YAHOO.quixtar.controls.Thumbnail.superclass.constructor.apply(this, [thumbnailID]);
			
			this.ActionMessageContentObject = Dom.get(thumbnailID + '_lblActionMessage');
			this.ActionMessageToggleObject = Dom.get(thumbnailID + '_divActionMessage');
			this.ActionProgressImageToggleObject = Dom.get(thumbnailID + '_imgCartItemAddInProgress');
			this.FinancingPopupID = thumbnailID + '_popupFinancing';
			this.PrinterFriendlyPageURL = '/products/printflyer.aspx?itemno=' + this.GetItemNumber();
		}
		YAHOO.lang.extend(YAHOO.quixtar.controls.Thumbnail, YAHOO.quixtar.controls.ThumbnailBase);
		
		// Overrides
		YAHOO.quixtar.controls.Thumbnail.prototype.ClickEvent = function(sender) {
			// Reset error flag
			this.HasErrors = false;
			
			if (YAHOO.env.ua.ie > 0 && this.Control.parentNode.nodeName == "LI") {
				// IE only fix: IE improperly manages zIndex values for absolutely positioned children of relative elements.
				// Instead of using the correct zIndex value applied to the element, it uses the relatively positioned element's
				// value causing all kinds of headaches.  If this thumbnail was placed in a thumbnail list (parent is an LI), then
				// we dynamically manage the zIndexes of the LI's in the list to be sure that wherever we have clicked is the top-most
				// zIndex value.
				var li = this.Control.parentNode,
					ul = li.parentNode,
					allLIs = ul.getElementsByTagName("LI");
				
				for (var i=0; i<allLIs.length; i++) {
					allLIs[i].style.zIndex = 0;
				}
				li.style.zIndex = 999;
			}
			
			if (sender.id.indexOf('btnCart') > -1) {
				var cartType = sender.getAttribute('carttype'),
					cartName = sender.getAttribute('cartname');
				
				this.PopulateItems(sender);
				this.AddItems(cartType,
							cartName,
							(typeof(TB_SourceType) === "undefined") ? "" : TB_SourceType,
							(typeof(TB_SourceName) === "undefined") ? "" : TB_SourceName);
			} else if (sender.id.indexOf('btnShopAndDitto') > -1) {
				YAHOO.quixtar.controls.ThumbnailBase.ActiveThumbnail = this;
				this.PopulateItems(sender);
				
				// check to see if personalization required
				if (!this.HasErrors) {
					// If we're adding multiple items at once, ignore the personalization check.  Today only swatches add multiple items at
					// once, and swatches aren't personalized items.  If we ever allow multiple items to be added for other types of items,
					// this will have to change to somehow figure out what to do if some items can be personalized.
					if (this.Items.length === 1) {
						var isPersonalizedSku = Quixtar.Web.UI.WebControls.Order.AjaxUtility.IsPersonalizationRequired(this.Items[0].ItemNumber);
						if (isPersonalizedSku != null && isPersonalizedSku.value) {
							this.DisplayMessage(TB_DittoNotAllowedPersonalized);
						} else {
							this.ShowListsPopup(null, sender);
						}
					} else {
						this.ShowListsPopup(null, sender);
					}
				}
			} else if (sender.id.indexOf('btnFinAddToCart') > -1 || sender.id.indexOf('btnFinAddToFinance') > -1) {
				if (this.FinancingPopupID) {
					HidePopUp(this.FinancingPopupID);
				}
				
				var cartType = sender.getAttribute('carttype'),
					cartName = sender.getAttribute('cartname');
					
				if (sender.id.indexOf('btnFinAddToFinance') > -1) {
					cartName = this.FinancingContractTypeCode;
					this._financingCartHasBeenAdded = true;
				}
				
				this.FinancingPopUpPerformingAdd = true;
				this.PopulateItems(sender);
				this.AddItems(cartType, cartName, TB_SourceType, TB_SourceName);
			} else if (sender.id.indexOf('hlpAvailability') > -1) {
				this.ShowAvailabilityHelp(sender);
			} else if (sender.id.indexOf('hypPrint') > -1) {
				YAHOO.quixtar.controls.ThumbnailBase.OpenWindow(this.PrinterFriendlyPageURL);
			}
		};
		
		// New Methods
		YAHOO.quixtar.controls.Thumbnail.prototype.PopulateItems = function(sender) {
			try {
				this.Items.clear();
				
				var item = new YAHOO.quixtar.controls.ThumbnailBase.ThumbnailItem();
				item.ItemNumber = this.GetItemNumber();
				
				var obj = Dom.get(this.ID + '_tbxQty');
				if (obj) {
					item.Quantity = obj.value * 1;	// Cast to integer
				} else {
					item.Quantity = 1;
				}
				
				var obj = Dom.get(this.ID + '_ddlSizeColor_hdnSelected');
				if (obj) {
					if (obj.value != null && obj.value.length > 0) {
						item.SizeColorCode = obj.value;
					} else {
						this.DisplayMessage(TB_ErrorSizeColor);
						this.HasErrors = true;
					}
				}

				if (!this.HasErrors) {
					this.Items.push(item);
				}
			} catch (ex) {
				this.HasErrors = true;
				this.DisplayMessage(TB_ErrorGeneric);
			}
		};
	});
})();
/* *********** End Quixtar.Web.UI.WebControls.Order.Resources.ProductControls.ClientScripts.Thumbnail.js  from Quixtar.Web.UI.WebControls.Order.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.Resources.ClientScripts.StyledButton.js  from Quixtar.Web.UI.WebControls.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
var SB_IsActive = false;

window.onresize = UpdateBackgroundSize;

try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}

function SB_CheckPageValid(causesValidation, validationGroup) {

    if (causesValidation && typeof(Page_ClientValidate) == 'function')
    {
        if (validationGroup != null && validationGroup.length > 0)
        {
            return Page_ClientValidate(validationGroup);
        }
        else
        {
            return Page_ClientValidate();
        }
    }
    
    return true;
}

function SB_HandleSpacebar(e, sender) {
	if (YAHOO.util.Event.getCharCode(e) == 32) {
		sender.onclick();
	}
}

function DoOverlay(causesValidation, validationGroup) {
	var div = document.getElementById(GBL_STYLED_OVERLAY_DIV);
	
	// do not overlay if page is not valid
	if (!SB_CheckPageValid(causesValidation, validationGroup)) {
	    return false;
	}

	if (div) {
		SB_IsActive = true;
		
		// We need to turn off drop downs (selects) for IE 6 and below
		if (navigator.appVersion.indexOf("MSIE") != -1) {
			var temp = navigator.appVersion.split("MSIE");
			var version = parseFloat(temp[1]);
			if (version <= 6) {
				var selects = document.getElementsByTagName("SELECT");
				for (var i=0; i<selects.length; i++) {
					selects[i].style.visibility = 'hidden';
				}
			}
		}
		
		UpdateBackgroundSize();
		
		div.style.cursor = 'wait';
		div.style.display = 'inline';
	}
	
	return true;
}

function HideOverlay ()  {

    var div = document.getElementById(GBL_STYLED_OVERLAY_DIV);
    
    if (div) {
        div.style.cursor = 'default';
		div.style.display = 'none';
    }
}

function UpdateBackgroundSize() {
	var div;
	
	if (typeof(GBL_STYLED_OVERLAY_DIV) != "undefined") {
		div = document.getElementById(GBL_STYLED_OVERLAY_DIV);
	}
	
	if (SB_IsActive && div) {
		var viewportHeight = YAHOO.util.Dom.getViewportHeight();
		var height;
		
		if (document.body.scrollHeight > document.body.offsetHeight) {
			// all but Explorer Mac
			height = document.body.scrollHeight;
		} else { 
			// Explorer Mac, would also work in Explorer 6 Strict, Mozilla and Safari
			height = document.body.offsetHeight;
		}
		
		div.style.height = ((height > viewportHeight) ? height : viewportHeight) + "px";
		div.style.width = YAHOO.util.Dom.getViewportWidth() + "px";
	}
}

function StyledButtonEnable(enabled, context)
{
    //hack for new StyledButtons
    var linkButton = document.getElementById(context + "_Button");
    var text = document.getElementById(context + "_lblText");

    if (enabled)
    {
        linkButton.disabled = false;
        text.className = "enabled";
    }
    else
    {
        linkButton.disabled = true; 
        text.className = "disabled";
    }
}

/* *********** End Quixtar.Web.UI.WebControls.Resources.ClientScripts.StyledButton.js  from Quixtar.Web.UI.WebControls.CS, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.PopUpHelp.js  from Quixtar.Web.UI.WebControls, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
//************************************************************
//* Depracated. Use SetPopUpContent in PopUp.js instead.
//************************************************************
function SetHelpContent ( id, strText )
{
    SetPopUpContent ( id, strText );
}

//************************************************************
//* 
//************************************************************
function GetHelpContent ( strId )
{
    for ( var x = 0; x < m_gPopUp.PopUpContent.length; x++ )
        {
        if ( strId == m_gPopUp.PopUpContent[x].HelpId )
            {
            return m_gPopUp.PopUpContent[x].HelpContent;
            }
        }

    return null;        
}

//************************************************************
//* This is for getting content from Interwoven
//************************************************************
function GetInterWovenContent ( id, strPid, strContentId )
{
	var strContent = GetHelpContent ( strPid );
	
	if ( typeof strContent != "string" )
	    {
	    var contextObj = new Object();
	    contextObj.ControlId = id;
	    contextObj.PageId = strPid;
	    contextObj.ContentId = strContentId;
	    AJAXGetHelpContent ( strPid, strContentId, contextObj );
	    }

	var obj = GetPopUpObject ( id );
	
	if ( obj != null )
	    {
	    obj.BodyContent = strContent;
	    }
}

//************************************************************
//* This calls the ajax method on the content class (Interwoven Content Manager v1)
//************************************************************
function AJAXGetHelpContent ( strId, strContentId, contextObj )
{
	try
		{
		ajaxInit();
		Quixtar.Web.UI.WebControls.content.getAJAXContent ( strId, strContentId, "", m_gPopUp.LanguageCode, m_gPopUp.CountryCode, m_gPopUp.BusinessNature, HandleAJAXResponse, contextObj );
		}
	catch ( ex )
		{
		SetPopUpContent ( objResponse.context.ControlId, "Error Retrieving Help Contents: " + ex.description );
		}		
}

function HandleAJAXResponse ( objResponse )
{
	if ( ( objResponse.value != null ) && ( objResponse.value.length > 0 ) && ( objResponse.value.toLowerCase() != "no content found" ) )
		{
		RegisterHelpContent ( objResponse.context.PageId + objResponse.context.ContentId, objResponse.value );
		SetPopUpContent ( objResponse.context.ControlId, objResponse.value );
		}
	else
		{
		SetPopUpContent ( objResponse.context.ControlId, "Help contents for id '" + objResponse.context.PageId + "' not found." );
		}		
}

//************************************************************
//* This is for getting content from SiteMap (Interwoven Content Manager v2).
//************************************************************
function GetSiteMapContent ( strPopUpId, strDetailKey, strContentKey )
{
	var strContent = GetHelpContent ( strDetailKey + strContentKey );
	
	if ( typeof strContent != "string" )
	    {
   	    var contextObj = new Object();
	    contextObj.ControlId = strPopUpId;
	    contextObj.DetailKey = strDetailKey;
	    contextObj.ContentKey = strContentKey;
	    AJAXGetSiteMapContent ( strDetailKey, strContentKey, contextObj );
	    }

	var obj = GetPopUpObject ( strPopUpId );
	
	if ( obj != null )
	    {
	    obj.BodyContent = strContent;
	    }
}

//************************************************************
//* This is for getting content from SiteMap
//************************************************************
function AJAXGetSiteMapContent ( strDetailKey, strContentKey, contextObj )
{
    try
        {
        Quixtar.Web.UI.WebControls.content.GetAjaxSiteMapContent ( strDetailKey, strContentKey, HandleAJAXSitemapResponse, contextObj );
        }
    catch ( ex )
        {
		SetPopUpContent ( objResponse.context.ControlId, "Error Retrieving Sitemap ContentKey: " + objResponse.context.ContentKey + " Exception: " + ex.description );
        }        
}

function HandleAJAXSitemapResponse ( objResponse )
{
	if ( ( objResponse.value != null ) && ( objResponse.value.length > 0 ) )
		{
		RegisterHelpContent ( objResponse.context.DetailKey + objResponse.context.ContentKey, objResponse.value );
		SetPopUpContent ( objResponse.context.ControlId, objResponse.value );
		}
	else
		{
		SetPopUpContent ( objResponse.context.DetailKey + objResponse.context.ContentKey, "SiteMap content for key '" + objResponse.context.ContentKey + "' not found." );
		}		
}

function RegisterHelpContent ( strId, strContent )
{
    m_gPopUp.PopUpContent[m_gPopUp.PopUpContent.length] = new PopUpContent ( strId, strContent );
}

function PopUpContent ( strId, strContent )
{
    this.HelpId = strId;
    this.HelpContent = strContent;
}

/* *********** End Quixtar.Web.UI.WebControls.PopUpHelp.js  from Quixtar.Web.UI.WebControls, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* *********** Begin Quixtar.Web.UI.WebControls.PopUp.js  from Quixtar.Web.UI.WebControls, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
/* PopUp.js */

//************************************************************
//*  This contains all properties, and the collection of popups.
//************************************************************
function PopUpGlobals ( strCountryCode, strLanguageCode, strBusinesNature )
{
    this.PopUp = new Array;
    this.PopUpContent = new Array;
    this.PopupZIndex = 50;
    this.PageElements = new Array(0);
    this.CountryCode = strCountryCode;
    this.LanguageCode = strLanguageCode;
    this.BusinessNature = strBusinesNature;
    this.FlashBorderCount = 0;
    this.FlashBorderSwitch = true;
}

//************************************************************
//* Note: This is the base popup object definition
//************************************************************
function PopUp ( strId, strOuterContainerId, strTitleId, strTitleTextId, strTitleTextLabelId, strInnerContainerId, strBodyContentId, intLeftPosition, intTopPosition, intCurrentWidth, intCurrentHeight, intFloatDirection, strPopupButtonId, bAutoHideClientDropDowns, bModalDialogBehavior, strModalDialogDivId, strModalDialogImageId )
{
    this.id = strId;
    this.OuterContainerId = strOuterContainerId;
    this.TitleId = strTitleId;
    this.TitleTextId = strTitleTextId;
    this.TitleTextLabelId = strTitleTextLabelId;
    this.InnerContainerId = strInnerContainerId; 
    this.BodyContentId = strBodyContentId;
    this.BodyContent = null;
    this.LeftPosition = intLeftPosition;
    this.TopPosition = intTopPosition;
    this.CurrentWidth = intCurrentWidth;
    this.CurrentHeight = intCurrentHeight;
    this.FloatDirection = intFloatDirection;
    this.PopupButtonId = strPopupButtonId;
    this.Visible = false;
    this.AutoHideClientDropDowns = bAutoHideClientDropDowns;
    this.ModalDialogBehavior = bModalDialogBehavior;
    this.ModalDialogChildren = null;
    this.ManageDOMDisplay = ( bAutoHideClientDropDowns || bModalDialogBehavior );
	this.ModalDialogDivId = strModalDialogDivId;
	this.ModalDialogImageId = strModalDialogImageId;
	this.ModalReposition = { Repositioned: false, Top: 0, Left: 0 };
   
    this.Content = function ( strContent, event ) { SetPopUpContent ( this.id, strContent ); };
    this.Show = function ( event ) { ShowPopUp ( this.id, event ); }; 
    this.Hide = function ( event ) { HidePopUp ( this.id ); }; 
}

//************************************************************
//*
//************************************************************
function GetPopUpObject ( strId )
{
    for ( var x = 0; x < m_gPopUp.PopUp.length; x++ )
        {
        if ( strId == m_gPopUp.PopUp[x].id )
            {
            return m_gPopUp.PopUp[x];
            }
        }
}

//************************************************************
//*
//************************************************************
function SetPopUpContent ( strId, strText )
{
	var objPopUp = GetPopUpObject ( strId );
	
	if ( objPopUp != null )
	    {
	    objPopUp.BodyContent = strText;
	    
   		if ( objPopUp.BodyContent != null )
		    {
		    document.getElementById ( objPopUp.BodyContentId ).innerHTML = objPopUp.BodyContent;
		    }
	    }
}

//************************************************************
//*
//************************************************************
function ShowPopUp ( strId, evt )
{
    var bShowMessageBox = false;
    var objClicked = null;

    if ( typeof strId != "string" )
        {
        var ex = new Error ( 100, "ERROR 1: ShowPopUp(): Invalid parameter or parameter not supplied: strId");
        throw ex;			
        }

    if ( evt != null )
        {
	    objClicked = evt.srcElement ? evt.srcElement : evt.target;
	    }
    else
        {
        // User did not specify a client event, so set the 
        // default behavior to center on page.
        bShowMessageBox = true;
        }	    

	// Get the JavaScript object
	var objPopUp = GetPopUpObject ( strId );

    if ( objPopUp != null ) 
        {
        if ( objPopUp.ManageDOMDisplay )
            {
            RegisterPageElements();
            }
        }
    else
        {
        return;
        }        

    // Get the DOM object
	obj = document.getElementById ( objPopUp.OuterContainerId );

	if ( obj != null )
		{
		ProcessPageElements ( objPopUp );

		objPopUp.Visible = true;
		
		if ( objPopUp.BodyContent != null )
		    {
		    document.getElementById ( objPopUp.BodyContentId ).innerHTML = objPopUp.BodyContent;
		    }
		    
		var scrollCoords = getScrollCoords();
        var intLeftX = 0;
        var intTopY = 0;

        if ( bShowMessageBox )
            {
            objPopUp.FloatDirection = 5;
            }

        // Determine if the object needs to "float" towards a certain direction of the source object.
        switch ( objPopUp.FloatDirection )
            {
            // Default position
            case 0 :    intLeftX = parseInt ( scrollCoords.x + GetAbsoluteLeft ( objClicked ) + objClicked.offsetWidth + objPopUp.LeftPosition );
                        intTopY = parseInt ( scrollCoords.y + evt.clientY + objPopUp.TopPosition );
                        break;

            // Popup object attempts to float LEFT of source object.
            case 1 :    intLeftX = parseInt ( scrollCoords.x + ( GetAbsoluteLeft ( objClicked ) - objPopUp.CurrentWidth - objPopUp.LeftPosition ) );
                        intTopY = parseInt ( scrollCoords.y + evt.clientY + objPopUp.TopPosition );
                        break;

            // Popup object attempts to float RIGHT of source object (same as default).
            case 2 :    intLeftX = parseInt ( scrollCoords.x + GetAbsoluteLeft ( objClicked ) + objClicked.offsetWidth + objPopUp.LeftPosition );
                        intTopY = parseInt ( scrollCoords.y + evt.clientY + objPopUp.TopPosition );
                        break;

            // Popup object attempts to float TOP of source object.
            case 3 :    intLeftX = parseInt ( scrollCoords.x + GetAbsoluteLeft ( objClicked ) + ( objClicked.offsetWidth / 2 ) - ( objPopUp.CurrentWidth / 2 ) );
                        intTopY = parseInt ( GetAbsoluteTop ( objClicked ) - objPopUp.CurrentHeight - 20 );
                        break;

            // Popup object attempts to float BOTTOM of source object.
            case 4 :    intLeftX = parseInt ( scrollCoords.x + GetAbsoluteLeft ( objClicked ) + ( objClicked.offsetWidth / 2 ) - ( objPopUp.CurrentWidth / 2 ) );
                        intTopY = parseInt ( GetAbsoluteTop ( objClicked ) + objClicked.offsetHeight + 30 );
                        break;

            // Popup object attempts to CENTER itself on the page.
            case 5 :    var objFramed = GetFramesetOffSet();  // Added to support the iframe in LOS.
           
						if ( objFramed.isFramed )
							{
               				intLeftX = parseInt ( ( window.top.document.documentElement.clientWidth / 2 ) - ( objPopUp.CurrentWidth / 2 ) ) - ( objFramed.offsetLeft );
							intTopY = parseInt ( ( scrollCoords.y ) + ( window.top.document.documentElement.clientHeight / 2 ) - ( objPopUp.CurrentHeight / 2 ) ) - ( objFramed.offsetTop );
							}	
						else
							{
							intLeftX = parseInt ( ( document.documentElement.clientWidth / 2 ) - ( objPopUp.CurrentWidth / 2 ) );
							intTopY = parseInt ( ( scrollCoords.y ) + ( document.documentElement.clientHeight / 2 ) - ( objPopUp.CurrentHeight / 2 ) );
							}
                        break;

            // Popup object attempts to float BOTTOM and CENTER of the source object.
            case 6 :    intLeftX = parseInt ( ( document.documentElement.clientWidth / 2 ) - ( objPopUp.CurrentWidth / 2 ) );
                        intTopY = parseInt ( GetAbsoluteTop ( objClicked ) + objClicked.offsetHeight + 30 );
                        break;

            // Popup object attempts to float TOP and CENTER of the source object.
            case 7 :    intLeftX = parseInt ( ( document.documentElement.clientWidth / 2 ) - ( objPopUp.CurrentWidth / 2 ) );
                        intTopY = parseInt ( GetAbsoluteTop ( objClicked ) - objPopUp.CurrentHeight - 20 );
                        break;
            }

   		obj.style.left = intLeftX + "px";
    	obj.style.top = intTopY + "px";
		obj.style.zIndex = m_gPopUp.PopupZIndex++;

		if ( objPopUp.ModalDialogBehavior )
		    {
		    window.onresize = UpdateModalDialogBackground; 
            GetPopUpChildElements ( objPopUp );
          
            UpdateModalDialogBackground();
            
            if ( ( objPopUp.ModalReposition != null ) && ( objPopUp.ModalReposition.Repositioned ) )
				{
   				obj.style.left = ( ( Math.abs ( objPopUp.ModalReposition.Left ) - intLeftX ) * -1 ) + "px";
    			obj.style.top = ( intTopY - Math.abs ( objPopUp.ModalReposition.Top ) ) + "px";
				}
            }

		objDisplay ( objPopUp.id );
		}
}

//************************************************************
//* This is used for determining if the popup is a child of 
//* a frame. If so, return the offsetTop value.
//************************************************************
function GetFramesetOffSet()
{
	var intOffSetTop = 0;
	var intOffSetLeft = 0;
	var bIsFramed = false;
	var objIframe = null;
	
	try
		{
		objIframe = this.frameElement;
		}
	catch ( ex )
		{
		// Added this for when the client is framed, SSL, and within another domain. 
		// When this is the case, frameElement is unavailable and accessing it will 
		// generate the error message "Access Denied".
		}		

	if ( ( objIframe != null ) && ( objIframe.tagName == "IFRAME" ) )
		{
		intOffSetTop = GetAbsoluteTop ( objIframe );
		intOffSetLeft = GetAbsoluteLeft ( objIframe );
		bIsFramed = true;
		}

	return { offsetTop:intOffSetTop, offsetLeft:intOffSetLeft, isFramed:bIsFramed };
}

//************************************************************
//*
//************************************************************
function MouseDown ( evt )
{
	if ( window.event )
		 {
		 evt = window.event;
		 }

	var obj = evt.srcElement ? evt.srcElement : evt.target;

    // Begin detection to see if the object is a popup window.
	var objPopUpContainer = GetPopupContainer ( obj, "SPAN" );

	if ( objPopUpContainer == null )
		{
		OnLooseFocus();
		return;
		}

	var objPopUp = GetPopUpObject ( objPopUpContainer.id );

	if ( typeof objPopUp == "undefined" )
		{
		return;
		}

    var objDOM = document.getElementById ( objPopUp.OuterContainerId );

	objDOM.style.zIndex = m_gPopUp.PopupZIndex++;

	if ( obj.id == objPopUp.PopupButtonId )
		{
		bMouseover = false;
		evt.cancelBubble = true;
		evt.stopPropagation;
		return false;
		}

	if ( isTitleBarObject ( obj.id, objPopUp ) )
		{
		objSource = document.getElementById ( objPopUp.OuterContainerId );
		objSource.style.position = "absolute";
		objSource.style.zIndex = m_gPopUp.PopupZIndex++;

		bMouseover      = true;
		intPixelLeft    = window.event ? objSource.style.pixelLeft : objSource.style.left;
		intPixelTop     = window.event ? objSource.style.pixelTop : objSource.style.top;
		intXCoor        = evt.clientX;
		intYCoor        = evt.clientY;
		document.onmousemove = function ( evt ) { MoveObject ( evt ); }
		}
	else
		{
		bMouseover	= false;
		}
}

//************************************************************
//*
//************************************************************
function isTitleBarObject ( id, objPopUp )
{
    if ( id == objPopUp.TitleId || id == objPopUp.TitleTextId || id == objPopUp.TitleTextLabelId )
        {
        return true;
        }
    else
        {
        return false;
        }        
}

//************************************************************
//*
//************************************************************
function MoveObject ( evt )
{
	var bLeftMouseButton = false;

	if ( window.event )
		{
		evt = window.event;

		if ( evt.button == 1 )
			{
			bLeftMouseButton = true;
			}
		}
	else
		{
		if ( evt.button == 0 || evt.button == 65535 )
			{
			bLeftMouseButton = true;
			}
		}

	if ( bMouseover && bLeftMouseButton )
		{
		if ( window.event )
			{
			objSource.style.pixelLeft = intPixelLeft + evt.clientX - intXCoor;
			objSource.style.pixelTop  = intPixelTop + evt.clientY - intYCoor;
			}
		else
			{
			objSource.style.left = ( parseInt ( intPixelLeft ) + evt.clientX - intXCoor ) + "px";
			objSource.style.top  = ( parseInt ( intPixelTop ) + evt.clientY - intYCoor ) + "px";
			}

		return false;
		}
}

//************************************************************
//*
//************************************************************
function MouseUp ( evt )
{
	if ( window.event )
		 {
		 evt = window.event;
		 }

	var obj = evt.srcElement ? evt.srcElement : evt.target;

	bMouseover = false;

	var objPopUpContainer = GetPopupContainer ( obj, "SPAN" );

	if ( objPopUpContainer == null )
	    {
	    return;
	    }
	
	var objPopUp = GetPopUpObject ( objPopUpContainer.id );

	if ( typeof objPopUp == "undefined" )
		{
		return;
		}

	if ( objPopUpContainer.id == objPopUp.id )
		{
		objPopUpContainer = null;

		if ( ( typeof objSource == "object" ) && ( objSource != null ) )
			{
			objSource.style.zIndex = m_gPopUp.PopupZIndex++;
			objSource = null;
			}
		}
}

//*******************************************************************
//*
//*******************************************************************
function OnLooseFocus()
{
	m_gPopUp.FlashBorderCount = 0;
	m_gPopUp.FlashBorderSwitch = true;

    var obj = isModalPopUpActive();
    
   	if ( obj.Active )
		{
        var objPopup = GetPopUpObject ( obj.Id );

        if ( objPopup != null && objPopup.ModalDialogBehavior )
            {
		    FlashBorder ( objPopup.InnerContainerId );
            }
		}
}

//*******************************************************************
//*
//*******************************************************************
function FlashBorder ( strId )
{
	var obj = document.getElementById ( strId );

	if ( obj != null && m_gPopUp.FlashBorderCount < 6 )
		{
		var strClassName = "";
		
		if ( m_gPopUp.FlashBorderSwitch )
			{
			strClassName = "BorderFlash";
			}
		else
			{
			strClassName = "PopUpMain";
			}

		m_gPopUp.FlashBorderSwitch = !m_gPopUp.FlashBorderSwitch;

		setTimeout ( "FlashBorder ( '" + strId + "' );", 100 );
		obj.className = strClassName;

		m_gPopUp.FlashBorderCount++;
		}
}

//************************************************************
//*
//************************************************************
function RegisterPageElements()
{
    m_gPopUp.PageElements = new Array(0);

    var objElements = document.body.getElementsByTagName( "SELECT" );

	for ( var x = 0; x < objElements.length; x++ )
    	{
		var obj = objElements[x];
		
		if ( !isChildElement( obj ) )
		    {
		    m_gPopUp.PageElements[m_gPopUp.PageElements.length] = new PageElement ( obj );
		    }
	    }
}

//************************************************************
//*
//************************************************************
function PageElement ( obj )
{
	this.Element = obj;
    this.OnClickAction = obj.onclick;
}

//************************************************************
//*
//************************************************************
function isChildElement ( objTag )
{
	var objPopUpContainer = GetPopupContainer ( objTag, "SPAN" );

	if ( objPopUpContainer == null )
		{
		return false;
		}

	return true;
}

//************************************************************
//*
//************************************************************
function ProcessPageElements ( objPopup )
{
    if ( objPopup.ManageDOMDisplay )
        {
	    for ( var x = 0; x < m_gPopUp.PageElements.length; x++ )
		    {
		    if ( ( m_gPopUp.PageElements[x].Element.tagName == "SELECT" ) && ( objPopup.AutoHideClientDropDowns ) )
			    {
			    m_gPopUp.PageElements[x].Element.style.visibility = "hidden";
			    }
		    }

	    if ( objPopup.ModalDialogBehavior )
	        {
            var obj = document.getElementById ( objPopup.ModalDialogDivId );

            if ( obj != null )
	            {
				// Attempt to disable the IE toolbar for the modal background image
				try
					{
					if ( obj != null && window.event )
						{
						objImg = document.getElementById ( objPopup.ModalDialogImageId );
						objImg.galleryImg = false;
						}
					}
				catch (ex)
					{
					}
	            
	            if ( document.body.clientHeight >= document.documentElement.clientHeight ) 
	                {
	                obj.style.height = document.body.clientHeight + "px";
	                }
                else
                    {
                    obj.style.height = document.documentElement.clientHeight + "px";
                    }
            
	            obj.style.width = document.documentElement.clientWidth + "px";
	            obj.style.display = "inline";
                obj.style.zIndex = m_gPopUp.PopupZIndex++;
	            }
	        }
        }
}

//************************************************************
//*
//************************************************************
function ResetPageElements ( objPopUp )
{
    var bShowElements = true;

    for ( var x = 0; x < m_gPopUp.PopUp.length; x++ )
        {
        if ( m_gPopUp.PopUp[x].Visible == true )
    	    {
    	    bShowElements = false;
    	    }
        }

    if ( bShowElements )
	    {
	    for ( var x = 0; x < m_gPopUp.PageElements.length; x++ )
		    {
		    if ( m_gPopUp.PageElements[x].Element.tagName == "SELECT" )
			    {
			    m_gPopUp.PageElements[x].Element.style.visibility = "visible";
			    }
		    }
        }
}

//************************************************************
//*
//************************************************************
function UpdateModalDialogBackground()
{
	var obj = GetModalDialogBackground();

	if ( obj != null && obj.style.display == "inline" )
		{
        if ( document.body.clientHeight >= document.documentElement.clientHeight ) 
            {
            obj.style.height = document.body.clientHeight + "px";
            }
        else
            {
            obj.style.height = document.documentElement.clientHeight + "px";
            }

		//obj.style.width = document.documentElement.clientWidth + "px";
		obj.style.width = document.documentElement.scrollWidth + "px";
		}
		
	return obj;		
}

//************************************************************
//*
//************************************************************
function GetModalDialogBackground()
{
	var objDiv = null;
	var obj = isModalPopUpActive();

    if ( obj.Active )
	    {
        var objPopUp = GetPopUpObject ( obj.Id );
        }                
        
    if ( objPopUp == null )
        {
        return null;
        }
	else
		{
		objDiv = document.getElementById ( objPopUp.ModalDialogDivId );

		// Check to see of the popup is in a container with relative positioning
		var objImg = document.getElementById ( objPopUp.ModalDialogImageId );
		var intTop = GetAbsoluteTop ( objImg );
		var intLeft = GetAbsoluteLeft ( objImg );
		var z = parseInt ( objImg.style.top );
		
		if ( isNaN ( z ) )
			{
			z = 0;
			}
			
		objImg.style.top = ( intTop + Math.abs ( z ) ) * -1 + "px";
		objPopUp.ModalReposition.Top = parseInt ( objImg.style.top );

		z = parseInt ( objImg.style.left );
		
		if ( isNaN ( z ) )
			{
			z = 0;
			}

		objImg.style.left = ( intLeft + Math.abs ( z ) ) * -1 + "px";
		objPopUp.ModalReposition.Left = parseInt ( objImg.style.left );
					
		//if ( ( intLeft > 0 && intLeft > parseInt ( objImg.style.left ) ) || objImg.style.left == "" )
		if ( intLeft > 0 )
			{
			objPopUp.ModalReposition.Repositioned = true;
			}

		var intTop = GetAbsoluteTop ( objDiv );
		var intLeft = GetAbsoluteLeft ( objDiv );
		z = parseInt ( objDiv.style.top );
		
		if ( isNaN ( z ) )
			{
			z = 0;
			}
		
		objDiv.style.top = ( intTop + Math.abs ( z ) ) * -1 + "px";
		objPopUp.ModalReposition.Top = parseInt ( objDiv.style.top );			

		z = parseInt ( objDiv.style.left );
		
		if ( isNaN ( z ) )
			{
			z = 0;
			}

		objDiv.style.left = ( intLeft + Math.abs ( z ) ) * -1 + "px";
		objPopUp.ModalReposition.Left = parseInt ( objDiv.style.left );
		
		if ( intLeft > 0 )
			{
			objPopUp.ModalReposition.Repositioned = true;
			}

		// Attempt to disable the IE toolbar for the modal background image
		try
			{
			if ( obj != null && window.event )
				{
				objImg = document.getElementById ( objPopUp.ModalDialogImageId );
				objImg.galleryImg = false;
				}
			}
		catch (ex)
			{
			}
		}
		
    return objDiv;
}

//************************************************************
//*
//************************************************************
function ModalDialogCancelClick ( evt )
{
	return false;

	if ( window.event )
		 {
		 evt = window.event;
		 }

	evt.preventDefault ? evt.preventDefault() : evt.returnValue = false;
	window.event.cancelBubble = true;
}

//************************************************************
//*
//************************************************************
function GetPopUpChildElements ( objPopUp )
{
	var obj = document.getElementById ( objPopUp.id );
	objPopUp.ModalDialogChildren = new Array(0);

    var objElements = obj.getElementsByTagName( "SELECT" );
	RegisterChildElements ( objElements, objPopUp );

    var objElements = obj.getElementsByTagName( "INPUT" );
	RegisterChildElements ( objElements, objPopUp );

    var objElements = obj.getElementsByTagName( "A" );
	RegisterChildElements ( objElements, objPopUp );

    document.onkeydown = CheckModalKeyPress;

	var objFirst = GetFirstEnabledControl ( objPopUp );

    try
        {
	    if ( objFirst != null )
		    {
		    objFirst.focus();
		    }
        }
    catch ( ex )
        {
        }        
}

//************************************************************
//*
//************************************************************
function StopCheckTabKeyPress ( objPopUp )
{
	document.onkeydown = null;
	objPopUp.ModalDialogChildren = null;
}

//************************************************************
//*
//************************************************************
function RegisterChildElements ( objElements, objPopUp )
{
	for ( var x = 0; x < objElements.length; x++ )
        {
        objPopUp.ModalDialogChildren[objPopUp.ModalDialogChildren.length] = objElements[x];
        }
}

//************************************************************
//* This checks if an element is a child control of the popup
//************************************************************
function isChild ( obj, objPopUp )
{
	var bIsChild = false;
	
	for ( var x = 0; x < objPopUp.ModalDialogChildren.length; x++ )
		{
		if ( obj == objPopUp.ModalDialogChildren[x] )
			{
			bIsChild = true;
			}
		}

	return bIsChild;
}

//************************************************************
//*
//************************************************************
function CheckModalKeyPress ( e )
{
	try
	{
        if ( window.event )
            {
            e = window.event;
            }

	    var objSource = e.srcElement ? e.srcElement : e.target;

        if ( e.keyCode )
            {
            code = e.keyCode;
            }
        else if ( e.which )
            {
            code = e.which;
            }

        var obj = isModalPopUpActive();
        var objPopup = null;
        
   	    if ( obj.Active )
		    {
            var objPopUp = GetPopUpObject ( obj.Id );
            }                
            
        if ( objPopUp == null )
            {
            return;
            }

	    var objFirst = GetFirstEnabledControl ( objPopUp );
	    var objLast = GetLastEnabledControl ( objPopUp );

        // Attempt to block the Enter key
        if ( code == 13 )
            {
            e.preventDefault ? e.preventDefault() : e.returnValue = false;
            return;
            }

        // This is needed in case there are no child controls in the popup
        if ( ( objFirst == null || objLast == null ) && ( code == 9 ) )
            {
            e.preventDefault ? e.preventDefault() : e.returnValue = false;
            return;
            }

	    if ( objFirst == null || objLast == null || code != 9 )
    	    {
		    return;
	        }

        // Attempt to trap on the Tab key
        if ( !isChild ( objSource, objPopUp ) )
            {
            e.preventDefault ? e.preventDefault() : e.returnValue = false;
            objFirst.focus ( objPopUp );
            return;
            }

	    // If shift-tab and the source is the first child, set focus on the last child.
        if ( e.shiftKey && objSource == objFirst )
    	    {
	        e.preventDefault ? e.preventDefault() : e.returnValue = false;
	        objLast.focus ( objPopUp );
	        return;
	        }

	    // If the source is the last child, set focus on the first child.
        if ( !e.shiftKey && objSource == objLast )
	        {
	        e.preventDefault ? e.preventDefault() : e.returnValue = false;
	        objFirst.focus ( objPopUp );
	        return;
	        }
	    }
	catch ( ex )
	    {
	    }
}

//************************************************************
//*
//************************************************************
function GetLastEnabledControl ( objPopUp )
{
	var obj = null;

		for ( var x = objPopUp.ModalDialogChildren.length; x > 0; x-- )
			{
			if ( !objPopUp.ModalDialogChildren[x - 1].readOnly && !objPopUp.ModalDialogChildren[x - 1].isDisabled )
				{
				obj = objPopUp.ModalDialogChildren[x - 1];
				break;
				}
			}

	return obj;
}

//************************************************************
//*
//************************************************************
function GetFirstEnabledControl ( objPopUp )
{
	var obj = null;

		for ( var x = 0; x < objPopUp.ModalDialogChildren.length; x++ )
			{
			if ( !objPopUp.ModalDialogChildren[x].readOnly && !objPopUp.ModalDialogChildren[x].isDisabled )
				{
				obj = objPopUp.ModalDialogChildren[x];
				break;
				}
			}
			
	return obj;
}

//************************************************************
//*
//************************************************************
function GetPopupContainer ( obj, strTagName )
{
	if ( ( obj == null ) || ( typeof obj.id == "undefined" ) || ( obj.id.indexOf("imgModalDialog") != -1 ) )
		{
		return null;
		}

	var tempObj = obj;

	//Move up the DOM until the top node is found
	while ( tempObj != null && ( tempObj.nodeType != 1 || tempObj.getAttribute ( "PopUp" ) != "true" ) )
		{
		tempObj = tempObj.parentNode;
		}

    if ( tempObj != null )
        {
        if ( tempObj.getAttribute ( "PopUp" ) == "true" )
            {
	        return tempObj;
            }
        else
            {
            return null;
            }            
        }

    return null;
}

//************************************************************
//*
//************************************************************
function isModalPopUpActive()
{
	var bActive = false;
    var strId = "";
    
	for ( var x = 0; x < m_gPopUp.PopUp.length; x++ )
        {
        if ( ( m_gPopUp.PopUp[x].Visible ) && ( m_gPopUp.PopUp[x].ModalDialogBehavior ) )
            {
            bActive = true;
            strId = m_gPopUp.PopUp[x].id;
            }
        }

	return { Active: bActive, Id: strId};
}

//************************************************************
//*
//************************************************************
function getScrollCoords()
{
	if ( typeof window.pageXOffset != "undefined" )
		{
		return {x: window.pageXOffset, y: window.pageYOffset};
		}
	else if ( ( !document.compatMode || document.compatMode == "BackCompat" ) && document.body && typeof document.body.scrollLeft != "undefined" )
		{
		return {x: document.body.scrollLeft, y: document.body.scrollTop};
		}
	else if ( document.compatMode == "CSS1Compat" && document.documentElement && typeof document.documentElement.scrollLeft != "undefined" )
		{
		var objFramed = GetFramesetOffSet();
           
		if ( objFramed.isFramed )
			{
			return {x: window.top.document.documentElement.scrollLeft, y: window.top.document.documentElement.scrollTop};
			}
		else
			{
			return {x: document.documentElement.scrollLeft, y: document.documentElement.scrollTop};
			}			
		}
	else
		{
		return null;
		}
}

//************************************************************
//*
//************************************************************
function GetAbsoluteLeft ( obj )
{
    var intPosX = 0;

	try
		{
		if ( obj != null )
			{
			intPosX = obj.offsetLeft;
			var objParent = obj.offsetParent;

  			while ( objParent != null )
  				{
  				intPosX += objParent.offsetLeft;
  				objParent = objParent.offsetParent;
  				}
			}
		}
	catch ( ex )
		{
		}		

	return intPosX;
}

//************************************************************
//*
//************************************************************
function GetAbsoluteTop ( obj )
{
    var intPosY = 0;

	try
		{
		if ( obj != null )
			{
			intPosY = obj.offsetTop;
			var objParent = obj.offsetParent;

			while ( objParent != null )
				{
  				intPosY += objParent.offsetTop;
  				objParent = objParent.offsetParent;
  				}
			}
		}
	catch ( ex )
		{
		}		

	return intPosY;
}

//************************************************************
//*
//************************************************************
function objDisplay ( id )
{
    var objPopUp = GetPopUpObject ( id );
    
    if ( objPopUp != null )
        {
        objPopUp.Visible = true;

	    var obj = document.getElementById ( objPopUp.OuterContainerId );

	    if ( obj != null )
		    {
		    obj.style.display = "inline";
		    }
        }
}

//************************************************************
//*
//************************************************************
function HidePopUp ( id )
{
    objClose ( id );
}

//************************************************************
//*
//************************************************************
function objClose ( id )
{
    var objPopUp = GetPopUpObject ( id );
    
    if ( objPopUp != null )
        {
        objPopUp.Visible = false;
        
        var obj = document.getElementById ( objPopUp.OuterContainerId );

	    if ( obj != null )
		    {
		    obj.style.display = "none";
		    }

        if ( objPopUp.ModalDialogBehavior )
            {		    
            var objModalDialogDIV = document.getElementById ( objPopUp.ModalDialogDivId )

            if ( objModalDialogDIV != null )
				{
				objModalDialogDIV.style.display = "none";
				}

		    StopCheckTabKeyPress ( objPopUp );
		    }
        }

    ResetPageElements ( objPopUp );
}

//************************************************************
// Simon Willison's
//************************************************************
function addOnLoadEvent ( func )
{
	var objOldOnLoad = window.onload;

	if ( typeof window.onload != "function" )
		{
		window.onload = func;
		}
	else
		{
		window.onload = function() { if (objOldOnLoad) {objOldOnLoad();}func();}
		}
}

window.onresize = UpdateModalDialogBackground;
document.onmousedown = MouseDown;
document.onmouseup = MouseUp;

/* *********** End Quixtar.Web.UI.WebControls.PopUp.js  from Quixtar.Web.UI.WebControls, Version=2010.9.2.5, Culture=neutral, PublicKeyToken=null*/
