
    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_3507" src="http://gallery.kokteyl.com/Contents/photos/200911/08/29c0075d6acc405e92b247bec3c8c0ef_s.jpg" alt="Galatasaray Arda Turan" viewCount="16599" contentId="3507" rating="691" rateCount="139" /></li>');
    
    document.write('<li><img id="imgCnt_3506" src="http://gallery.kokteyl.com/Contents/photos/200911/08/1e4d435f747f4a84b7cfc7816088108d_s.jpg" alt="Galatasaray Frank Rijkaard" viewCount="461" contentId="3506" rating="100" rateCount="23" /></li>');
    
    document.write('<li><img id="imgCnt_3505" src="http://gallery.kokteyl.com/Contents/photos/200911/08/57317d7247514dbbab4ae82ceef6d9d7_s.jpg" alt="Galatasaray" viewCount="10549" contentId="3505" rating="982" rateCount="222" /></li>');
    
    document.write('<li><img id="imgCnt_3504" src="http://gallery.kokteyl.com/Contents/photos/200911/08/61afb03c7dfa4f28a78ef14d5a0e6395_s.jpg" alt="Galatasaray" viewCount="717" contentId="3504" rating="136" rateCount="28" /></li>');
    
    document.write('<li><img id="imgCnt_3503" src="http://gallery.kokteyl.com/Contents/photos/200911/08/f393cb129608407aabb33b81f3981277_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="607" contentId="3503" rating="102" rateCount="48" /></li>');
    
    document.write('<li><img id="imgCnt_3502" src="http://gallery.kokteyl.com/Contents/photos/200911/08/3054f00dd13d49dbac8c21c0ed319416_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="590" contentId="3502" rating="223" rateCount="47" /></li>');
    
    document.write('<li><img id="imgCnt_3501" src="http://gallery.kokteyl.com/Contents/photos/200911/08/622f2f6724954d258c242aae7199de79_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="567" contentId="3501" rating="275" rateCount="62" /></li>');
    
    document.write('<li><img id="imgCnt_3500" src="http://gallery.kokteyl.com/Contents/photos/200911/08/212c376ef19641ed961b306556424d31_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="570" contentId="3500" rating="157" rateCount="49" /></li>');
    
    document.write('<li><img id="imgCnt_3489" src="http://gallery.kokteyl.com/Contents/photos/200911/08/efb5657fa6534f389a2f2c3070db1979_s.jpg" alt="Diyarbakırspor " viewCount="32316" contentId="3489" rating="769" rateCount="170" /></li>');
    
    document.write('<li><img id="imgCnt_3488" src="http://gallery.kokteyl.com/Contents/photos/200911/08/3f6fd060a8684b3d8f50b8750e94e314_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="1679" contentId="3488" rating="217" rateCount="48" /></li>');
    
    document.write('<li><img id="imgCnt_3487" src="http://gallery.kokteyl.com/Contents/photos/200911/08/451297e690b848e68f86b3b870e723fa_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="1628" contentId="3487" rating="77" rateCount="20" /></li>');
    
    document.write('<li><img id="imgCnt_3486" src="http://gallery.kokteyl.com/Contents/photos/200911/08/461e9b20c34a4e50ab09ddc300bdaecf_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="1543" contentId="3486" rating="638" rateCount="132" /></li>');
    
    document.write('<li><img id="imgCnt_3485" src="http://gallery.kokteyl.com/Contents/photos/200911/08/fec596df9b074144a8b9a85b630e6008_s.jpg" alt="Diyarbakırspor - Galatasaray" viewCount="1235" contentId="3485" rating="379" rateCount="80" /></li>');
    
    document.write('<li><img id="imgCnt_3455" src="http://gallery.kokteyl.com/Contents/photos/200911/08/5e667b48ef1049d8ac83d2cc62ac153b_s.jpg" alt="Diyarbakırspor Antrenman" viewCount="67624" contentId="3455" rating="1219" rateCount="338" /></li>');
    
    document.write('<li><img id="imgCnt_3454" src="http://gallery.kokteyl.com/Contents/photos/200911/08/f8dea929dd0f4ce39ff136e5fd765ecf_s.jpg" alt="Galatasaray" viewCount="3344" contentId="3454" rating="1264" rateCount="310" /></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='';
    });
}

