var ConditionExplorer = new Class({
    initialize : function (container) {
        this.bodyParts = [
/*        SAMPLE OBJECT 
        {
            'xpos': [int - location from left of img], 
            'ypos': [int - location from top of img], 
            'onImg' : [string - the location of 'on dot'], 
            'offImg' : [string - the location of 'off dot'], 
            'className': [string - CSS class that is added to the image element'], 
            'label': [string - label that shows up on the mouseover],
            'formInput' : [string - the input that gets passed to the form],
            'redirectUrl' : [string - the url that you want the page to redirect on the click]
        },
*/
// adult    
        {'xpos': 0, 'ypos': 5, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Head', 'formInput' : 'head', 'redirectUrl' : '/condition-list_head.asp'},
        {'xpos': 0, 'ypos': 32, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Spine / Back / Neck', 'formInput' : 'spine back neck', 'redirectUrl' : '/condition-list_back-spine-neck.asp'},
        {'xpos': 20, 'ypos': 28, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Shoulder', 'formInput' : 'shoulder', 'redirectUrl' : '/condition-list_shoulder.asp'},
       // {'xpos': -20, 'ypos': 42, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Arm', 'formInput' : 'arm', 'redirectUrl' : ''},
        {'xpos': 30, 'ypos': 47, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Elbow / Arm', 'formInput' : 'elbow', 'redirectUrl' : '/condition-list_elbow-arm.asp'},
        {'xpos': -23, 'ypos': 90, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Hand / Wrist', 'formInput' : 'Hand Wrist', 'redirectUrl' : '/condition-list_hand-wrist.asp'},
        {'xpos': -10, 'ypos': 80, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Hip / Pelvis', 'formInput' : 'hip', 'redirectUrl' : '/condition-list_hip-pelvis.asp'},
        {'xpos': 12, 'ypos': 96, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Leg', 'formInput' : 'leg', 'redirectUrl' : '/condition-list_leg.asp'},
        {'xpos': -7, 'ypos': 118, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Knee', 'formInput' : 'knee', 'redirectUrl' : '/condition-list_knee.asp'},
        {'xpos': 16, 'ypos': 161, 'onImg' : '/images/css/cAndT_adultDot_on.png', 'offImg' : '/images/css/cAndT_adultDot_off.png', 'className': 'conditionExplorer_adultDot', 'label': 'Foot / Ankle', 'formInput' : 'Foot Ankle', 'redirectUrl' : '/condition-list_foot-ankle.asp'},
        {'xpos': -10, 'ypos': 178, 'onImg' : '/images/css/cAndT_adultFullBody_on.png', 'offImg' : '/images/css/cAndT_adultFullBody_off.png', 'className': 'conditionExplorer_adultFull', 'label': 'Entire Body / Systemic Diseases', 'formInput' : 'systemic diseases', 'redirectUrl' : '/condition-list_entire-body.asp'},
// child    
        {'xpos': 96, 'ypos': 69, 'onImg' : '/images/css/cAndT_childDot_on.png', 'offImg' : '/images/css/cAndT_childDot_off.png', 'className': 'conditionExplorer_childDot', 'label': 'Spine / Back / Neck', 'formInput' : 'spine back neck', 'redirectUrl' : '/condition-list_pediatric-back-neck-spine.asp'},
        {'xpos': 111, 'ypos': 88, 'onImg' : '/images/css/cAndT_childDot_on.png', 'offImg' : '/images/css/cAndT_childDot_off.png', 'className': 'conditionExplorer_childDot', 'label': 'Arm', 'formInput' : 'child arm', 'redirectUrl' : '/condition-list_pediatric-arm.asp'},
        {'xpos': 76, 'ypos': 108, 'onImg' : '/images/css/cAndT_childDot_on.png', 'offImg' : '/images/css/cAndT_childDot_off.png', 'className': 'conditionExplorer_childDot', 'label': 'Hand', 'formInput' : 'child hand', 'redirectUrl' : '/condition-list_pediatric-hand.asp'},
        {'xpos': 86, 'ypos': 97, 'onImg' : '/images/css/cAndT_childDot_on.png', 'offImg' : '/images/css/cAndT_childDot_off.png', 'className': 'conditionExplorer_childDot', 'label': 'Hip', 'formInput' : 'child hip', 'redirectUrl' : '/condition-list_pediatric-hip.asp'},
        {'xpos': 88, 'ypos': 125, 'onImg' : '/images/css/cAndT_childDot_on.png', 'offImg' : '/images/css/cAndT_childDot_off.png', 'className': 'conditionExplorer_childDot', 'label': 'Leg / Knee', 'formInput' : 'child leg', 'redirectUrl' : '/condition-list_pediatric-leg-knee.asp'},
        {'xpos': 86, 'ypos': 160, 'onImg' : '/images/css/cAndT_childDot_on.png', 'offImg' : '/images/css/cAndT_childDot_off.png', 'className': 'conditionExplorer_childDot', 'label': 'Foot / Ankle', 'formInput' : 'child foot ankle', 'redirectUrl' : '/condition-list_pediatric-foot-ankle.asp'},    
        {'xpos': 81, 'ypos': 178, 'onImg' : '/images/css/cAndT_childFullBody_on.png', 'offImg' : '/images/css/cAndT_childFullBody_off.png', 'className': 'conditionExplorer_childFull', 'label': 'Entire Body  / Systemic Diseases', 'formInput' : 'systemic diseases', 'redirectUrl' : '/condition-list_pediatric-entire-body.asp'}
    ];
        this.formElement = $$('.conditionExplorer_form')[0];
        this.inputElement = this.formElement.getElement('.roundInput_field');
        
        var contentContainer = container.getElement('.conditionExplorer_positionedContnet');
        
        this.label = new Element ('div', {'class': 'conditionExplorer_dynamicText'});
        contentContainer.adopt(this.label);
// here's the default label
        this.label.setText('Select A Body Part');
        
        var dotContainer = new Element ('div', {'class': 'conditionExplorer_dots'});
        contentContainer.adopt(dotContainer);
        
        for (var i=0,l=this.bodyParts.length;i<l;i++) {
            var bp = this.bodyParts[i];
// IE6 doesn't process PNGs correctly, so this creates a div with a filter instead of an img
            if (window.ie6) {
                bp.dotElement = new Element('div', {'class': bp.className});
                bp.dotElement.setStyles({'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\', src=\'' + bp.offImg + '\', sizingMethod=\'crop\')'})
            } else {
                bp.dotElement = new Element('img', {'src': bp.offImg, 'class': bp.className});
            }
            bp.dotElement.setStyles({'top': bp.ypos + 'px', 'left' : bp.xpos + 'px'});
            dotContainer.adopt(bp.dotElement);
            bp.dotElement.addEvent('mouseenter', this.showLabel.pass([bp], this));
            bp.dotElement.addEvent('mouseleave', this.hideLabel.pass([bp], this));
            bp.dotElement.addEvent('click', this.doBodyPartClick.pass([bp], this));
        }
    
    },
    showLabel : function(bp) {
// set the label to it the item and go to the 'onImage'    for the dot
        this.label.setText(bp.label);
        if (window.ie6) {
            bp.dotElement.setStyle('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\', src=\'' + bp.onImg + '\', sizingMethod=\'crop\')');
        } else {
            bp.dotElement.setAttribute('src' ,  bp.onImg );
        }
        
    },
    hideLabel : function(bp) {
// return the label to it's default and got back to the 'offImage'    
        this.label.setText('Select A Body Part');
        if (window.ie6) {
            bp.dotElement.setStyle('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\', src=\'' + bp.offImg + '\', sizingMethod=\'crop\')');
        } else { 
            bp.dotElement.src = bp.offImg;
        }
    },
    doBodyPartClick : function (bp) {
// Set the form inout value and submit the form
//        this.inputElement.value = bp.formInput;
//        this.formElement.submit();

// CHANGED 3 OCTOBER 2008 - Removed form business and changed to simple redirect
        window.location = bp.redirectUrl;

    }
});