
    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_6031" src="http://gallery.kokteyl.com/Contents/photos/201002/07/9cef6a05158b4532a20dbdbacdab2790_s.jpg" alt="Andre Santos" viewCount="21418" contentId="6031" rating="927" rateCount="216" /></li>');
    
    document.write('<li><img id="imgCnt_6030" src="http://gallery.kokteyl.com/Contents/photos/201002/07/5338059a6f0645e594c617a25d672095_s.jpg" alt="" viewCount="563" contentId="6030" rating="305" rateCount="93" /></li>');
    
    document.write('<li><img id="imgCnt_6029" src="http://gallery.kokteyl.com/Contents/photos/201002/07/a7606e299503402cbd8e03abde411ffd_s.jpg" alt="" viewCount="529" contentId="6029" rating="151" rateCount="31" /></li>');
    
    document.write('<li><img id="imgCnt_6028" src="http://gallery.kokteyl.com/Contents/photos/201002/07/bcdc48abb179458aa355320cdab28bf7_s.jpg" alt="Özer Hurmacı" viewCount="544" contentId="6028" rating="129" rateCount="28" /></li>');
    
    document.write('<li><img id="imgCnt_6027" src="http://gallery.kokteyl.com/Contents/photos/201002/07/71122ddab0154d8fa772a6bdabc991a2_s.jpg" alt="Fenerbahçe " viewCount="1520" contentId="6027" rating="78" rateCount="17" /></li>');
    
    document.write('<li><img id="imgCnt_6026" src="http://gallery.kokteyl.com/Contents/photos/201002/07/a0e39b5b38eb47f0b190591d0885b900_s.jpg" alt="Fenerbahçe " viewCount="417" contentId="6026" rating="100" rateCount="20" /></li>');
    
    document.write('<li><img id="imgCnt_6025" src="http://gallery.kokteyl.com/Contents/photos/201002/07/465981eb25b148cc87686503958ce5c8_s.jpg" alt="Diyarbakırspor " viewCount="950" contentId="6025" rating="1061" rateCount="265" /></li>');
    
    document.write('<li><img id="imgCnt_6024" src="http://gallery.kokteyl.com/Contents/photos/201002/07/111c4abd9e4342ed98253de898cc5c53_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="464" contentId="6024" rating="116" rateCount="24" /></li>');
    
    document.write('<li><img id="imgCnt_6023" src="http://gallery.kokteyl.com/Contents/photos/201002/07/27ce86d417024ebab1a0c71c0e18ffb7_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="435" contentId="6023" rating="62" rateCount="36" /></li>');
    
    document.write('<li><img id="imgCnt_6022" src="http://gallery.kokteyl.com/Contents/photos/201002/07/aa418dec63a84a6db1e7cb3778413178_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="350" contentId="6022" rating="16" rateCount="4" /></li>');
    
    document.write('<li><img id="imgCnt_6021" src="http://gallery.kokteyl.com/Contents/photos/201002/07/45cff6929fcc4ff7825ff859cba42693_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="372" contentId="6021" rating="11" rateCount="3" /></li>');
    
    document.write('<li><img id="imgCnt_6020" src="http://gallery.kokteyl.com/Contents/photos/201002/07/4941a8f8876d456f8fc509fea8ab3aa6_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="360" contentId="6020" rating="52" rateCount="22" /></li>');
    
    document.write('<li><img id="imgCnt_6019" src="http://gallery.kokteyl.com/Contents/photos/201002/07/0bed6b56f7154b06bc4e765242002452_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="360" contentId="6019" rating="30" rateCount="6" /></li>');
    
    document.write('<li><img id="imgCnt_6018" src="http://gallery.kokteyl.com/Contents/photos/201002/07/01447a1deafe458887c4ff84337ea349_s.jpg" alt="Fenerbahçe - Diyarbakırspor" viewCount="35691" contentId="6018" rating="70" rateCount="15" /></li>');
    
    document.write('<li><img id="imgCnt_6017" src="http://gallery.kokteyl.com/Contents/photos/201002/07/6a7a2138209645e7a8b3be466ac3a9f2_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="7821" contentId="6017" rating="66" rateCount="16" /></li>');
    
    document.write('<li><img id="imgCnt_6016" src="http://gallery.kokteyl.com/Contents/photos/201002/07/4042eabdbd1643baa68ead9f4f0f919b_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="2177" contentId="6016" rating="307" rateCount="63" /></li>');
    
    document.write('<li><img id="imgCnt_6015" src="http://gallery.kokteyl.com/Contents/photos/201002/07/656240826b15476eb03a11d4f394ebf5_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="1914" contentId="6015" rating="31" rateCount="7" /></li>');
    
    document.write('<li><img id="imgCnt_6014" src="http://gallery.kokteyl.com/Contents/photos/201002/07/debdbf61360548fe970c0a5e16101a58_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="1293" contentId="6014" rating="57" rateCount="23" /></li>');
    
    document.write('<li><img id="imgCnt_6013" src="http://gallery.kokteyl.com/Contents/photos/201002/07/a81a133e7c4747b4aa826af383853556_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="1373" contentId="6013" rating="38" rateCount="10" /></li>');
    
    document.write('<li><img id="imgCnt_6012" src="http://gallery.kokteyl.com/Contents/photos/201002/07/fbb14ea24fc346858c1877835b5dd9a1_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="3874" contentId="6012" rating="53" rateCount="17" /></li>');
    
    document.write('<li><img id="imgCnt_6011" src="http://gallery.kokteyl.com/Contents/photos/201002/07/fcd1676957ab4b81943f7353fd520be4_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="1435" contentId="6011" rating="144" rateCount="40" /></li>');
    
    document.write('<li><img id="imgCnt_6010" src="http://gallery.kokteyl.com/Contents/photos/201002/07/725612ccbe8a4bcd9427d3c1d0d5b8dc_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="1370" contentId="6010" rating="80" rateCount="49" /></li>');
    
    document.write('<li><img id="imgCnt_6009" src="http://gallery.kokteyl.com/Contents/photos/201002/07/9037bbfa19734ffca1fb63ad9a0dc613_s.jpg" alt="Fenerbahçe - Diyarbakırspor " viewCount="1160" contentId="6009" rating="213" rateCount="58" /></li>');
    
    document.write('<li><img id="imgCnt_5963" src="http://gallery.kokteyl.com/Contents/photos/201002/06/5349bacc6b3040ac9a943770b8319f96_s.jpg" alt="Fenerbahçe Antrenman" viewCount="49967" contentId="5963" rating="4780" rateCount="1002" /></li>');
    
    document.write('<li><img id="imgCnt_5962" src="http://gallery.kokteyl.com/Contents/photos/201002/06/6e8f719e1da5471baefe10192b0ba0bf_s.jpg" alt="Fenerbahçe Antrenman" viewCount="2605" contentId="5962" rating="1254" rateCount="366" /></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='';
    });
}

