
    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_138" src="http://gallery.kokteyl.com/Contents/photos/200909/01/383591a37a34484085ab6982d4177961_s.jpg" alt="" viewCount="9649" contentId="138" rating="646" rateCount="159" /></li>');
    
    document.write('<li><img id="imgCnt_137" src="http://gallery.kokteyl.com/Contents/photos/200909/01/6d08d47a08c24ccc8622c8d38e1adcb7_s.jpg" alt="" viewCount="462" contentId="137" rating="21" rateCount="8" /></li>');
    
    document.write('<li><img id="imgCnt_136" src="http://gallery.kokteyl.com/Contents/photos/200909/01/0e4f7041cd8a4fe9bdff990ac0fcaa00_s.jpg" alt="" viewCount="437" contentId="136" rating="38" rateCount="8" /></li>');
    
    document.write('<li><img id="imgCnt_135" src="http://gallery.kokteyl.com/Contents/photos/200909/01/17704eec27ed4ca1a4dbeb5440c27548_s.jpg" alt="" viewCount="416" contentId="135" rating="44" rateCount="9" /></li>');
    
    document.write('<li><img id="imgCnt_134" src="http://gallery.kokteyl.com/Contents/photos/200909/01/d86b70c658eb408c9323c73e91b38a92_s.jpg" alt="" viewCount="498" contentId="134" rating="70" rateCount="16" /></li>');
    
    document.write('<li><img id="imgCnt_133" src="http://gallery.kokteyl.com/Contents/photos/200909/01/c388608b97ae4e22826fdb2dd4c5fdc8_s.jpg" alt="" viewCount="306" contentId="133" rating="49" rateCount="11" /></li>');
    
    document.write('<li><img id="imgCnt_132" src="http://gallery.kokteyl.com/Contents/photos/200909/01/fc9826a9f446492a9e594131bf1e5674_s.jpg" alt="" viewCount="288" contentId="132" rating="109" rateCount="25" /></li>');
    
    document.write('<li><img id="imgCnt_131" src="http://gallery.kokteyl.com/Contents/photos/200909/01/e7d9a972e578479391303aa897d2ada5_s.jpg" alt="Abdulkader Keita" viewCount="255" contentId="131" rating="40" rateCount="11" /></li>');
    
    document.write('<li><img id="imgCnt_130" src="http://gallery.kokteyl.com/Contents/photos/200909/01/a0ccdb7d9d954afe81b6b78035a0bdd4_s.jpg" alt="" viewCount="366" contentId="130" rating="46" rateCount="10" /></li>');
    
    document.write('<li><img id="imgCnt_129" src="http://gallery.kokteyl.com/Contents/photos/200909/01/f1dae695d6844a3a82a44a4c8fe6a720_s.jpg" alt="Harry Kewell (Galatasaray)" viewCount="247" contentId="129" rating="125" rateCount="25" /></li>');
    
    document.write('<li><img id="imgCnt_128" src="http://gallery.kokteyl.com/Contents/photos/200909/01/80671ef3e748444b8e9c66649e937a0c_s.jpg" alt="" viewCount="288" contentId="128" rating="30" rateCount="7" /></li>');
    
    document.write('<li><img id="imgCnt_127" src="http://gallery.kokteyl.com/Contents/photos/200909/01/18561ac323944e51a11b4fc0c60969ca_s.jpg" alt="" viewCount="237" contentId="127" rating="25" rateCount="6" /></li>');
    
    document.write('<li><img id="imgCnt_126" src="http://gallery.kokteyl.com/Contents/photos/200909/01/9513ac80dce546c595a94dd4d28c38ad_s.jpg" alt="" viewCount="308" contentId="126" rating="108" rateCount="73" /></li>');
    
    document.write('<li><img id="imgCnt_125" src="http://gallery.kokteyl.com/Contents/photos/200909/01/f7184fb4dc1a4f49ad092bbb383ce38b_s.jpg" alt="" viewCount="191" contentId="125" rating="19" rateCount="4" /></li>');
    
    document.write('<li><img id="imgCnt_124" src="http://gallery.kokteyl.com/Contents/photos/200909/01/a25274f04d7b4b39b13b805bbd7d3e83_s.jpg" alt="" viewCount="196" contentId="124" rating="113" rateCount="98" /></li>');
    
    document.write('<li><img id="imgCnt_123" src="http://gallery.kokteyl.com/Contents/photos/200909/01/01628079a3294726955761264a35b37b_s.jpg" alt="" viewCount="250" contentId="123" rating="45" rateCount="12" /></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">Ankaraspor - Galatasaray</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='';
    });
}

