﻿




function DoBox() {
    $('.BoxFs').each(function() {
        Rounded(this, '#0099CC', '#339933', '#FFFFCC', '#FFCC66', false);
    });
};

$(function() {
    var offsetX = 10;
    var offsetY = 10;

    $('.AdDetails_ImageCenter a').hover(function(e) {
        var href = $(this).attr('href');
        $('<img id="LargeImage" src="' + href + '" alt="" />')
                .css('top', e.pageY + offsetY)
                .css('left', e.pageX + offsetX)
                .appendTo('body');

    }, function() {
        $('#LargeImage').remove();
    });

    $('.AdDetails_ImageCenter a').mousemove(function(e) {
        var href = $(this).attr('href');
        $('#LargeImage').css('top', e.pageY + offsetY).css('left', e.pageX + offsetX);
    });
});

$(function() {



    //    $('.Box').each(function() {
    //        Rounded(this, '#0099CC', '#339933', '#FFFFCC', '#66CCFF', false);
    //    });
    //    $('.UserForm').each(function() {
    //        Rounded(this, '#0099CC', '#339933', '#FFFFCC', '#66CCFF', false);
    //    });
    //    $('.BoxFs').each(function() {
    //        Rounded(this, '#0099CC', '#339933', '#FFFFCC', '#FFCC66', false);
    //    });
    //    $('.BoxFu').each(function() {
    //        Rounded(this, '#0099CC', '#339933', '#FFCC66', '#FFFFCC', false);
    //    });
    $('fieldset label').each(function() {
    $(this).append(" :&nbsp;");

        Rounded(this, '#FFCCFF', '#FFCCFF', '#FFCCFF', '#FFFFCC', true);
    });
    $('label.Private').each(function() {
    Rounded(this, '#99FFFF', '#99FFFF', '#99FFFF', '#FFFFCC', true);
    });
    $('label.Business').each(function() {
    Rounded(this, '#FF9999', '#FF9999', '#FF9999', '#FFFFCC', true);
    });
    $('label.Free').each(function() {
    Rounded(this, '#CCFF66', '#CCFF66', '#CCFF66', '#FFFFCC', true);
    });
    $('label.Wanted').each(function() {
    Rounded(this, '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFCC', true);
});
    
    $('label#FPLatest').each(function() {
        Rounded(this, '#00CC00', '#00CC00', '#00CC00', '#66CCFF', true);
    });

    $('#SelectAdtype').change(function() {
        var Selected = (this).value;
        var Reff = document.referrer + "Classified/ClassifiedAdsType/" + Selected;
        $.ajax({ type: "Post", url: Reff });

//        document.location.href = Reff;

    })
     ;
    //    $('#SelDDL').hover(
    //      function() {
    //          $(this).css({ "height": "200px", "background-color": "yellow", "font-weight": "bolder" });
    //      },
    //      function() {
    //          $(this).css({ "height": "20px", "background-color": "#6699FF", "font-weight": "normal" });
    //      }
    //    );
    //    $('.SubmitButton').hover(
    //      function() {
    //          $(this)[0].src = "../../Content/Images/" + $(this)[0].id + "_IN.png";
    //      },
    //      function() {
    //          $(this)[0].src = "../../Content/Images/" + $(this)[0].id + "_OUT.png";
    //      }
    //    );
    //    #SelDDL

});

function Rounded(selector, colorTop, colorBottom, backGround, bgcolor, size) {
    makeBox(selector, true, colorTop, backGround, bgcolor, size);
    makeBox(selector, false, colorBottom, backGround, bgcolor, size);
};

function makeBox(el, isTop, color, backGround, bgcolor, isSmall) {
    //    var bgcolor;
    var bb = css_browser_selector(navigator.userAgent);
    //    var te = bb.substr(0, 2);
    //    if (te == 'ie')
    //    { bgcolor = el.parentNode.parentNode.currentStyle.backgroundColor; ; }
    //    else
    //    { bgcolor = document.bgColor; }
    //    if (bgcolor == 'transparent') { bgcolor = document.bgColor; }
    //    //    bgcolor = '#F00' 
    var i;
    if (isTop) {
        if (isSmall)
        { i = new Array('2', '1'); }
        else
        { i = new Array('5', '3', '2', '1'); }
    }
    else {
        if (isSmall)
        { i = new Array('1', '2'); }
        else
        { i = new Array('1', '2', '3', '5'); }
    }
    var d = document.createElement("b");
    d.className = "bbb";
    d.style.backgroundColor = bgcolor;
    for (x in i) {
        AddD(d, i[x], color);
    }
    el.style.backgroundColor = backGround;
    if (isTop)
    { el.insertBefore(d, el.firstChild); }
    else
    { el.appendChild(d, el.firstChild); }
};

function AddD(d, width, color) {
    var x = document.createElement("b");
    //    x.style.margin = '0px ' + width + 'px;';
    x.style.marginLeft = width + "px";
    x.style.marginRight = width + "px";
    x.style.backgroundColor = color;
    if (width == 1) { x.style.height = '2px'; }
    d.appendChild(x);
};





function css_browser_selector(u) { var ua = u.toLowerCase(), is = function(t) { return ua.indexOf(t) > -1; }, g = 'gecko', w = 'webkit', s = 'safari', h = document.getElementsByTagName('html')[0], b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + RegExp.$1) : is('firefox/2') ? g + ' ff2' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : /opera(\s|\/)(\d+)/.test(ua) ? 'opera opera' + RegExp.$2 : is('konqueror') ? 'konqueror' : is('chrome') ? w + ' ' + s + ' chrome' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.$1 : '') : is('mozilla/') ? g : '', is('j2me') ? 'mobile' : is('iphone') ? 'iphone' : is('ipod') ? 'ipod' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js']; c = b.join(' '); h.className += ' ' + c; return c; }; css_browser_selector(navigator.userAgent); 

