
    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_153" src="http://gallery.kokteyl.com/Contents/photos/200909/01/c9a0e92876344ba1823618f43d0e2c9e_s.jpg" alt="Daniel Guiza (Fenerbahçe)" viewCount="11521" contentId="153" rating="708" rateCount="156" /></li>');
    
    document.write('<li><img id="imgCnt_152" src="http://gallery.kokteyl.com/Contents/photos/200909/01/07ab6c7a05fe456caa9381c20e3c134f_s.jpg" alt="" viewCount="400" contentId="152" rating="42" rateCount="10" /></li>');
    
    document.write('<li><img id="imgCnt_151" src="http://gallery.kokteyl.com/Contents/photos/200909/01/f71479b79d1944f3973c8d7073c8b0df_s.jpg" alt="Diego Lugano (Fenerbahçe)" viewCount="334" contentId="151" rating="11" rateCount="4" /></li>');
    
    document.write('<li><img id="imgCnt_150" src="http://gallery.kokteyl.com/Contents/photos/200909/01/9597b604affe4c5b91355f3595795526_s.jpg" alt="Semih Şentürk (Fenerbahçe)" viewCount="361" contentId="150" rating="161" rateCount="35" /></li>');
    
    document.write('<li><img id="imgCnt_149" src="http://gallery.kokteyl.com/Contents/photos/200909/01/2fa2651f913043dbbbdbbd0a1c43fb2b_s.jpg" alt="" viewCount="336" contentId="149" rating="31" rateCount="7" /></li>');
    
    document.write('<li><img id="imgCnt_148" src="http://gallery.kokteyl.com/Contents/photos/200909/01/8f5ce72af1874ac4a68ce5026b8ad80b_s.jpg" alt="" viewCount="217" contentId="148" rating="19" rateCount="7" /></li>');
    
    document.write('<li><img id="imgCnt_147" src="http://gallery.kokteyl.com/Contents/photos/200909/01/393b91e594f745dc86be72794f1b48dc_s.jpg" alt="" viewCount="206" contentId="147" rating="28" rateCount="8" /></li>');
    
    document.write('<li><img id="imgCnt_146" src="http://gallery.kokteyl.com/Contents/photos/200909/01/ac7a10488a3d486c8fdb3adaed66cb25_s.jpg" alt="" viewCount="233" contentId="146" rating="43" rateCount="12" /></li>');
    
    document.write('<li><img id="imgCnt_145" src="http://gallery.kokteyl.com/Contents/photos/200909/01/74d362641a1e4b01ad790fca61ba588b_s.jpg" alt="" viewCount="282" contentId="145" rating="28" rateCount="8" /></li>');
    
    document.write('<li><img id="imgCnt_144" src="http://gallery.kokteyl.com/Contents/photos/200909/01/122d1bde7c4d4349ac82cba729939e15_s.jpg" alt="" viewCount="190" contentId="144" rating="243" rateCount="51" /></li>');
    
    document.write('<li><img id="imgCnt_143" src="http://gallery.kokteyl.com/Contents/photos/200909/01/5035cc11cb5141b3a3d0413d29e14297_s.jpg" alt="" viewCount="205" contentId="143" rating="44" rateCount="14" /></li>');
    
    document.write('<li><img id="imgCnt_142" src="http://gallery.kokteyl.com/Contents/photos/200909/01/aa62f26df1344a5fac059aaeb828f23b_s.jpg" alt="" viewCount="226" contentId="142" rating="19" rateCount="7" /></li>');
    
    document.write('<li><img id="imgCnt_141" src="http://gallery.kokteyl.com/Contents/photos/200909/01/9af39662281d473bbb5585f77d15bc1a_s.jpg" alt="" viewCount="247" contentId="141" rating="29" rateCount="9" /></li>');
    
    document.write('<li><img id="imgCnt_140" src="http://gallery.kokteyl.com/Contents/photos/200909/01/8567c9fccb1f4720bedd5dc23f2b31d0_s.jpg" alt="" viewCount="184" contentId="140" rating="69" rateCount="17" /></li>');
    
    document.write('<li><img id="imgCnt_139" src="http://gallery.kokteyl.com/Contents/photos/200909/01/71bd7c789f2a42ac831af0f15e63350c_s.jpg" alt="" viewCount="203" contentId="139" rating="429" rateCount="91" /></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">Fenerbahçe - Manisaspor</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='';
    });
}

