﻿function ParseTestimonialXML(XmlFile) {
    var xmlDoc = null;
    var outPut;
    if (window.ActiveXObject) {// code for IE
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation.createDocument) {// code for Mozilla, Firefox, Opera, etc.
        xmlDoc = document.implementation.createDocument("", "", null);
    }
    else {
        alert('Your browser cannot handle this script');
    }
    if (xmlDoc != null) 
	{
       
		if(window.XMLHttpRequest)
		{
			var xmlhttp = new window.XMLHttpRequest();
			xmlhttp.open("GET", XmlFile, false);
			xmlhttp.send(null);
			xmlDoc = xmlhttp.responseXML.documentElement;
		}
		else
		{
			xmlDoc.async = false;
			xmlDoc.load(XmlFile);
		}
        var x = xmlDoc.getElementsByTagName("Testimonial");

        outPut = "";
        outPut = "<ul id='twoj_news_scroll_1' class='twoj_news_slide_ul'>";
        for (var i = 0; i < x.length; i++) {
            outPut += " <li class='twoj_li'> ";
            outPut += " <table class = 'contentpaneopen'>";
            outPut += " <tr>";
            outPut += " <td valign= 'top'>";
            outPut += " <p class='testimonial_line'>";
            outPut += x[i].getElementsByTagName("Statement")[0].childNodes[0].nodeValue;
            outPut += " <br/>";
            outPut += x[i].getElementsByTagName("Author")[0].childNodes[0].nodeValue;
            outPut += " <br/>";
            outPut += " <i> ";
            outPut += x[i].getElementsByTagName("Link")[0].childNodes[0].nodeValue;
            outPut += " </i>";
            outPut += " </p>";
            outPut += " </td>";
            outPut += " </tr>";
            outPut += " </table>";
            outPut += " </li>";
        }
        outPut += " </ul>";
        outPut += " <div id='twoj_news_scroll_1_menu' style='display: none;' class='twoj_news_slide_menu'></div>";

        document.getElementById("twoj_news_scroll_1_all").innerHTML = outPut;
 
        jq2j(document).ready(function() {
            jq2j("#twoj_news_scroll_1").wslide({
                width: 250, height: 250, duration: 1200, vertiz: 1, timer: 1, tdelay: 18000, col: 1, autolink: 'twoj_news_scroll_1_menu', show_pause: 0, text_pause: '', main_conten: 'ul', child_conten: 'li', scroll_id_all: 'twoj_news_scroll_1_all'
            });
        });
    }
}


function ParseNewsXML(XmlFile) {

    var xmlDoc = null;
    var outPut;
    if (window.ActiveXObject) {// code for IE
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation.createDocument) {// code for Mozilla, Firefox, Opera, etc.
        xmlDoc = document.implementation.createDocument("", "", null);
    }
    else {
        alert('Your browser cannot handle this script');
    }

    if (xmlDoc != null) 
    {
        
		if(window.XMLHttpRequest)
		{
			var xmlhttp = new window.XMLHttpRequest();
			xmlhttp.open("GET", XmlFile, false);
			xmlhttp.send(null);
			xmlDoc = xmlhttp.responseXML.documentElement;
		}
		else
		{
			xmlDoc.async = false;
			xmlDoc.load(XmlFile);
		}
        var x = xmlDoc.getElementsByTagName("News");

        outPut = "";
        outPut = "<ul id='twoj_news_scroll_2_ul' class='twoj_news_slide_ul'>";
        for (var i = 0; i < x.length; i++) {
            outPut += " <li class='twoj_li'> ";
            outPut += " <table class = 'contentpaneopen'>";
            outPut += " <tr>";
            outPut += " <td valign= 'top'>";
            outPut += " <p> ";
            outPut += x[i].getElementsByTagName("Description")[0].childNodes[0].nodeValue;
            outPut += " </p>";
            outPut += " </td>";
            outPut += " </tr>";
            outPut += " </table>";
            outPut += " </li>";
            //alert(outPut);
        }
        outPut += " </ul>";
        outPut += " <div id='twoj_news_scroll_all_menu' style='display: none;' class='twoj_news_slide_menu'></div>";

        document.getElementById("twoj_news_scroll_all").innerHTML = outPut;


        jq2j(document).ready(function() {
            jq2j("#twoj_news_scroll_2_ul").wslide({
                width: 250, height: 231, duration: 1200, horiz: 1, timer: 1, tdelay: 18000, col: 1, autolink: 'twoj_news_scroll_all_menu', show_pause: 1, text_pause: '', main_conten: 'ul', child_conten: 'li', scroll_id_all: 'twoj_news_scroll_all'
            });
        });
    }
}