﻿function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function testUserName(e, textid, validid, invalidid, alertlabelid) {
    var evt = e ? e : window.event;
    if (evt.type == "keyup") {
        var t = document.getElementById(textid);
        var a = document.getElementById(validid);
        var b = document.getElementById(invalidid);
        var c = document.getElementById(alertlabelid);

        var c1 = document.getElementById("SignupTable");
        var c2 = document.getElementById("EMail");
        var c3 = document.getElementById("Referrer");
        var c4 = document.getElementById("SignUp");

        c1.className = c1.className.replace(/2/g, '');
        c2.className = c2.className.replace(/2/g, '');
        c3.className = c3.className.replace(/2/g, '');
        c4.className = c4.className.replace(/2/g, '');
        
        if (t && a && b && c) {
            var name = t.value.replace(/ /g, '');
            t.value = name;
            if (name.length == 0) {
                a.style.display = "none";
                b.style.display = "none";
                c.style.display = "none";
            }
            else {
                UserName.CheckName(name, testUserNameCallback);

                c1.className = c1.className + "2";
                c2.className = c2.className + "2";
                c3.className = c3.className + "2";
                c4.className = c4.className + "2";
            }
        }
    }
    return true;
}

function testUserNameCallback(result){
    var a = document.getElementById("UserNameValid");
    var b = document.getElementById("UserNameInValid");
    var c = document.getElementById("AlertLabel");
    if (a && b && c) {
        if (result) {
            a.style.display = "none";
            b.style.display = "";
            c.style.display = "";
            c.className = "homeUsernameInValid";
            c.innerText = "This ID is already in use. Please try again!";
            c.innerHTML = "This ID is already in use. Please try again!";
        }
        else {
            a.style.display = "";
            b.style.display = "none";
            c.style.display = "";
            c.className = "homeUsernameValid";
            c.innerText = "Congratulations - that ID is still available!";
            c.innerHTML = "Congratulations - that ID is still available!";
        }
    }
}

function clearText(ctrlid) {
    var bt = document.getElementById(ctrlid);
    if (bt) {
        bt.value = "";
        return false;
    }
}

function clickButton(e, buttonid) {
      var evt = e ? e : window.event;
      if (evt.keyCode == 13) {
          var bt = document.getElementById(buttonid);
          if (bt){
                bt.click();
                return false;
          }
      }
}

function RetrievePicture(imgCtrl, picid) {
    imgCtrl.src = 'ShowImage.ashx?id=' + picid;
}

function constrain(str,n){
    if(str.length > n){  
        var s = str.substr(0, n);
        var words = s.split(' '); 
        words[words.length-1] = '';
        str = words.join(' ') + '&hellip;'
    }
    return str;
}
function selectAll(obj1, obj2) {

    var checkboxIds = new String();
    checkboxIds = obj1;

    var arrIds = new Array(); arrIds = checkboxIds.split('|');

    for (var i = 0; i < arrIds.length; i++) {
        if(document.getElementById(arrIds[i]))
            document.getElementById(arrIds[i]).checked = obj2.checked;
    }
}

function setContextKey1(e, textid, targetid) {
    var evt = e ? e : window.event;
    var t = document.getElementById(textid);
    var a = $find(targetid);

    if( t && a )
        a.set_contextKey( t.value );
    return false;
}

function setContextKey2(e, text1id, text2id, targetid) {
    var evt = e ? e : window.event;
    var t1 = document.getElementById(text1id);
    var t2 = document.getElementById(text2id);
    var a = $find(targetid);

    if (t1 && t2 && a) {
        a.set_contextKey( t1.value + '?' + t2.value );
    }
    return false;
}

function initCascadingAutoComplete(manId,nameId,modelId) {
    var manufacturersAutoComplete = document.getElementById(manId);
    var brandsAutoComplete = document.getElementById(nameId);
    var modelsAutoComplete = document.getElementById(modelId);

    if (!manufacturersAutoComplete || !brandsAutoComplete || !modelsAutoComplete)
        return;
        
    brandsAutoComplete.set_contextKey(manufacturersAutoComplete.get_element().value);
    manufacturersAutoComplete.add_itemSelected(cascade1);

    modelsAutoComplete.set_contextKey(manufacturersAutoComplete.get_element().value + '?' + brandsAutoComplete.get_element().value);
    brandsAutoComplete.add_itemSelected(cascade2);

//    // setup initial state of second flyout
//    if (manufacturersAutoComplete.get_element().value) {
//        brandsAutoComplete.get_element().disabled = false;
//    } else {
//        brandsAutoComplete.get_element().disabled = true;
//        brandsAutoComplete.get_element().value = "";
//    }

//    // setup initial state of third flyout
//    if (brandsAutoComplete.get_element().value) {
//        modelsAutoComplete.get_element().disabled = false;
//    } else {
//        modelsAutoComplete.get_element().disabled = true;
//        modelsAutoComplete.get_element().value = "";
//    }
}
function cascade1(sender, ev) {
    var manufacturersAutoComplete = document.getElementById('AutoCompleteExtender1');
    var brandsAutoComplete = document.getElementById('AutoCompleteExtender2');
    var modelsAutoComplete = document.getElementById('AutoCompleteExtender3');

    brandsAutoComplete.set_contextKey(manufacturersAutoComplete.get_element().value);
    brandsAutoComplete.get_element().value = '';
//    if (brandsAutoComplete.get_element().disabled) {
//        brandsAutoComplete.get_element().disabled = false;
//    }

    modelsAutoComplete.set_contextKey(manufacturersAutoComplete.get_element().value + '?' + brandsAutoComplete.get_element().value);
    modelsAutoComplete.get_element().value = '';
//    if (modelsAutoComplete.get_element().disabled) {
//        modelsAutoComplete.get_element().disabled = false;
//    }
}
function cascade2(sender, ev) {
    var manufacturersAutoComplete = document.getElementById('AutoCompleteExtender1');
    var brandsAutoComplete = document.getElementById('AutoCompleteExtender2');
    var modelsAutoComplete = document.getElementById('AutoCompleteExtender3');

    modelsAutoComplete.set_contextKey(manufacturersAutoComplete.get_element().value + '?' + brandsAutoComplete.get_element().value);
    modelsAutoComplete.get_element().value = '';
//    if (modelsAutoComplete.get_element().disabled) {
//        modelsAutoComplete.get_element().disabled = false;
//    }
}

var PanelSlider = Class.create(
{
    initialize: function(outerDiv, parentDiv, childDiv, number, motionLength, contWidth) {
        // id of parent div that must have overflow: hidden;
        this.outerDiv = outerDiv;
        // id of parent div that must have overflow: hidden;
        this.parentDiv = parentDiv;
        // id of div to slide
        this.childDiv = childDiv;
        // first location of object to show - 0 Based
        this.step = 0;
        //total number of steps
        this.totalSteps = number;
        // size of slide - px
        if ($(this.parentDiv)) {
            if (contWidth == 0)
                contWidth = $(this.parentDiv).offsetWidth;
            this.stepSize = contWidth;
            // left start position for motion - px
            this.motionStartPosition = this.step * this.stepSize;
            // left end position for motion - px
            this.motionEndPosition = null;
            // current position of motion - px
            this.motionCurrentPosition = this.step * this.stepSize;
            // timer used to make motion
            this.motionTimer = null;

            // total length of motion - milliseconds
            if (motionLength > 0)
                this.motionLength = motionLength;
            else
                this.motionLength = 500;

            // time motion was started
            this.startTime = null;

            // frame rate
            this.speed = 40;

            // set the width of the child element
            $(this.childDiv).style.left = "-" + this.step * this.stepSize + "px";
            $(this.childDiv).style.width = number * this.stepSize + "px";

            // width of div to slide
            this.sliderWidth = number * this.stepSize;
        }
    },
    mouseOver_left: function(obj, btn, active) {
        if (!this.mouseOverLeft)
            this.mouseOverLeft = active;
        document.getElementById(btn).src = this.mouseOverLeft;
    },
    mouseOut_left: function(obj, btn, active) {
        if (!this.mouseOutLeft)
            this.mouseOutLeft = active;
        document.getElementById(btn).src = this.mouseOutLeft;
    },
    mouseOver_right: function(obj, btn, active) {
        if (!this.mouseOverRight)
            this.mouseOverRight = active;
        document.getElementById(btn).src = this.mouseOverRight;
    },
    mouseOut_right: function(obj, btn, active) {
        if (!this.mouseOutRight)
            this.mouseOutRight = active;
        document.getElementById(btn).src = this.mouseOutRight;
    },
    slideLeft: function(obj, btnL, btnR) {
        // clear the timer in case someone clicks before motion is complete
        clearInterval(this.motionTimer);

        // update object to ensure at end position
        $(this.childDiv).style.left = "-" + (this.step * this.stepSize) + "px";

        // check current position
        var currentPosition = this.step * this.stepSize;

        if (this.step > 0) {
            // update step
            this.step--;

            // calculate new position
            var newPosition = this.step * this.stepSize;

            // set start position
            this.motionStartPosition = currentPosition;

            // set current position
            this.motionCurrentPosition = currentPosition;

            // set end position
            this.motionEndPosition = newPosition;

            // start motion
            this.motionTimer = window.setInterval(obj + ".startMotion()", this.speed);
        }

        if (this.step > 0) {
            // Set button image
            document.getElementById(btnL).src = "Images/Slider_Left_Active.PNG";
            this.mouseOverLeft = "Images/Slider_Left_Over.PNG";
            this.mouseOutLeft = "Images/Slider_Left_Active.PNG";
        }
        else {
            document.getElementById(btnL).src = "Images/Slider_Left_Disabled.PNG";
            this.mouseOverLeft = "Images/Slider_Left_Disabled.PNG";
            this.mouseOutLeft = "Images/Slider_Left_Disabled.PNG";
        }

        if (this.step < this.totalSteps - 1) {
            document.getElementById(btnR).src = "Images/Slider_Right_Active.PNG";
            this.mouseOverRight = "Images/Slider_Right_Over.PNG";
            this.mouseOutRight = "Images/Slider_Right_Active.PNG";
        }
        else {
            document.getElementById(btnR).src = "Images/Slider_Right_Disabled.PNG";
            this.mouseOverRight = "Images/Slider_Right_Disabled.PNG";
            this.mouseOutRight = "Images/Slider_Right_Disabled.PNG";
        }

        // Add to attribute of panel object
        $(this.outerDiv).value = this.step;

        //        if (this.step > 0) {
        //            // Set button image
        //            document.getElementById(btnL).src = "Images/Slider_Left_Active.PNG";
        //            document.getElementById(btnL).onmouseover = "roll_over('" + btnL + "','Images/Slider_Left_Over.PNG')";
        //            document.getElementById(btnL).onmouseout = "roll_over('" + btnL + "','Images/Slider_Left_Active.PNG')";
        //        }
        //        else {
        //            document.getElementById(btnL).src = "Images/Slider_Left_Disabled.PNG";
        //            document.getElementById(btnL).onmouseover = "roll_over('" + btnL + "','Images/Slider_Left_Disabled.PNG')";
        //            document.getElementById(btnL).onmouseout = "roll_over('" + btnL + "','Images/Slider_Left_Disabled.PNG')";
        //        }

        //        if (this.step < this.totalSteps - 1) {
        //            document.getElementById(btnR).src = "Images/Slider_Right_Active.PNG";
        //            document.getElementById(btnR).onmouseover = "roll_over('" + btnR + "','Images/Slider_Right_Over.PNG')";
        //            document.getElementById(btnR).onmouseout = "roll_over('" + btnR + "','Images/Slider_Right_Active.PNG')";
        //        }
        //        else {
        //            document.getElementById(btnR).src = "Images/Slider_Right_Disabled.PNG";
        //            document.getElementById(btnR).onmouseover = "roll_over('" + btnR + "','Images/Slider_Right_Disabled.PNG')";
        //            document.getElementById(btnR).onmouseout = "roll_over('" + btnR + "','Images/Slider_Right_Disabled.PNG')";
        //        }
    },
    slideRight: function(obj, btnL, btnR) {
        //          alert(obj);
        //          alert(this.parentDiv);
        ////        alert(this.childDiv);
        //var text = "current step: " + this.step + ", total steps: " + this.totalSteps + ", Start Position: " + this.motionCurrentPosition + ", End Position: " + this.motionCurrentPosition;
        //alert(text);
        //          alert(this.step);
        //          alert(this.totalSteps);
        //        alert(this.stepSize);
        //        alert(this.sliderWidth);
        //        alert(this.motionStartPosition);
        //        alert(this.motionCurrentPosition);
        //        alert(this.speed);

        // clear the timer in case someone clicks before motion is complete
        clearInterval(this.motionTimer);

        // update object to ensure at end position
        $(this.childDiv).style.left = "-" + (this.step * this.stepSize) + "px";

        // check current position
        var currentPosition = this.step * this.stepSize;

        // calculate new position
        if (this.step < this.totalSteps - 1) {
            this.step++;
            var newPosition = this.step * this.stepSize;

            // slide it if the newPosition is within the visible slider
            //            if (newPosition <= this.sliderWidth - this.stepSize) {
            // set start position
            this.motionStartPosition = currentPosition;

            // set current position
            this.motionCurrentPosition = currentPosition;

            // set end position
            this.motionEndPosition = newPosition;

            // start motion
            this.motionTimer = window.setInterval(obj + ".startMotion()", this.speed);
            //            }
            //            else {
            //                // decrement the step or it will affect the other calls
            //                this.step--;
            //            }
        }

        if (this.step > 0) {
            // Set button image
            document.getElementById(btnL).src = "Images/Slider_Left_Active.PNG";
            this.mouseOverLeft = "Images/Slider_Left_Over.PNG";
            this.mouseOutLeft = "Images/Slider_Left_Active.PNG";
        }
        else {
            document.getElementById(btnL).src = "Images/Slider_Left_Disabled.PNG";
            this.mouseOverLeft = "Images/Slider_Left_Disabled.PNG";
            this.mouseOutLeft = "Images/Slider_Left_Disabled.PNG";
        }

        if (this.step < this.totalSteps - 1) {
            document.getElementById(btnR).src = "Images/Slider_Right_Active.PNG";
            this.mouseOverRight = "Images/Slider_Right_Over.PNG";
            this.mouseOutRight = "Images/Slider_Right_Active.PNG";
        }
        else {
            document.getElementById(btnR).src = "Images/Slider_Right_Disabled.PNG";
            this.mouseOverRight = "Images/Slider_Right_Disabled.PNG";
            this.mouseOutRight = "Images/Slider_Right_Disabled.PNG";
        }

        // Add to attribute of panel object
        $(this.outerDiv).value = this.step;
    },
    setPosition: function(obj, pos) {
        // clear the timer in case someone clicks before motion is complete
        clearInterval(this.motionTimer);

        // check current position
        var currentPosition = this.step * this.stepSize;

        // calculate new position
        this.step = pos - 1;
        var newPosition = this.step * this.stepSize;

        // slide it if the newPosition is within the visible slider
        if (newPosition <= this.sliderWidth - this.stepSize) {
            // set start position
            this.motionStartPosition = currentPosition;

            // set current position
            this.motionCurrentPosition = currentPosition;

            // set end position
            this.motionEndPosition = newPosition;

            // start motion
            this.motionTimer = window.setInterval(obj + ".startMotion()", this.speed);
        }
        else {
            // decrement the step or it will affect the other calls
            this.step--;
        }

        // Add to attribute of panel object
        $(this.outerDiv).value = this.step;
    },
    getPosition: function(obj) {
        return (this.step + 1);
    },
    startMotion: function() {
        if (!this.startTime) {
            // set motion start time
            this.startTime = new Date().getTime();
        }

        // get elapsed motion time
        var elapsedTime = new Date().getTime() - this.startTime;

        if (elapsedTime < this.motionLength) {
            // motion is still active
            if (this.motionStartPosition > this.motionEndPosition) {
                // move to the left

                // get percentage increment (cos)
                var increment = (1 - Math.cos((elapsedTime / this.motionLength) * Math.PI)) / 2;

                // set new position
                this.motionCurrentPosition = this.motionStartPosition - (increment * this.stepSize);
            }
            else {
                // move to the right

                // get percentage increment (cos)
                var increment = (1 - Math.cos((elapsedTime / this.motionLength) * Math.PI)) / 2;

                // set new position
                this.motionCurrentPosition = this.motionStartPosition + (increment * this.stepSize);
            }

            // update object
            $(this.childDiv).style.left = "-" + this.motionCurrentPosition + "px";
        }
        else {
            // motion should be complete
            clearInterval(this.motionTimer);

            // reset startTime
            this.startTime = null;

            // update object to ensure at end position
            $(this.childDiv).style.left = "-" + (this.step * this.stepSize) + "px";

            //            if (this.motionEndPosition + this.stepSize == this.sliderWidth) {
            //                //on the last frame (last frame is a duplicate of first frame
            //                $(this.childDiv).style.left = "-" + this.stepSize + "px";
            //                this.step = 0;
            //            }
            //            else if (this.step == -1) {
            //                this.step = this.totalSteps - 1;
            //                $(this.childDiv).style.left = "-" + (this.step * this.stepSize) + "px";

            //            }
            //            else if (this.motionEndPosition)
            //                $(this.childDiv).style.left = "-" + this.motionEndPosition + "px";
        }
    }
});

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Down Home Consulting :: http://downhomeconsulting.com */

/*
Country State Drop Downs v1.0.
(c) Copyright 2005 Down Home Consulting, Inc.
www.DownHomeConsulting.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, itness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

*/

// If you have PHP you can set the post values like this
//var postState = '<?= $_POST["state"] ?>';
//var postCountry = '<?= $_POST["country"] ?>';
var postState = '';
var postCountry = '';

// State table
//
// To edit the list, just delete a line or add a line. Order is important.
// The order displayed here is the order it appears on the drop down.
//
var state = '\
US:AK:Alaska|\
US:AL:Alabama|\
US:AR:Arkansas|\
US:AS:American Samoa|\
US:AZ:Arizona|\
US:CA:California|\
US:CO:Colorado|\
US:CT:Connecticut|\
US:DC:D.C.|\
US:DE:Delaware|\
US:FL:Florida|\
US:FM:Micronesia|\
US:GA:Georgia|\
US:GU:Guam|\
US:HI:Hawaii|\
US:IA:Iowa|\
US:ID:Idaho|\
US:IL:Illinois|\
US:IN:Indiana|\
US:KS:Kansas|\
US:KY:Kentucky|\
US:LA:Louisiana|\
US:MA:Massachusetts|\
US:MD:Maryland|\
US:ME:Maine|\
US:MH:Marshall Islands|\
US:MI:Michigan|\
US:MN:Minnesota|\
US:MO:Missouri|\
US:MP:Marianas|\
US:MS:Mississippi|\
US:MT:Montana|\
US:NC:North Carolina|\
US:ND:North Dakota|\
US:NE:Nebraska|\
US:NH:New Hampshire|\
US:NJ:New Jersey|\
US:NM:New Mexico|\
US:NV:Nevada|\
US:NY:New York|\
US:OH:Ohio|\
US:OK:Oklahoma|\
US:OR:Oregon|\
US:PA:Pennsylvania|\
US:PR:Puerto Rico|\
US:PW:Palau|\
US:RI:Rhode Island|\
US:SC:South Carolina|\
US:SD:South Dakota|\
US:TN:Tennessee|\
US:TX:Texas|\
US:UT:Utah|\
US:VA:Virginia|\
US:VI:Virgin Islands|\
US:VT:Vermont|\
US:WA:Washington|\
US:WI:Wisconsin|\
US:WV:West Virginia|\
US:WY:Wyoming|\
US:AA:Military Americas|\
US:AE:Military Europe/ME/Canada|\
US:AP:Military Pacific|\
CA:AB:Alberta|\
CA:MB:Manitoba|\
CA:AB:Alberta|\
CA:BC:British Columbia|\
CA:MB:Manitoba|\
CA:NB:New Brunswick|\
CA:NL:Newfoundland and Labrador|\
CA:NS:Nova Scotia|\
CA:NT:Northwest Territories|\
CA:NU:Nunavut|\
CA:ON:Ontario|\
CA:PE:Prince Edward Island|\
CA:QC:Quebec|\
CA:SK:Saskatchewan|\
CA:YT:Yukon Territory|\
AU:AAT:Australian Antarctic Territory|\
AU:ACT:Australian Capital Territory|\
AU:NT:Northern Territory|\
AU:NSW:New South Wales|\
AU:QLD:Queensland|\
AU:SA:South Australia|\
AU:TAS:Tasmania|\
AU:VIC:Victoria|\
AU:WA:Western Australia|\
BR:AC:Acre|\
BR:AL:Alagoas|\
BR:AM:Amazonas|\
BR:AP:Amapa|\
BR:BA:Baia|\
BR:CE:Ceara|\
BR:DF:Distrito Federal|\
BR:ES:Espirito Santo|\
BR:FN:Fernando de Noronha|\
BR:GO:Goias|\
BR:MA:Maranhao|\
BR:MG:Minas Gerais|\
BR:MS:Mato Grosso do Sul|\
BR:MT:Mato Grosso|\
BR:PA:Para|\
BR:PB:Paraiba|\
BR:PE:Pernambuco|\
BR:PI:Piaui|\
BR:PR:Parana|\
BR:RJ:Rio de Janeiro|\
BR:RN:Rio Grande do Norte|\
BR:RO:Rondonia|\
BR:RR:Roraima|\
BR:RS:Rio Grande do Sul|\
BR:SC:Santa Catarina|\
BR:SE:Sergipe|\
BR:SP:Sao Paulo|\
BR:TO:Tocatins|\
NL:DR:Drente|\
NL:FL:Flevoland|\
NL:FR:Friesland|\
NL:GL:Gelderland|\
NL:GR:Groningen|\
NL:LB:Limburg|\
NL:NB:Noord Brabant|\
NL:NH:Noord Holland|\
NL:OV:Overijssel|\
NL:UT:Utrecht|\
NL:ZH:Zuid Holland|\
NL:ZL:Zeeland|\
UK:AVON:Avon|\
UK:BEDS:Bedfordshire|\
UK:BERKS:Berkshire|\
UK:BUCKS:Buckinghamshire|\
UK:CAMBS:Cambridgeshire|\
UK:CHESH:Cheshire|\
UK:CLEVE:Cleveland|\
UK:CORN:Cornwall|\
UK:CUMB:Cumbria|\
UK:DERBY:Derbyshire|\
UK:DEVON:Devon|\
UK:DORSET:Dorset|\
UK:DURHAM:Durham|\
UK:ESSEX:Essex|\
UK:GLOUS:Gloucestershire|\
UK:GLONDON:Greater London|\
UK:GMANCH:Greater Manchester|\
UK:HANTS:Hampshire|\
UK:HERWOR:Hereford & Worcestershire|\
UK:HERTS:Hertfordshire|\
UK:HUMBER:Humberside|\
UK:IOM:Isle of Man|\
UK:IOW:Isle of Wight|\
UK:KENT:Kent|\
UK:LANCS:Lancashire|\
UK:LEICS:Leicestershire|\
UK:LINCS:Lincolnshire|\
UK:MERSEY:Merseyside|\
UK:NORF:Norfolk|\
UK:NHANTS:Northamptonshire|\
UK:NTHUMB:Northumberland|\
UK:NOTTS:Nottinghamshire|\
UK:OXON:Oxfordshire|\
UK:SHROPS:Shropshire|\
UK:SOM:Somerset|\
UK:STAFFS:Staffordshire|\
UK:SUFF:Suffolk|\
UK:SURREY:Surrey|\
UK:SUSS:Sussex|\
UK:WARKS:Warwickshire|\
UK:WMID:West Midlands|\
UK:WILTS:Wiltshire|\
UK:YORK:Yorkshire|\
EI:CO ANTRIM:County Antrim|\
EI:CO ARMAGH:County Armagh|\
EI:CO DOWN:County Down|\
EI:CO FERMANAGH:County Fermanagh|\
EI:CO DERRY:County Londonderry|\
EI:CO TYRONE:County Tyrone|\
EI:CO CAVAN:County Cavan|\
EI:CO DONEGAL:County Donegal|\
EI:CO MONAGHAN:County Monaghan|\
EI:CO DUBLIN:County Dublin|\
EI:CO CARLOW:County Carlow|\
EI:CO KILDARE:County Kildare|\
EI:CO KILKENNY:County Kilkenny|\
EI:CO LAOIS:County Laois|\
EI:CO LONGFORD:County Longford|\
EI:CO LOUTH:County Louth|\
EI:CO MEATH:County Meath|\
EI:CO OFFALY:County Offaly|\
EI:CO WESTMEATH:County Westmeath|\
EI:CO WEXFORD:County Wexford|\
EI:CO WICKLOW:County Wicklow|\
EI:CO GALWAY:County Galway|\
EI:CO MAYO:County Mayo|\
EI:CO LEITRIM:County Leitrim|\
EI:CO ROSCOMMON:County Roscommon|\
EI:CO SLIGO:County Sligo|\
EI:CO CLARE:County Clare|\
EI:CO CORK:County Cork|\
EI:CO KERRY:County Kerry|\
EI:CO LIMERICK:County Limerick|\
EI:CO TIPPERARY:County Tipperary|\
EI:CO WATERFORD:County Waterford|\
';

// Country data table
//
// To edit the list, just delete a line or add a line. Order is important.
// The order displayed here is the order it appears on the drop down.
//
var country = '\
AF:Afghanistan|\
AL:Albania|\
DZ:Algeria|\
AS:American Samoa|\
AD:Andorra|\
AO:Angola|\
AI:Anguilla|\
AQ:Antarctica|\
AG:Antigua and Barbuda|\
AR:Argentina|\
AM:Armenia|\
AW:Aruba|\
AU:Australia|\
AT:Austria|\
AZ:Azerbaijan|\
AP:Azores|\
BS:Bahamas|\
BH:Bahrain|\
BD:Bangladesh|\
BB:Barbados|\
BY:Belarus|\
BE:Belgium|\
BZ:Belize|\
BJ:Benin|\
BM:Bermuda|\
BT:Bhutan|\
BO:Bolivia|\
BA:Bosnia And Herzegowina|\
XB:Bosnia-Herzegovina|\
BW:Botswana|\
BV:Bouvet Island|\
BR:Brazil|\
IO:British Indian Ocean Territory|\
VG:British Virgin Islands|\
BN:Brunei Darussalam|\
BG:Bulgaria|\
BF:Burkina Faso|\
BI:Burundi|\
KH:Cambodia|\
CM:Cameroon|\
CA:Canada|\
CV:Cape Verde|\
KY:Cayman Islands|\
CF:Central African Republic|\
TD:Chad|\
CL:Chile|\
CN:China|\
CX:Christmas Island|\
CC:Cocos (Keeling) Islands|\
CO:Colombia|\
KM:Comoros|\
CG:Congo|\
CD:Congo, The Democratic Republic O|\
CK:Cook Islands|\
XE:Corsica|\
CR:Costa Rica|\
CI:Cote d` Ivoire (Ivory Coast)|\
HR:Croatia|\
CU:Cuba|\
CY:Cyprus|\
CZ:Czech Republic|\
DK:Denmark|\
DJ:Djibouti|\
DM:Dominica|\
DO:Dominican Republic|\
TP:East Timor|\
EC:Ecuador|\
EG:Egypt|\
SV:El Salvador|\
GQ:Equatorial Guinea|\
ER:Eritrea|\
EE:Estonia|\
ET:Ethiopia|\
FK:Falkland Islands (Malvinas)|\
FO:Faroe Islands|\
FJ:Fiji|\
FI:Finland|\
FR:France (Includes Monaco)|\
FX:France, Metropolitan|\
GF:French Guiana|\
PF:French Polynesia|\
TA:French Polynesia (Tahiti)|\
TF:French Southern Territories|\
GA:Gabon|\
GM:Gambia|\
GE:Georgia|\
DE:Germany|\
GH:Ghana|\
GI:Gibraltar|\
GR:Greece|\
GL:Greenland|\
GD:Grenada|\
GP:Guadeloupe|\
GU:Guam|\
GT:Guatemala|\
GN:Guinea|\
GW:Guinea-Bissau|\
GY:Guyana|\
HT:Haiti|\
HM:Heard And Mc Donald Islands|\
VA:Holy See (Vatican City State)|\
HN:Honduras|\
HK:Hong Kong|\
HU:Hungary|\
IS:Iceland|\
IN:India|\
ID:Indonesia|\
IR:Iran|\
IQ:Iraq|\
IE:Ireland|\
EI:Ireland (Eire)|\
IL:Israel|\
IT:Italy|\
JM:Jamaica|\
JP:Japan|\
JO:Jordan|\
KZ:Kazakhstan|\
KE:Kenya|\
KI:Kiribati|\
KP:Korea, Democratic People\'S Repub|\
KW:Kuwait|\
KG:Kyrgyzstan|\
LA:Laos|\
LV:Latvia|\
LB:Lebanon|\
LS:Lesotho|\
LR:Liberia|\
LY:Libya|\
LI:Liechtenstein|\
LT:Lithuania|\
LU:Luxembourg|\
MO:Macao|\
MK:Macedonia|\
MG:Madagascar|\
ME:Madeira Islands|\
MW:Malawi|\
MY:Malaysia|\
MV:Maldives|\
ML:Mali|\
MT:Malta|\
MH:Marshall Islands|\
MQ:Martinique|\
MR:Mauritania|\
MU:Mauritius|\
YT:Mayotte|\
MX:Mexico|\
FM:Micronesia, Federated States Of|\
MD:Moldova, Republic Of|\
MC:Monaco|\
MN:Mongolia|\
MS:Montserrat|\
MA:Morocco|\
MZ:Mozambique|\
MM:Myanmar (Burma)|\
NA:Namibia|\
NR:Nauru|\
NP:Nepal|\
NL:Netherlands|\
AN:Netherlands Antilles|\
NC:New Caledonia|\
NZ:New Zealand|\
NI:Nicaragua|\
NE:Niger|\
NG:Nigeria|\
NU:Niue|\
NF:Norfolk Island|\
MP:Northern Mariana Islands|\
NO:Norway|\
OM:Oman|\
PK:Pakistan|\
PW:Palau|\
PS:Palestinian Territory, Occupied|\
PA:Panama|\
PG:Papua New Guinea|\
PY:Paraguay|\
PE:Peru|\
PH:Philippines|\
PN:Pitcairn|\
PL:Poland|\
PT:Portugal|\
PR:Puerto Rico|\
QA:Qatar|\
RE:Reunion|\
RO:Romania|\
RU:Russian Federation|\
RW:Rwanda|\
KN:Saint Kitts And Nevis|\
SM:San Marino|\
ST:Sao Tome and Principe|\
SA:Saudi Arabia|\
SN:Senegal|\
XS:Serbia-Montenegro|\
SC:Seychelles|\
SL:Sierra Leone|\
SG:Singapore|\
SK:Slovak Republic|\
SI:Slovenia|\
SB:Solomon Islands|\
SO:Somalia|\
ZA:South Africa|\
GS:South Georgia And The South Sand|\
KR:South Korea|\
ES:Spain|\
LK:Sri Lanka|\
NV:St. Christopher and Nevis|\
SH:St. Helena|\
LC:St. Lucia|\
PM:St. Pierre and Miquelon|\
VC:St. Vincent and the Grenadines|\
SD:Sudan|\
SR:Suriname|\
SJ:Svalbard And Jan Mayen Islands|\
SZ:Swaziland|\
SE:Sweden|\
CH:Switzerland|\
SY:Syrian Arab Republic|\
TW:Taiwan|\
TJ:Tajikistan|\
TZ:Tanzania|\
TH:Thailand|\
TG:Togo|\
TK:Tokelau|\
TO:Tonga|\
TT:Trinidad and Tobago|\
XU:Tristan da Cunha|\
TN:Tunisia|\
TR:Turkey|\
TM:Turkmenistan|\
TC:Turks and Caicos Islands|\
TV:Tuvalu|\
UG:Uganda|\
UA:Ukraine|\
AE:United Arab Emirates|\
UK:United Kingdom|\
GB:Great Britain|\
US:United States|\
UM:United States Minor Outlying Isl|\
UY:Uruguay|\
UZ:Uzbekistan|\
VU:Vanuatu|\
XV:Vatican City|\
VE:Venezuela|\
VN:Vietnam|\
VI:Virgin Islands (U.S.)|\
WF:Wallis and Furuna Islands|\
EH:Western Sahara|\
WS:Western Samoa|\
YE:Yemen|\
YU:Yugoslavia|\
ZR:Zaire|\
ZM:Zambia|\
ZW:Zimbabwe|\
';

function TrimString(sInString) {
  if ( sInString ) {
    sInString = sInString.replace( /^\s+/g, "" );// strip leading
    return sInString.replace( /\s+$/g, "" );// strip trailing
  }
}

// Populates the country selected with the counties from the country list
function populateCountry(defaultCountry,parent) {
  if ( postCountry != '' ) {
    defaultCountry = postCountry;
  }
  var countryLineArray = country.split('|');  // Split into lines
  var selObj = document.getElementById(parent + 'countrySelect');
  selObj.options[0] = new Option('Select Country','');
  selObj.selectedIndex = 0;
  for (var loop = 0; loop < countryLineArray.length; loop++) {
    lineArray = countryLineArray[loop].split(':');
    countryCode  = TrimString(lineArray[0]);
    countryName  = TrimString(lineArray[1]);
    if ( countryCode != '' ) {
      selObj.options[loop + 1] = new Option(countryName, countryCode);
    }
    if ( defaultCountry == countryCode ) {
      selObj.selectedIndex = loop + 1;
    }
  }
}

function populateState(parent) {
  var selObj = document.getElementById(parent + 'stateSelect');
  var foundState = false;
  // Empty options just in case new drop down is shorter
  if ( selObj.type == 'select-one' ) {
    for (var i = 0; i < selObj.options.length; i++) {
      selObj.options[i] = null;
    }
    selObj.options.length=null;
    selObj.options[0] = new Option('Select State','');
    selObj.selectedIndex = 0;
  }
  // Populate the drop down with states from the selected country
  var stateLineArray = state.split("|");  // Split into lines
  var optionCntr = 1;
  for (var loop = 0; loop < stateLineArray.length; loop++) {
    lineArray = stateLineArray[loop].split(":");
    countryCode  = TrimString(lineArray[0]);
    stateCode    = TrimString(lineArray[1]);
    stateName    = TrimString(lineArray[2]);
    if (document.getElementById(parent + 'countrySelect').value == countryCode && countryCode != '') {
    // If it's a input element, change it to a select
      if ( selObj.type == 'text' ) {
          parentObj = document.getElementById(parent + 'stateSelect').parentNode;
        parentObj.removeChild(selObj);
        var inputSel = document.createElement("SELECT");
        inputSel.setAttribute("name","state");
        inputSel.setAttribute("id","stateSelect");
        parentObj.appendChild(inputSel);
        selObj = document.getElementById(parent + 'stateSelect');
        selObj.options[0] = new Option('Select State','');
        selObj.selectedIndex = 0;
      }
      if ( stateCode != '' ) {
        selObj.options[optionCntr] = new Option(stateName, stateCode);
      }
      // See if it's selected from a previous post
      if ( stateCode == postState && countryCode == postCountry ) {
        selObj.selectedIndex = optionCntr;
      }
      foundState = true;
      optionCntr++;
    }
  }
  // If the country has no states, change the select to a text box
  if ( ! foundState ) {
      parentObj = document.getElementById(parent + 'stateSelect').parentNode;
    parentObj.removeChild(selObj);
  // Create the Input Field
    var inputEl = document.createElement("INPUT");
    inputEl.setAttribute("id", "stateSelect");
    inputEl.setAttribute("type", "text");
    inputEl.setAttribute("name", "state");
    inputEl.setAttribute("size", 20);
    inputEl.setAttribute("value", postState);
    parentObj.appendChild(inputEl);
  }
}

function initCountry(country,parent) {
  populateCountry(country,parent);
  populateState(parent);
}


function onSelectAllProfile(child, parent) 
{
    // Set all checkboxes of type
    var element = parent + child + '_FirstName_CheckBox';
    var selObj = document.getElementById(parent + child + '_FirstName_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_LastName_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_UserName_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_NickName_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_Location_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_Email_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_Website_CheckBox');
    if( selObj )
        selObj.checked= true;
    selObj = document.getElementById(parent + child + '_Lists_CheckBox');
    if( selObj )
        selObj.checked = true;
    return false;
}

function onDeselectAllProfile(child, parent) 
{
    // Set all checkboxes of type
    var selObj = document.getElementById(parent + child + '_FirstName_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_LastName_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_UserName_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_NickName_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_Location_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_Email_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_Website_CheckBox');
    if( selObj )
        selObj.checked= false;
    selObj = document.getElementById(parent + child + '_Lists_CheckBox');
    if( selObj )
        selObj.checked= false;
    return false;
}

function setRank(rating, pane, type, control, empty, filled) {
    var r = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_RatingExtender_ClientState");
    if (r)
        r.setAttribute("value", rating);
    var t = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_A");
    if (t)
        t.setAttribute("title", rating);
    var star1 = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_Star_1");
    if (star1 && rating == 0)
        star1.className = "ratingThumb " + empty;
    else if (star1 && rating > 0)
        star1.className = "ratingThumb " + filled;

    var star2 = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_Star_2");
    if (star2 && rating < 2)
        star2.className = "ratingThumb " + empty;
    else if (star2 && rating > 1)
        star2.className = "ratingThumb " + filled;

    var star3 = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_Star_3");
    if (star3 && rating < 3)
        star3.className = "ratingThumb " + empty;
    else if (star3 && rating > 2)
        star3.className = "ratingThumb " + filled;

    var star4 = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_Star_4");
    if (star4 && rating < 4)
        star4.className = "ratingThumb " + empty;
    else if (star4 && rating > 3)
        star4.className = "ratingThumb " + filled;

    var star5 = document.getElementById("ViewListControl1_MyLists_MyLists_AccordionPane" + pane + "_content_" + type + "_MyProductControl" + control + "_RatingControl_Star_5");
    if (star5 && rating < 5)
        star5.className = "ratingThumb " + empty;
    else if (star5 && rating > 4)
        star5.className = "ratingThumb " + filled;

}


var DynamicSlider = Class.create(
{
    initialize: function(userName, listType, contentPlaceholders, totalItems, width, height) {
        this.curStep = -3;  // ensures zero
        this.totalItems = totalItems;
        this.userName = userName;
        this.listType = listType;
        this.imageWidth = width;
        this.imageHeight = height;
        this.contentPlaceholders = contentPlaceholders;
        // this.getTotal(userName, listType);
        // this.loadNext(userName, listType, contentPlaceholders);
    },

    getTotal: function(userName, listType) {
        ProductService.GetProductCount(userName, listType, this.totalCallback);
    },

    totalCallback: function(result) {
        this.totalItems = result;
        var t = document.getElementById("TotalLabel")
        if (t)
            t.value = result;
        var s = document.getElementById("SliderExtender1")
        if (s)
            s.setAttribute("Maximum", result);
        ProductService.LoadNext(this.userName, this.listType, this.curStep, 3, this.contentPlaceholders, this.imageWidth, this.imageHeight, this.productsCallback);
    },

    setPosition: function(pos,textbox, textbox2, totallabel, slider) {
        this.textbox = textbox;
        this.textbox2 = textbox2;
        this.totallabel = totallabel;
        this.slider = slider;

        var t2 = document.getElementById(this.textbox2)
        if (t2) {
            this.curStep = t2.value - 4;
        }
        this.loadNext(this.userName, this.listType, this.contentPlaceholders);
    },

    slidePosition: function(textbox, textbox2, totallabel, slider) {
        this.textbox = textbox;
        this.textbox2 = textbox2;
        this.totallabel = totallabel;
        this.slider = slider;

        var t = document.getElementById(textbox)
        if (t) {
            this.curStep = t.value - 4;
        }
        var l = document.getElementById(totallabel)
        if (l)
            l.innerHTML = this.totalItems;
        var s = document.getElementById(slider)
        if (s) {
            s.value = this.totalItems;
            s.setAttribute("Maximum", this.totalItems);
        }
        this.loadNext(this.userName, this.listType, this.contentPlaceholders);
    },
    
    loadNext: function(userName, listType, contentPlaceholders) {
        if (this.curStep == null)
            this.curStep = 0;
        else {
            this.curStep += 3;
            if (this.totalItems != null && this.totalItems != 0 && this.curStep > this.totalItems)
                this.curStep = this.totalItems - 3;
        }
        
        var t = document.getElementById(this.textbox)
        if (t) {
            t.value = this.curStep + 1;
        }
        var t2 = document.getElementById(this.textbox2)
        if (t2) {
            t2.value = this.curStep + 1;
        }
        
        ProductService.LoadNext(userName, listType, this.curStep, 3, contentPlaceholders, this.imageWidth, this.imageHeight, this.productsCallback);
    },

    loadPrev: function(userName, listType, contentPlaceholders) {
        if (this.curStep == null)
            this.curStep = 0;
        else {
            this.curStep -= 3;
            if (this.curStep < 0)
                this.curStep = 0;
        }

        var t = document.getElementById(this.textbox)
        if (t) {
            t.value = this.curStep + 1;
        }
        var t2 = document.getElementById(this.textbox2)
        if (t2) {
            t2.value = this.curStep + 1;
        }
        
        ProductService.LoadNext(userName, listType, this.curStep, 3, contentPlaceholders, this.imageWidth, this.imageHeight, this.productsCallback);
    },

    productsCallback: function(result) {
        if (result == "Error Loading Products")
            return;
        var splitResults = result.split("|");
        var val = 18;
        for (var i = 1; i < 4; i++) {

            // get ID's
            var pos = (i - 1) * 6;
            var nameID = splitResults[pos++];
            var imageID = splitResults[pos++];
            var rankLabel1ID = splitResults[pos++];
            var rankLabel2ID = splitResults[pos++];
            var originalRankID = splitResults[pos++];
            var commentID = splitResults[pos++];

            var imageWidth = splitResults[val++];
            var imageHeight = splitResults[val++];
            var imagePad = splitResults[val++];
            var productName = splitResults[val++] + " " + splitResults[val++];
            if (splitResults[val].length > 1)
                productName += " - " + splitResults[val++];
            else
                val++;
            var longName = productName;
            if (productName.length > 28)
                productName = constrain(productName, 28);
            //            productName = productName.replace(new RegExp("^(.{0," + 30 + "}\\b).*"), '$1');
            var productImage = splitResults[val++];
            var productComment = splitResults[val++];
            var longComment = productComment;
            if (productComment.length > 70)
                productComment = constrain(productComment, 70);
            //            productComment = productComment.replace(new RegExp("^(.{0," + 30 + "}\\b).*"), '$1');
            var productPos = splitResults[val++];
            var totalProducts = splitResults[val++];
            var rating = splitResults[val++];

            if (nameID.match("AccordionPane1"))
                setRank(rating, 1, "Cool", i - 1, "emptyRatingThumbUp", "filledRatingThumbCool");
            else if (nameID.match("AccordionPane2"))
                setRank(rating, 2, "Hot", i - 1, "emptyRatingThumbUp", "filledRatingThumbHot");
            else if (nameID.match("AccordionPane3"))
                setRank(rating, 3, "Not", i - 1, "emptyRatingThumbDown", "filledRatingThumbNot");

            // Update the product details
            var e = document.getElementById(rankLabel1ID);
            if (e) {
                if (e.value)
                    e.value = productPos;
                else
                    e.innerHTML = productPos;
            }
            e = document.getElementById(rankLabel2ID);
            if (e) {
                if (e.value)
                    e.value = totalProducts;
                else
                    e.innerHTML = totalProducts;
            }
            e = document.getElementById(originalRankID);
            if (e) {
                if (e.value)
                    e.value = productPos;
                else
                    e.innerHTML = productPos;
            }
            e = document.getElementById(nameID);
            if (e) {
                if (e.value)
                    e.value = productName;
                else
                    e.innerHTML = productName;
            }
            e = document.getElementById(imageID);
            if (e) {
                e.setAttribute("title", "Click to learn more about the " + longName);
                e.style.marginTop = imagePad + "px";
                if (imageWidth == "0")
                    e.style.width = "";
                else
                    e.style.width = imageWidth + "px";
                if (imageHeight == "0")
                    e.style.height = "";
                else
                    e.style.height = imageHeight + "px";
                if (productImage.match("http"))
                    e.setAttribute("src", productImage);
                else
                    e.setAttribute("src", "ShowImage.ashx?id=" + productImage);
            }
            e = document.getElementById(commentID);
            if (e) {
                e.setAttribute("title", longComment);
                if (e.value)
                    e.value = productComment;
                else
                    e.innerHTML = productComment;
            }
        }
    }

    //    productsCallback: function(result) {
    //        var splitResults = result.split("|");
    //        var val = 3;
    //        for (var i = 1; i < 4; i++) {
    //            var t = document.getElementById(splitResults[i - 1]);
    //            if (t) {
    //                //                var code = "<p> blablabal babala babababab</p>";
    //                //                code += "<h1>here comes header</h1>";
    //                //                code += "<span>" + result + "</span>";
    //                //                t.innerHTML = code;

    //                var productName = splitResults[val++] + " " + splitResults[val++] + " - " + splitResults[val++];
    //                if (productName.length > 30)
    //                    productName = productName.replace(new RegExp("^(.{0," + 30 + "}\\b).*"), '$1');
    //                var productImage = splitResults[val++];
    //                var productComment = splitResults[val++];
    //                var productPos = splitResults[val++];
    //                var totalProducts = splitResults[val++];
    //                var html = "<tr>" +
    //        "<td align=\"center\">" +
    //            "<div id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Panel3\" " +
    //                "style=\"border: 2px solid rgb(231, 231, 231); height: 115px; width: 174px;\">" +
    //                "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$ProductImageButton\" " +
    //                    "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_ProductImageButton\" " +
    //                    "title=\"Click to learn more about " + productName + "\" onload=\"RetrievePicture(this,\"" + productImage + "\");\"";
    //                if (productImage.match("http"))
    //                    html += " src=\"" + productImage + "\"";
    //                else
    //                    html += " src=\"ShowImage.ashx?id=" + productImage + "\"";
    //                html += " style=\"border-width: 0px; height: 115px; margin-top: 0px;\" align=\"absmiddle\" " +
    //                    "type=\"image\">" +
    //                "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$ProductImageButton_Dummy\" " +
    //                    "value=\"\" id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_ProductImageButton_Dummy\" " +
    //                    "style=\"display: none;\" type=\"submit\">" +
    //            "</div>" +
    //        "</td>" +
    //        "</tr>" +
    //        "<tr>" +
    //        "<td>" +
    //            "<span id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Product_Name\" " +
    //                "style=\"color: Black; font-weight: bold;\">" + productName + "</span>" +
    //        "</td>" +
    //        "</tr>" +
    //        "<tr>" +
    //        "<td>" +
    //            "<table id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Table2\" " +
    //                "border=\"0\">" +
    //                "<tbody>" +
    //                    "<tr>" +
    //                        "<td>" +
    //                            "<span id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Label1\">" +
    //                                "Rank:</span>" +
    //                        "</td>" +
    //                        "<td>" +
    //                            "<span>" +
    //                                "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$Rank_Label1\" " +
    //                                    "value=\"" + productPos + "\" id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Rank_Label1\" " +
    //                                    "onkeypress=\"return clickButton(event,\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Move_Button\")\" " +
    //                                    "style=\"color: rgb(0, 118, 177); font-weight: bold; width: 18px;\" type=\"text\"><span " +
    //                                        "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Label3\" " +
    //                                        "style=\"color: rgb(153, 153, 153); font-weight: bold; font-style: italic;\">of" +
    //                                "</span><span id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Rank_Label2\" " +
    //                                    "style=\"color: rgb(0, 118, 177); font-weight: bold;\">" + totalProducts + "</span></span>" +
    //                        "</td>" +
    //                        "<td style=\"float: left;\">" +
    //                            "<span>" +
    //                                "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$RankUp_Button\" " +
    //                                    "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RankUp_Button\" " +
    //                                    "title=\"Click to move product up one on your list\" onmouseover='this.src=\"Images/RankUp_Hover.PNG\";' " +
    //                                    "onmouseout='this.src=\"Images/RankUp.PNG\";' src=\"Images/RankUp.PNG\" style=\"border-width: 0px;" +
    //                                    "height: 20px; width: 20px;\" type=\"image\"><input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$RankDown_Button\" " +
    //                                        "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RankDown_Button\" " +
    //                                        "title=\"Click to move product down one on your list\" onmouseover='this.src=\"Images/RankDown_Hover.PNG\";' " +
    //                                        "onmouseout='this.src=\"Images/RankDown.PNG\";' src=\"Images/RankDown.PNG\" style=\"border-width: 0px;" +
    //                                        "height: 20px; width: 20px;\" type=\"image\"></span>" +
    //                            "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$Move_Button\" " +
    //                                "value=\"Move\" id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Move_Button\" " +
    //                                "style=\"display: none;\" type=\"submit\">" +
    //                        "</td>" +
    //                        "<td>" +
    //                        "</td>" +
    //                    "</tr>" +
    //                    "<tr>" +
    //                        "<td>" +
    //                            "<span id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Label2\">" +
    //                                "Rating:</span>" +
    //                        "</td>" +
    //                        "<td id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Rating\" " +
    //                            "colspan=\"4\">" +
    //                            "<div id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl\" " +
    //                                "title=\"Rate your product from 1 to 5 (5 Coolest)\">" +
    //                                "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$RatingControl_RatingExtender_ClientState\" " +
    //                                    "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_RatingExtender_ClientState\" " +
    //                                    "value=\"4\" type=\"hidden\">" +
    //                                "<a href=\"javascript:void(0)\" id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_A\" " +
    //                                    "title=\"4\" style=\"text-decoration: none;\"><span id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_Star_1\" " +
    //                                        "class=\"ratingThumb filledRatingThumbCool\" style=\"float: left;\">&nbsp;</span><span" +
    //                                            "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_Star_2\" " +
    //                                            "class=\"ratingThumb filledRatingThumbCool\" style=\"float: left;\">&nbsp;</span><span" +
    //                                                "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_Star_3\" " +
    //                                                "class=\"ratingThumb filledRatingThumbCool\" style=\"float: left;\">&nbsp;</span><span" +
    //                                                    "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_Star_4\" " +
    //                                                    "class=\"ratingThumb filledRatingThumbCool\" style=\"float: left;\">&nbsp;</span><span" +
    //                                                        "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_RatingControl_Star_5\" " +
    //                                                        "class=\"ratingThumb emptyRatingThumbUp\" style=\"float: left;\">&nbsp;</span></a>" +
    //                            "</div>" +
    //                        "</td>" +
    //                    "</tr>" +
    //                    "<tr>" +
    //                        "<td colspan=\"5\" style=\"height: 41px;\">" +
    //                            "<span id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Product_Comment\" " +
    //                                "title=\"" + productComment + "\" style=\"display: inline-block; color: Gray; " +
    //                                "font-size: 9px; font-weight: bold; height: 40px; width: 205px;\">" + productComment + "</span>" +
    //                        "</td>" +
    //                    "</tr>" +
    //                    "<tr>" +
    //                        "<td>" +
    //                            "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$New_Button\" " +
    //                                "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_New_Button\" " +
    //                                "title=\"Create a new product in your list\" text=\"New\" onmouseover='this.src=\"Styles/Images/new-product-bt2.PNG\";' " +
    //                                "onmouseout='this.src=\"Styles/Images/new-product-bt1.PNG\";' src=\"Styles/Images/new-product-bt1.PNG\" " +
    //                                "style=\"border-width: 0px;\" type=\"image\">" +
    //                        "</td>" +
    //                        "<td>" +
    //                            "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$Edit_Button\" " +
    //                                "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Edit_Button\" " +
    //                                "title=\"Edit or move the product\" text=\"Edit\" onmouseover='this.src=\"Styles/Images/edit-product-bt2.PNG\";' " +
    //                                "onmouseout='this.src=\"Styles/Images/edit-product-bt1.PNG\";' src=\"Styles/Images/edit-product-bt1.PNG\" " +
    //                                "style=\"border-width: 0px;\" type=\"image\">" +
    //                        "</td>" +
    //                        "<td>" +
    //                            "<input name=\"ViewListControl1$MyLists$MyLists$AccordionPane1_content$Cool$MyProductControl0$Remove_Button\" " +
    //                                "id=\"ViewListControl1_MyLists_MyLists_AccordionPane1_content_Cool_MyProductControl0_Remove_Button\" " +
    //                                "title=\"Remove product from your list\" text=\"Remove\" onmouseover='this.src=\"Styles/Images/remove-product-bt2.PNG\";' " +
    //                                "onmouseout='this.src=\"Styles/Images/remove-product-bt1.PNG\";' src=\"Styles/Images/remove-product-bt1.PNG\" " +
    //                                "style=\"border-width: 0px;\" type=\"image\">" +
    //                        "</td>" +
    //                        "<td>" +
    //                        "</td>" +
    //                        "<td>" +
    //                        "</td>" +
    //                    "</tr>" +
    //                "</tbody>" +
    //            "</table>" +
    //        "</td>" +
    //        "</tr>";
    //                t.innerHTML = html;
    //            }
    //        }
    //    }
});