﻿var resultElement;
var videoElement;
var highlightTag;
var ajaxDebug = false;
var videoPlayer;

function Highlight(content) {
    var regex = new RegExp(">([^<]*)?(" + highlightTag + ")([^>]*)?<", "ig");
    return content.replace(regex, '>$1<span class="highlight">$2</span>$3<');
}

function HighlightResults() {
    if (highlightTag != '') {
        resultElement.innerHTML = Highlight(resultElement.innerHTML);
    }
}

function SwitchVideoPlayer() {
    switch (videoPlayer) {
        case 1:
            videoPlayer = 2
            break;
        case 2:
            videoPlayer = 1
            break;
        default:
            videoPlayer = 1
    }
    GetVideoPlayer('');
}

function GetVideoPlayer(Tag) {
//    if (Tag.toLowerCase() == 'fashion week') {
//        videoPlayer = 2
//    }
//    switch (videoPlayer) {
//        case 1:
//            videoElement.innerHTML = '<embed src="http://blip.tv/play/hPgiApj2XQ" type="application/x-shockwave-flash" width="610" height="370" allowscriptaccess="always" allowfullscreen="true"></embed>';
//            break;
//        case 2:
            videoElement.innerHTML = '<embed src="http://blip.tv/play/hPgijLdimPZd" type="application/x-shockwave-flash" width="650" height="400" allowscriptaccess="always" allowfullscreen="true"></embed>';
            //videoElement.innerHTML = '<embed src="http://blip.tv/play/hPgji%2Bggjtk0" type="application/x-shockwave-flash" width="610" height="370" allowscriptaccess="always" allowfullscreen="true"></embed>';
//            break;
//        default:
//            videoElement.innerHTML = '<embed src="http://blip.tv/play/hPgiApj2XQ" type="application/x-shockwave-flash" width="610" height="370" allowscriptaccess="always" allowfullscreen="true"></embed>';
//    }
}

