
    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_991" src="http://gallery.kokteyl.com/Contents/photos/200909/21/6027d7909d7041fd8f6172d35ea55778_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="15407" contentId="991" rating="585" rateCount="152" /></li>');
    
    document.write('<li><img id="imgCnt_990" src="http://gallery.kokteyl.com/Contents/photos/200909/21/230adb6f41924b34a2980412ed89460b_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="860" contentId="990" rating="108" rateCount="25" /></li>');
    
    document.write('<li><img id="imgCnt_989" src="http://gallery.kokteyl.com/Contents/photos/200909/21/df6848495b594a7ba609e4320ebe3da6_s.jpg" alt="Fenerbahçe - Büyükşehir Bld. Alex" viewCount="847" contentId="989" rating="69" rateCount="17" /></li>');
    
    document.write('<li><img id="imgCnt_988" src="http://gallery.kokteyl.com/Contents/photos/200909/21/ad46db5444f44b6c90e1cabf18bb7437_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="828" contentId="988" rating="50" rateCount="12" /></li>');
    
    document.write('<li><img id="imgCnt_987" src="http://gallery.kokteyl.com/Contents/photos/200909/21/197dac3265ed4942a3f07036e13e3420_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="631" contentId="987" rating="402" rateCount="98" /></li>');
    
    document.write('<li><img id="imgCnt_986" src="http://gallery.kokteyl.com/Contents/photos/200909/21/4b0291eed5c6438ba22bdd4c94053532_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="642" contentId="986" rating="47" rateCount="11" /></li>');
    
    document.write('<li><img id="imgCnt_985" src="http://gallery.kokteyl.com/Contents/photos/200909/21/ad15f72653a54a01a2530eee93718ed4_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="652" contentId="985" rating="224" rateCount="52" /></li>');
    
    document.write('<li><img id="imgCnt_984" src="http://gallery.kokteyl.com/Contents/photos/200909/21/2b06ae3a72cc411087536bca7a318bc0_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="670" contentId="984" rating="66" rateCount="16" /></li>');
    
    document.write('<li><img id="imgCnt_983" src="http://gallery.kokteyl.com/Contents/photos/200909/20/9e2443c32c5d493b8c3f8e989796fa0d_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="2496" contentId="983" rating="126" rateCount="28" /></li>');
    
    document.write('<li><img id="imgCnt_973" src="http://gallery.kokteyl.com/Contents/photos/200909/20/dcdec39318614c0c944b5c488b0ba755_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="3002" contentId="973" rating="198" rateCount="42" /></li>');
    
    document.write('<li><img id="imgCnt_972" src="http://gallery.kokteyl.com/Contents/photos/200909/20/62e3406e924d4bc2b6e4e0c3193dc4c9_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="866" contentId="972" rating="135" rateCount="28" /></li>');
    
    document.write('<li><img id="imgCnt_971" src="http://gallery.kokteyl.com/Contents/photos/200909/20/d8255f3cea6b418794b17215a2c004d8_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="873" contentId="971" rating="46" rateCount="12" /></li>');
    
    document.write('<li><img id="imgCnt_970" src="http://gallery.kokteyl.com/Contents/photos/200909/20/0597df01bdb6470dba3d75c66120fd63_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="702" contentId="970" rating="92" rateCount="22" /></li>');
    
    document.write('<li><img id="imgCnt_969" src="http://gallery.kokteyl.com/Contents/photos/200909/20/de8f395c363c43fabf42395c41cbd764_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="617" contentId="969" rating="54" rateCount="16" /></li>');
    
    document.write('<li><img id="imgCnt_968" src="http://gallery.kokteyl.com/Contents/photos/200909/20/e8a8dae8be8046c8ac4d45d620047d7e_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="692" contentId="968" rating="64" rateCount="15" /></li>');
    
    document.write('<li><img id="imgCnt_967" src="http://gallery.kokteyl.com/Contents/photos/200909/20/ef7835be74614b0e8ca30392caf4e29e_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="688" contentId="967" rating="55" rateCount="13" /></li>');
    
    document.write('<li><img id="imgCnt_966" src="http://gallery.kokteyl.com/Contents/photos/200909/20/8236e97f69214d83a3ddb892bbdf23e9_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="554" contentId="966" rating="44" rateCount="13" /></li>');
    
    document.write('<li><img id="imgCnt_965" src="http://gallery.kokteyl.com/Contents/photos/200909/20/aaff60a543c1434eb77c1d52fbfd5553_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="565" contentId="965" rating="187" rateCount="39" /></li>');
    
    document.write('<li><img id="imgCnt_964" src="http://gallery.kokteyl.com/Contents/photos/200909/20/4f2f6f7026884a5c973099b2adf6d16d_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="569" contentId="964" rating="150" rateCount="119" /></li>');
    
    document.write('<li><img id="imgCnt_963" src="http://gallery.kokteyl.com/Contents/photos/200909/20/9a2905b1d37941669c7cfd5b11e6337a_s.jpg" alt="Fenerbahçe - Büyükşehir Bld." viewCount="642" contentId="963" rating="57" rateCount="13" /></li>');
    
    document.write('<li><img id="imgCnt_951" src="http://gallery.kokteyl.com/Contents/photos/200909/20/7c36072e65cc4720b5c16878678bc0ab_s.jpg" alt="Fenerbahçe Carlos, Kazım, Lugano" viewCount="45280" contentId="951" rating="4408" rateCount="1125" /></li>');
    
    document.write('<li><img id="imgCnt_950" src="http://gallery.kokteyl.com/Contents/photos/200909/20/0cbef7c037d043bf8f50981af79710c2_s.jpg" alt="Fenerbahçe Antrenman " viewCount="4519" contentId="950" rating="1158" rateCount="373" /></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='';
    });
}

