function ShowImagePopup(imageID, imagex) {
    var popupName = "ImagePreview";
    var popupAttributes = "status=yes,scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,height=625,width=988,top=10,left=10";
    var popupUrl = '/preview.asp?image=' + imageID + '&imagex=' + imagex;
    
    if (document.CDContentsForm != null) {
        popupUrl = popupUrl + '&enableCDLink=0';
    } else {
        popupUrl = popupUrl + '&enableCDLink=1';
    }
    
    window.open(popupUrl, popupName, popupAttributes);
}

function GalleryWindow(url)
{
	newwindow=window.open(url,'name','height=810,width=780');
	if (window.focus) {newwindow.focus()}
}

var SS = Ext.extend(Ext.util.Observable, {
    writeLog: function(msg) {
        if (typeof console != 'undefined') {
            console.log(msg);
        }
    }
    , constructor: function(config) {
        SS.superclass.constructor.call(this, config);       
        Ext.onReady(this.onDocReady, this);
    }
    , onDocReady: function() {
        this.LayerSlideShow = new Ext.ux.LayerSlideShow({
            el: 'layerSlideShow'
            , delay: 6000
            , hoverPause: true
            , enabled: false
        });
        
        var el = Ext.get('subscription-terms1');
        this.enableSearchBox(el);
        
        el = Ext.get('subscription-terms2');
        this.enableSearchBox(el);
    }
    , enableSearchBox: function(el) {
        SS.writeLog('SS.enableSerchBox');
        if (el != null) {
            new Ext.form.TextField({
                emptyText: 'Search Subscription'
                , el: el
                , value: ''
                , enableKeyEvents: true
                , listeners: {
                    keypress: this.onKeyPress
                    , scope: this
                }
            }).render();
        }
    }
    , onKeyPress: function(field, e) {
        if (e.getKey() == 13) {
            top.location = '/Subscription/Search/' + field.getValue();
        }
    }
});
SS = new SS();
