
    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_2879" src="http://gallery.kokteyl.com/Contents/photos/200911/01/9f391731605c4d76bedb87c15005fdeb_s.jpg" alt="Galatasaray " viewCount="36221" contentId="2879" rating="1291" rateCount="263" /></li>');
    
    document.write('<li><img id="imgCnt_2878" src="http://gallery.kokteyl.com/Contents/photos/200911/01/9a99a6f4082049aea538183d465dc56e_s.jpg" alt="Galatasaray " viewCount="1035" contentId="2878" rating="186" rateCount="42" /></li>');
    
    document.write('<li><img id="imgCnt_2877" src="http://gallery.kokteyl.com/Contents/photos/200911/01/20207874c7af4185aa2424c23709769c_s.jpg" alt="Galatasaray - Sivasspor" viewCount="1104" contentId="2877" rating="552" rateCount="112" /></li>');
    
    document.write('<li><img id="imgCnt_2876" src="http://gallery.kokteyl.com/Contents/photos/200911/01/d4410014a55e449db3642bd7b97f3aaa_s.jpg" alt="Galatasaray - Sivasspor" viewCount="1010" contentId="2876" rating="247" rateCount="63" /></li>');
    
    document.write('<li><img id="imgCnt_2875" src="http://gallery.kokteyl.com/Contents/photos/200911/01/f1aceb6fe90a4a759cda35e309616a8b_s.jpg" alt="Galatasaray - Sivasspor" viewCount="821" contentId="2875" rating="86" rateCount="18" /></li>');
    
    document.write('<li><img id="imgCnt_2874" src="http://gallery.kokteyl.com/Contents/photos/200911/01/a7cca21df2ed46dc84d03006389c8552_s.jpg" alt="Galatasaray - Sivasspor" viewCount="744" contentId="2874" rating="176" rateCount="37" /></li>');
    
    document.write('<li><img id="imgCnt_2873" src="http://gallery.kokteyl.com/Contents/photos/200911/01/61a8fc4fac0e4d1992e5eb5f1111bb58_s.jpg" alt="Galatasaray - Sivasspor" viewCount="776" contentId="2873" rating="75" rateCount="17" /></li>');
    
    document.write('<li><img id="imgCnt_2872" src="http://gallery.kokteyl.com/Contents/photos/200911/01/026bc65ce5014171a1c6a7e7558e6d56_s.jpg" alt="Galatasaray - Sivasspor" viewCount="760" contentId="2872" rating="46" rateCount="10" /></li>');
    
    document.write('<li><img id="imgCnt_2871" src="http://gallery.kokteyl.com/Contents/photos/200911/01/bb0708bcf27d43f99a54ffe71cbd3fbc_s.jpg" alt="Galatasaray - Sivasspor" viewCount="697" contentId="2871" rating="45" rateCount="12" /></li>');
    
    document.write('<li><img id="imgCnt_2870" src="http://gallery.kokteyl.com/Contents/photos/200911/01/ee871837850a4671b3569ac1c746a350_s.jpg" alt="Galatasaray - Sivasspor" viewCount="667" contentId="2870" rating="361" rateCount="75" /></li>');
    
    document.write('<li><img id="imgCnt_2758" src="http://gallery.kokteyl.com/Contents/photos/200910/31/1bbf2b188cb544349488ed9eac7f8b6f_s.jpg" alt="Galatasaray Antrenman" viewCount="62106" contentId="2758" rating="1353" rateCount="310" /></li>');
    
    document.write('<li><img id="imgCnt_2757" src="http://gallery.kokteyl.com/Contents/photos/200910/31/7da3ba6bfa7148d1a451cc6e2dcade21_s.jpg" alt="Galatasaray Antrenman" viewCount="1834" contentId="2757" rating="432" rateCount="111" /></li>');
    
    document.write('<li><img id="imgCnt_2756" src="http://gallery.kokteyl.com/Contents/photos/200910/31/f2ca08f0a968493f874bdd5c6a06c0f7_s.jpg" alt="Galatasaray Antrenman" viewCount="2004" contentId="2756" rating="1003" rateCount="243" /></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='';
    });
}

