
    gal_loadjscssfile = function(filename, filetype, fn) {
        if (filetype == "js") {
            var fileref = document.createElement("script");
            fileref.setAttribute("type", "text/javascript");
            fileref.setAttribute("src", filename);
        } else if (filetype == "css") {
            var fileref = document.createElement("link");
            fileref.setAttribute("rel", "stylesheet");
            fileref.setAttribute("type", "text/css");
            fileref.setAttribute("href", filename);
        }
        if (typeof fileref != "undefined")
            document.getElementsByTagName("head")[0].appendChild(fileref);

        if (typeof fn != "undefined") {
            if (fileref.readyState) {  //IE
                fileref.onreadystatechange = function() {
                    if (fileref.readyState == "loaded" ||
                            fileref.readyState == "complete") {
                        fileref.onreadystatechange = null;
                        fn();
                    }
                };
            } else {  //Others
                fileref.onload = function() {
                    fn();
                };
            }
        }
    }
var callBack_count = 0;   
var MAX_CALLBACK = 3;
function callBack_Helper() {
    callBack_count++;
    if (callBack_count == MAX_CALLBACK) {
        callBack();
    }
}    

gal_loadjscssfile("http://gallery.kokteyl.com/Rating.js","js");
gal_loadjscssfile("http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css", "css");
gal_loadjscssfile("http://yui.yahooapis.com/2.7.0/build/carousel/assets/skins/sam/carousel.css", "css");
gal_loadjscssfile("http://gallery.kokteyl.com/rating.css", "css");
var GAL_APP_ROOT = "http://gallery.kokteyl.com";

gal_loadjscssfile("http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js","js", callBack_Helper1);

function callBack_Helper1() {
    gal_loadjscssfile("http://yui.yahooapis.com/2.7.0/build/element/element-min.js","js", callBack_Helper2);
}    
function callBack_Helper2() {
    gal_loadjscssfile("http://yui.yahooapis.com/2.7.0/build/carousel/carousel-min.js","js", callBack_Helper);
    gal_loadjscssfile("http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js","js", callBack_Helper);
}    
gal_loadjscssfile("http://gallery.kokteyl.com/Rating.js","js", callBack_Helper);
document.write('<style type="text/css"> .rating ul { background: url(http://gallery.kokteyl.com/rating.gif) top left repeat-x; } .rating li.current-rating { background: url(http://gallery.kokteyl.com/rating.gif) left bottom; } .rating li a:hover { background: url(http://gallery.kokteyl.com/rating.gif) left center; } #container, #content-rating, #spotlight { width:450px !important;}</style>');
document.write('<div id="container" style="display:none"><ol id="carousel">');

    document.write('<li><img id="imgCnt_2888" src="http://gallery.kokteyl.com/Contents/photos/200911/01/07c39ffe13f842969454138d39049440_s.jpg" alt="Fenerbahçe" viewCount="13229" contentId="2888" rating="187" rateCount="47" /></li>');
    
    document.write('<li><img id="imgCnt_2887" src="http://gallery.kokteyl.com/Contents/photos/200911/01/e3426de1dd6a43cba489d2b1f792264a_s.jpg" alt="Fenerbahçe" viewCount="321" contentId="2887" rating="86" rateCount="20" /></li>');
    
    document.write('<li><img id="imgCnt_2886" src="http://gallery.kokteyl.com/Contents/photos/200911/01/3a13e38f6d5c4d959bebaf644c3f933a_s.jpg" alt="Kayserispor - Fenerbahçe" viewCount="323" contentId="2886" rating="39" rateCount="22" /></li>');
    
    document.write('<li><img id="imgCnt_2885" src="http://gallery.kokteyl.com/Contents/photos/200911/01/12a13952f496493ba7adb949e531253d_s.jpg" alt="Kayserispor - Fenerbahçe" viewCount="322" contentId="2885" rating="51" rateCount="26" /></li>');
    
    document.write('<li><img id="imgCnt_2884" src="http://gallery.kokteyl.com/Contents/photos/200911/01/cdfab0886a1a419fa900ba10d020981d_s.jpg" alt="Kayserispor - Fenerbahçe" viewCount="220" contentId="2884" rating="96" rateCount="20" /></li>');
    
    document.write('<li><img id="imgCnt_2883" src="http://gallery.kokteyl.com/Contents/photos/200911/01/ff6249d49c364684b8240049bc0f0063_s.jpg" alt="Kayserispor - Fenerbahçe" viewCount="228" contentId="2883" rating="145" rateCount="30" /></li>');
    
    document.write('<li><img id="imgCnt_2755" src="http://gallery.kokteyl.com/Contents/photos/200910/31/68a44b28da204f5bbef68a3fdea804d2_s.jpg" alt="Fenerbahçe Antrenman" viewCount="98229" contentId="2755" rating="3419" rateCount="842" /></li>');
    
    document.write('<li><img id="imgCnt_2754" src="http://gallery.kokteyl.com/Contents/photos/200910/31/ec1404c996bf4418bc990742db0245b7_s.jpg" alt="Fenerbahçe Antrenman" viewCount="3020" contentId="2754" rating="1795" rateCount="380" /></li>');
    
    document.write('<li><img id="imgCnt_2753" src="http://gallery.kokteyl.com/Contents/photos/200910/31/026af4b26d4e4f78990939e70a1246d6_s.jpg" alt="Fenerbahçe Antrenman" viewCount="3002" contentId="2753" rating="1057" rateCount="236" /></li>');
    
document.write('</ol></div>');
document.write('<div id="spotlight"></div>');

document.write('<div id="content-rating" style="display:none;margin:auto;">');
document.write('<div id="descriptionTxt"></div>');
document.write('<div id="dvGalleryText" style="display:none">Türkiye-Turkcell Süper Ligi</div>');

document.write('<div id="dvRating" class="rating" style="margin:auto;width:450px;background-color:#EEEEEE;">');
document.write('<table style="border-spacing: 0; border-collapse: collapse;" align=center>');
document.write('<tr><td><ul>');
document.write('<li id="current-rating" class="current-rating" style="width: 0px;"></li>');
document.write('<li><a href="#" onclick="this.blur();Gallery.rateContent(1); return false;" class="star-1">1</a></li>');
document.write('<li><a href="#" onclick="this.blur();Gallery.rateContent(2); return false;" class="star-2">2</a></li>');
document.write('<li><a href="#" onclick="this.blur();Gallery.rateContent(3); return false;" class="star-3">3</a></li>');
document.write('<li><a href="#" onclick="this.blur();Gallery.rateContent(4); return false;" class="star-4">4</a></li>');
document.write('<li><a href="#" onclick="this.blur();Gallery.rateContent(5); return false;" class="star-5">5</a></li>');
document.write('</ul></td>');
document.write('<td align="left"><span id="rating-count" class="rating-count"></span></td>');
document.write('<td><span id="view-count" class="rating-count"></span></td>');
document.write('</tr></table></div>');



document.write('<div style="clear:both"></div>');
document.write('</div>');

document.body.className = document.body.className + " yui-skin-sam";
function resizeImage(obj, width) {
    if (obj.width > width) {
        obj.width = width;
    }
    obj.style.visibility = "visible";
}
function callBack() {
    YAHOO.util.Event.onDOMReady(function(ev) {
        var spotlight = YAHOO.util.Dom.get("spotlight"),
            descriptionTxt = YAHOO.util.Dom.get("descriptionTxt");
            
        Gallery.Carousel = new YAHOO.widget.Carousel("container", { animation: { speed: 0.5}, revealAmount: 15, selectOnScroll:false, isCircular:true, numVisible: 4});
	Gallery.Carousel.STRINGS.PAGER_PREFIX_TEXT = "Sayfa";
        Gallery.Carousel.on("itemSelected", function(index) {
            // item has the reference to the Carousel's item
            var item = Gallery.Carousel.getElementForItem(index);

            if (item) {
                var imageElem = Gallery.getImageElement(item);
                var imageSrc = Gallery.getImageSrc(imageElem);
                var bigImgElem = document.createElement("img");
                spotlight.innerHTML = "<img src=\"" + imageSrc + "\" onclick=\"Gallery.Carousel.selectNextItem();\" style=\"cursor:pointer;visibility:hidden\" onload=\"resizeImage(this,450);\">";
                
                var altText = imageElem.getAttribute("alt");
                if (altText) {
                    descriptionTxt.innerHTML = "<div>" + altText + "</div>";
                } else {
                    descriptionTxt.innerHTML = document.getElementById("dvGalleryText").innerHTML;
                }
                

                var contentId = imageElem.getAttribute("contentId");

                Gallery.init(contentId);

                var contents = Gallery.getCookie("gal_content_view");
                var blExists = Gallery.checkExists(contents, contentId);
                
                
                var rating = imageElem.getAttribute("rating");
                var rateCount = imageElem.getAttribute("rateCount");
                var viewCount = imageElem.getAttribute("viewCount");

                document.getElementById("rating-count").innerHTML = rateCount == 0 ? " ilk oy veren sen ol!" : rateCount + " kişi oy vermiş.";
                document.getElementById("view-count").innerHTML = viewCount + " kişi fotoğrafı görmüş.";
                document.getElementById("current-rating").style.width = rateCount == 0 ? 0 : (parseInt(17 * rating / rateCount, 10)) + "px";
                

                if (!blExists) {
                    Gallery.viewContent(contentId);
                    contents = Gallery.addToCookie(contents, contentId);
                    Gallery.setCookie("gal_content_view", contents, null, "/", null, null);
                }
            }
        });
        Gallery.Carousel.render(); // get ready for rendering the widget
        Gallery.Carousel.show();   // display the widget

        document.getElementById("container").style.display='';
        document.getElementById("content-rating").style.display='';
    });
}

