
$(document).ready(function(){
    $.fn.extend({
        getFrontAd: function(url, aid, width, height){
            var b = document.getElementsByTagName("base");
            b = b[0].href;
            var info = "";
            $.ajax({
                type: 'post',
                url: b + url,
                dataType: 'json',
                success: function(json){
                    if (json != null && json != '') {
                        if (json.length > 1) {
                            $.each(json, function(i, v){
                                if (json[i]['adtype'] != 3) {
                                    info += "<a href='" + b + "ft/shop.do?link=updateAd&advertiseID=" + json[i]['advertiseID'] + "&url=" + json[i]['linkURLO'] + "' target='_blank'><img src='" + b + json[i]['content'] + "' width='" + width + "' height='" + height + "' alt='" + json[i]['name'] + "'/></a>";
                                }
                                else {
                                    info += '<embed src="' + b + json[0]['content'] + ' " wmode="transparent" quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' +
                                    width +
                                    '" height="' +
                                    height +
                                    '"></embed>';
                                }
                                
                            });
                        }
                        else {
                            if (json[0]['adtype'] != 3) {
                                info = "<a href='" + b + "ft/shop.do?link=updateAd&advertiseID=" + json[0]['advertiseID'] + "&url=" + json[0]['linkURLO'] + "' target='_blank'><img src='" + b + json[0]['content'] + "' width='" + width + "' height='" + height + "' alt='" + json[0]['name'] + "'/></a>";
                            }
                            else {
                                info = '<embed src="' + b + json[0]['content'] + ' " wmode="transparent" quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' +
                                width +
                                '" height="' +
                                height +
                                '"></embed>';
                            }
                        }
                        $("#" + aid).html("");
                        $("#" + aid).append(info);
                    }
                }
            });
        },
        getClassAd: function(url, aid, width, height){
            var b = document.getElementsByTagName("base");
            b = b[0].href;
            var info = "";
            $.ajax({
                type: 'post',
                url: b + url,
                dataType: 'json',
                success: function(json){
                    if (json != null && json != '') {
                        if (json.length > 1) {
                            $.each(json, function(i, v){
                                if (json[i]['adtype'] != 3) {
                                    info += "<dd class='border'><a href='" + b + "ft/shop.do?link=updateAd&advertiseID=" + json[0]['advertiseID'] + "&url=" + json[0]['linkURL'] + "' target='_blank'><img src='" + b + json[i]['content'] + "' width='" + width + "' height='" + height + "' alt='" + json[i]['name'] + "'/></a></div>";
                                }
                                else {
                                    info += '<embed src="' + b + json[0]['content'] + ' " wmode="transparent" quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' +
                                    width +
                                    '" height="' +
                                    height +
                                    '"></embed>';
                                }
                            });
                        }
                        $("#" + aid).html("");
                        $("#" + aid).append(info);
                    }
                }
            });
        },
        getFrontAdRC: function(url, aid, width, height){
            var b = document.getElementsByTagName("base");
            b = b[0].href;
            var info = "";
            $.ajax({
                type: 'post',
                url: b + url,
                dataType: 'json',
                success: function(json){
                    if (json != null && json != '') {
                        if (json.length > 1) {
                            $.each(json, function(i, v){
                                if (json[i]['adtype'] != 3) {
                                    info += "<li><a href='" + b + "ft/shop.do?link=updateAd&advertiseID=" + json[i]['advertiseID'] + "&url=" + json[i]['linkURLO'] + "' target='_blank'><img src='" + b + json[i]['content'] + "' width='" + width + "' height='" + height + "' alt='" + json[i]['name'] + "'/></a></li>";
                                }
                                else {
                                    info += '<li><embed src="' + b + json[0]['content'] + ' " wmode="transparent" quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' +
                                    width +
                                    '" height="' +
                                    height +
                                    '"></embed></li>';
                                }
                                
                            });
                        }
                        else {
                            if (json[0]['adtype'] != 3) {
                                info = "<li><a href='" + b + "ft/shop.do?link=updateAd&advertiseID=" + json[0]['advertiseID'] + "&url=" + json[0]['linkURLO'] + "' target='_blank'><img src='" + b + json[0]['content'] + "' width='" + width + "' height='" + height + "' alt='" + json[0]['name'] + "'/></a></li>";
                            }
                            else {
                                info = '<li><embed src="' + b + json[0]['content'] + ' " wmode="transparent" quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' +
                                width +
                                '" height="' +
                                height +
                                '"></embed></li>';
                            }
                        }
                        $("#" + aid).html("");
                        $("#" + aid).append(info);
                    }
                }
            });
        },
        getFrontCompanyEverts: function(){
        
        }
    });
});

