function loadXPage(url)
{
    var req = false;
    // For Safari, Firefox, and other non-MS browsers
    if (window.XMLHttpRequest) {
        try {
             req = new XMLHttpRequest();
        } catch (e) {
            req = false;
        }
    } else if (window.ActiveXObject) {
        // For Internet Explorer on Windows
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                req = false;
            }
        }
    }
    if (req) {
        // Synchronous request, wait till we have it all
        req.open('GET', url, false);
        req.send(null);
	 return req.responseText;
    }
    return "";
}

function playVideo(id, height, width, title, time, location, url, url2,autoplay) {
    switch (location) {
        case "popup":
            var newurl = url + "/common/popup.php?name=" + title + "&id=" + id + "&w=" + width + "&h=" + height;
            window.open(newurl, "newwin", "width=" + width + ",height=" + height + ",toolbar=false,locationbar=false,directories=false,status=false,menubar=false,scrollbars=false,resizable=true,copyhistory=false");
            break;
        default:
            document.getElementById('tv_mainvideo').innerHTML = ' \
                    <div id="tv_inner"> \
                    <div id="tv_btitle"><a href="'+url2+'">' + decodeURIComponent(title) + '</a> \
                <object width="' + width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' + id + '&autoplay='+autoplay+'&color1=0x30327C&color2=0xC2C7CF"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + id + '&autoplay='+autoplay+'&&color1=0x30327C&color2=0xDDDDDD" type="application/x-shockwave-flash" wmode="transparent" width="' + width + '" height="' + height + '"></embed></object> \
                <br /><div id=tv_fullscreen> \
                <a alt="Kinagyitas" target=_blank onClick=\'resetVideo("' + id + '", "' + height + '", "' + width + '", "' + title + '", "' + time + '", "' + location + '", "' + url + '", "' + url2 + '");return true;\' href="'+url2+'?fullscreen=true&video_site=youtube">- kinagyitas -</a> \
                </div>&nbsp;<a href="'+url2+'">Reszletek</a></div> \
            ';
            //document.location.hash = '#tv_video';
alma = loadXPage(url2+"?thumb=true");
            break;
    }
}

function playVideo2(id, height, width, title, time, location, url, url2,autoplay) {
    switch (location) {
        case "popup":
            var newurl = url + "/common/popup.php?name=" + title + "&id=" + id + "&w=" + width + "&h=" + height;
            window.open(newurl, "newwin", "width=" + width + ",height=" + height + ",toolbar=false,locationbar=false,directories=false,status=false,menubar=false,scrollbars=false,resizable=true,copyhistory=false");
            break;
        default:
            document.getElementById('tv_mainvideo').innerHTML = ' \
                    <div id="tv_inner"> \
                    <div id="tv_btitle"><a href="'+url2+'">' + decodeURIComponent(title) + '</a> \
<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent" data="http://kukker.manna.ro/flvplayer.swf?file=http://kukker.manna.ro/flvideo/' + id + '.flv&autostart=true&showfsbutton=true"> <param name="movie" value="http://kukker.manna.ro/flvplayer.swf?file=http://kukker.manna.ro/flvideo/' + id + '.flv&autostart=true&showfsbutton=true" /> <param name="wmode" value="transparent" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="http://kukker.manna.ro/flvplayer.swf?file=http://kukker.manna.ro/flvideo/' + id + '.flv&autostart=true&showfsbutton=true" loop="False" width="' + width + '" height="' + height + '" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </embed> </object> \
                <br /><div id=tv_fullscreen> \
                <a alt="Kinagyitas" target=_blank onClick=\'resetVideo2("' + id + '", "' + height + '", "' + width + '", "' + title + '", "' + time + '", "' + location + '", "' + url + '", "' + url2 + '");return true;\' href="'+url2+'?fullscreen=true&video_site=manna">- kinagyitas -</a> \
                </div>&nbsp;<a href="'+url2+'">Reszletek</a></div> \
            ';
            //document.location.hash = '#tv_video';
alma = loadXPage(url2+"?thumb=true");
            break;
    }
}

function resetVideo(id, height, width, title, time, location, url, url2)
{
autoplay = 0;
            document.getElementById('tv_mainvideo').innerHTML = ' \
                    <div id="tv_inner"> \
                    <div id="tv_btitle"><a href="'+url2+'">' + decodeURIComponent(title) + '</a> \
<object width="' + width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' + id + '&autoplay='+autoplay+'&color1=0x30327C&color2=0xC2C7CF"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + id + '&autoplay='+autoplay+'&&color1=0x30327C&color2=0xDDDDDD" type="application/x-shockwave-flash" wmode="transparent" width="' + width + '" height="' + height + '"></embed></object> \
                                <br /><div id=tv_fullscreen> \
                <a alt="Kinagyitas" target=_blank onClick=\'resetVideo("' + id + '", "' + height + '", "' + width + '", "' + title + '", "' + time + '", "' + location + '", "' + url + '", "' + url2 + '");return true;\' href="'+url2+'?fullscreen=true&video_site=youtube">- kinagyitas -</a> \
                </div>&nbsp;<a href="'+url2+'">Reszletek</a></div> \
            ';
            //document.location.hash = '#tv_video';
}

function resetVideo2(id, height, width, title, time, location, url, url2)
{
autoplay = 0;
            document.getElementById('tv_mainvideo').innerHTML = ' \
                    <div id="tv_inner"> \
                    <div id="tv_btitle"><a href="'+url2+'">' + decodeURIComponent(title) + '</a> \
<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent" data="http://kukker.manna.ro/flvplayer.swf?file=http://kukker.manna.ro/flvideo/' + id + '.flv&autostart=true&showfsbutton=true"> <param name="movie" value="http://kukker.manna.ro/flvplayer.swf?file=http://kukker.manna.ro/flvideo/' + id + '.flv&autostart=true&showfsbutton=true" /> <param name="wmode" value="transparent" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="http://kukker.manna.ro/flvplayer.swf?file=http://kukker.manna.ro/flvideo/' + id + '.flv&autostart=true&showfsbutton=true" loop="False" width="' + width + '" height="' + height + '" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </embed> </object> \
                                <br /><div id=tv_fullscreen> \
                <a alt="Kinagyitas" target=_blank onClick=\'resetVideo2("' + id + '", "' + height + '", "' + width + '", "' + title + '", "' + time + '", "' + location + '", "' + url + '", "' + url2 + '");return true;\' href="'+url2+'?fullscreen=true&video_site=manna">- kinagyitas -</a> \
                </div>&nbsp;<a href="'+url2+'">Reszletek</a></div> \
            ';
            //document.location.hash = '#tv_video';
}
