﻿function get_video_html(id, domain) {
    switch (domain) {
        case "rutube.ru":
            return "<object width=\"400\" height=\"225\"><PARAM name=\"movie\" value=\"http://video.rutube.ru/"+id+"\"></PARAM><PARAM name=\"wmode\" value=\"window\"></PARAM><PARAM name=\"allowFullScreen\" value=\"true\"></PARAM><EMBED src=\"http://video.rutube.ru/"+id+"\" type=\"application/x-shockwave-flash\" wmode=\"window\" width=\"400\" height=\"225\" allowFullScreen=\"true\" ></EMBED></object>";
        case "youtube.com":
            return "<object style=\"height: 400px; width: 225px\"><param name=\"movie\" value=\"http://www.youtube.com/v/"+id+"?version=3\"><param name=\"allowFullScreen\" value=\"true\"><param name=\"allowScriptAccess\" value=\"always\"><embed src=\"http://www.youtube.com/v/"+id+"?version=3\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowScriptAccess=\"always\" width=\"400\" height=\"225\"></object>";
        case "smotri.com":
            return "<object id=\"smotriComVideoPlayerv4753428b41_1314868526.6271_8998\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"400\" height=\"225\"><param name=\"movie\" value=\"http://pics.smotri.com/player.swf?file="+id+"&bufferTime=3&autoStart=false&str_lang=rus&xmlsource=http%3A%2F%2Fpics.smotri.com%2Fcskins%2Fblue%2Fskin_color.xml&xmldatasource=http%3A%2F%2Fpics.smotri.com%2Fskin_ng.xml\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"http://pics.smotri.com/player.swf?file="+id+"&bufferTime=3&autoStart=false&str_lang=rus&xmlsource=http%3A%2F%2Fpics.smotri.com%2Fcskins%2Fblue%2Fskin_color.xml&xmldatasource=http%3A%2F%2Fpics.smotri.com%2Fskin_ng.xml\" quality=\"high\" allowscriptaccess=\"always\" allowfullscreen=\"true\" wmode=\"opaque\"  width=\"400\" height=\"225\" type=\"application/x-shockwave-flash\"></embed></object>";
        case "vimeo.com":
            return "<iframe src=\"http://player.vimeo.com/video/"+id+"?title=0&amp;byline=0&amp;portrait=0\" width=\"400\" height=\"225\" frameborder=\"0\"></iframe>";
        case "vision.rambler.ru":
            return "<object width=\"400\" height=\"225\" id=\"videoplayer17365738\" data=\"http://vision.rambler.ru/i/ev.swf?v=17&amp;id="+id+"&amp;where=video\" type=\"application/x-shockwave-flash\"><param value=\"http://vision.rambler.ru/i/ev.swf?v=17&amp;id="+id+"&amp;where=video\" name=\"movie\"></param><param value=\"always\" name=\"allowScriptAccess\"></param><param value=\"true\" name=\"allowFullScreen\"></param><embed src=\"http://vision.rambler.ru/i/ev.swf?v=17&amp;id="+id+"&amp;where=video\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"400\" height=\"225\"></embed></object>";            
    }
}

function bindVideoImgCode() {
     var temp;
     //<div class="video" ref="vimeo.com" id="14475432"></div>
     $("div.video").each(function (ind, obj) {
         $(obj).html(get_video_html($(obj).attr('id'), $(obj).attr('ref')));
     });
     //<div class="image" ref="http://static.ngs.ru/news/preview/480.jpg"></div>
     $("div.image").each(function (ind, obj) {
         temp = "<a href=\"" + $(obj).attr('ref') + "\" target=\"_blank\" onclick=\'javascript:var imgWnd; show_img(imgWnd, \"" + $(obj).attr('ref') + "\");return false;\' title=\"нажмите для просмотра в новом окне\"><img class=\"imgcont\" src=\"" + $(obj).attr('ref') + "\"/></a>";
         $(obj).before(temp);
         $(obj).remove();
     });
 }
