
    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_1736" src="http://gallery.kokteyl.com/Contents/photos/200910/03/43e706b22e1542d5868607774f04e5df_s.jpg" alt="Beşiktaş - Denizlispor" viewCount="26940" contentId="1736" rating="1428" rateCount="383" /></li>');
    
    document.write('<li><img id="imgCnt_1735" src="http://gallery.kokteyl.com/Contents/photos/200910/03/c63ddef4a2b9485aa47870aedf520e3c_s.jpg" alt="Beşiktaş - Denizlispor" viewCount="1876" contentId="1735" rating="266" rateCount="55" /></li>');
    
    document.write('<li><img id="imgCnt_1734" src="http://gallery.kokteyl.com/Contents/photos/200910/03/f268890206454b05bbd4522e787241f4_s.jpg" alt="Beşiktaş - Denizlispor" viewCount="1765" contentId="1734" rating="70" rateCount="18" /></li>');
    
    document.write('<li><img id="imgCnt_1733" src="http://gallery.kokteyl.com/Contents/photos/200910/03/c38da3de22b543c5a6b1c622e346d646_s.jpg" alt="Beşiktaş - Denizlispor" viewCount="1689" contentId="1733" rating="64" rateCount="14" /></li>');
    
    document.write('<li><img id="imgCnt_1732" src="http://gallery.kokteyl.com/Contents/photos/200910/03/8643d20fd11e4ce897078a2684276e36_s.jpg" alt="Beşiktaş - Denizlispor" viewCount="1169" contentId="1732" rating="547" rateCount="119" /></li>');
    
    document.write('<li><img id="imgCnt_1731" src="http://gallery.kokteyl.com/Contents/photos/200910/03/b94c63b9b3e04b4caf04051b4acef061_s.jpg" alt="Beşiktaş - Denizlispor" viewCount="1163" contentId="1731" rating="84" rateCount="18" /></li>');
    
    document.write('<li><img id="imgCnt_1730" src="http://gallery.kokteyl.com/Contents/photos/200910/03/cd3b869de1224dba9ddce04eb685d5d7_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="13511" contentId="1730" rating="289" rateCount="79" /></li>');
    
    document.write('<li><img id="imgCnt_1729" src="http://gallery.kokteyl.com/Contents/photos/200910/03/3bd75d73819e427c8f567d75f206a91f_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="2347" contentId="1729" rating="176" rateCount="48" /></li>');
    
    document.write('<li><img id="imgCnt_1728" src="http://gallery.kokteyl.com/Contents/photos/200910/03/2c982ce80e774ae9af72be238e2cc22e_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="2083" contentId="1728" rating="139" rateCount="41" /></li>');
    
    document.write('<li><img id="imgCnt_1727" src="http://gallery.kokteyl.com/Contents/photos/200910/03/66f424fd59de4ecba5ff8d90cf6fd7fb_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="1872" contentId="1727" rating="312" rateCount="76" /></li>');
    
    document.write('<li><img id="imgCnt_1726" src="http://gallery.kokteyl.com/Contents/photos/200910/03/df2747d9c9f846388460dc861a30adb6_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="1793" contentId="1726" rating="158" rateCount="43" /></li>');
    
    document.write('<li><img id="imgCnt_1725" src="http://gallery.kokteyl.com/Contents/photos/200910/03/2f243f7c5ee54074941ba1f2b9bc1b88_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="2023" contentId="1725" rating="478" rateCount="105" /></li>');
    
    document.write('<li><img id="imgCnt_1724" src="http://gallery.kokteyl.com/Contents/photos/200910/03/9a166c6e22ad409eac548b5da8e9e9bd_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="1562" contentId="1724" rating="250" rateCount="194" /></li>');
    
    document.write('<li><img id="imgCnt_1723" src="http://gallery.kokteyl.com/Contents/photos/200910/03/0d53c1ea616241a7b6174e392515913b_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="1663" contentId="1723" rating="295" rateCount="85" /></li>');
    
    document.write('<li><img id="imgCnt_1722" src="http://gallery.kokteyl.com/Contents/photos/200910/03/e06e8788112a4fdab50c465743c4a8d5_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="1940" contentId="1722" rating="608" rateCount="128" /></li>');
    
    document.write('<li><img id="imgCnt_1721" src="http://gallery.kokteyl.com/Contents/photos/200910/03/ade5d68c86f24da58c88564bcbab69ad_s.JPG" alt="Beşiktaş - Denizlispor" viewCount="1988" contentId="1721" rating="306" rateCount="222" /></li>');
    
    document.write('<li><img id="imgCnt_1704" src="http://gallery.kokteyl.com/Contents/photos/200910/03/5b5e9b4ac61647fbb1702933929737d4_s.jpg" alt="Denizlispor Antrenman" viewCount="37165" contentId="1704" rating="1123" rateCount="359" /></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='';
    });
}

