﻿ var Counter = 0;

 $(document).ready(function() 
 {
 		
	 	var soapEnvLoadQLinks =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>QuickLinks</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Title' /> \
                               <FieldRef Name='DisplayText' /> \
                               <FieldRef Name='URL' /> \
                               <FieldRef Name='Visibility' /> \
                               <FieldRef Name='ReviewStatus' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnvLoadQLinks,
            complete: processQLinks,            
            contentType: "text/xml; charset=\"utf-8\""           
        });


	 	var soapEnvLoadGateways =
            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>Gateways</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Title' /> \
                               <FieldRef Name='DisplayText' /> \
                               <FieldRef Name='URL' /> \
                               <FieldRef Name='Visibility' /> \
                               <FieldRef Name='ReviewStatus' /> \
                           </ViewFields> \
                        </viewFields> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

        $.ajax({
            url: "/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnvLoadGateways,
            complete: processGateways,
            contentType: "text/xml; charset=\"utf-8\""
        });  

 		var soapEnvLoadEvents =
	            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
	                <soapenv:Body> \
						<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
						 <listName>MICCalendar</listName> \
	                        <viewFields> \
	                            <ViewFields> \
	                               <FieldRef Name='Title' /> \
								   <FieldRef Name='EventDate' /> \
	                               <FieldRef Name='EndDate' /> \
	                               <FieldRef Name='Description' /> \
	                               <FieldRef Name='ImageURL' /> \
	                               <FieldRef Name='EventDescription' /> \
	                               <FieldRef Name='ReviewStatus' /> \
	                               <FieldRef Name='fRecurrence' /> \
	                               <FieldRef Name='fAllDayEvent' /> \
	                           </ViewFields> \
							</viewFields> \
								<query> \
								<Query> \
									<Where> \
										<Eq> \
											<FieldRef Name='ReviewStatus' /> \
												<Value Type='Text'>Completed</Value> \
										</Eq> \
									</Where> \
	                           		<OrderBy> \
	                           			<fieldRef Name='EventDate' Ascending='False' /> \
	                           		</OrderBy> \
	                           </Query> \
	                        </query> \
	                    </GetListItems> \
	                </soapenv:Body> \
	            </soapenv:Envelope>";
	
	        $.ajax({
	            url: "/_vti_bin/lists.asmx",
	            type: "POST",
	            dataType: "xml",
	            data: soapEnvLoadEvents ,
	            complete: processLoadEvents,
	            contentType: "text/xml; charset=\"utf-8\""
	        });
	        

 		/*Click Event for Slider Navigation starts here */
        $("#test").click(function()
        {
        	var soapEnv1 =
		            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
		                <soapenv:Body> \
		                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
		                        <listName>SubMenuColumn1</listName> \
		                        <viewFields> \
		                            <ViewFields> \
		                               <FieldRef Name='Title' /> \
		                               <FieldRef Name='HyperLink' /> \
		                           </ViewFields> \
		                        </viewFields> \
		                    </GetListItems> \
		                </soapenv:Body> \
		            </soapenv:Envelope>";
		
		        $.ajax({
		            url: "/_vti_bin/lists.asmx",
		            type: "POST",
		            dataType: "xml",
		            data: soapEnv1,
		            complete: processResult1,
		            contentType: "text/xml; charset=\"utf-8\""
		        });
        
        
        var soapEnv2 =
		            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
		                <soapenv:Body> \
		                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
		                        <listName>SubMenuColumn2</listName> \
		                        <viewFields> \
		                            <ViewFields> \
		                               <FieldRef Name='Title' /> \
		                               <FieldRef Name='HyperLink' /> \
		                           </ViewFields> \
		                        </viewFields> \
		                    </GetListItems> \
		                </soapenv:Body> \
		            </soapenv:Envelope>";
		
		        $.ajax({
		            url: "/_vti_bin/lists.asmx",
		            type: "POST",
		            dataType: "xml",
		            data: soapEnv2,
		            complete: processResult2,
		            contentType: "text/xml; charset=\"utf-8\""
		        });


		var soapEnv3 =
		            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
		                <soapenv:Body> \
		                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
		                        <listName>SubMenuColumn3</listName> \
		                        <viewFields> \
		                            <ViewFields> \
		                               <FieldRef Name='Title' /> \
		                               <FieldRef Name='HyperLink' /> \
		                           </ViewFields> \
		                        </viewFields> \
		                    </GetListItems> \
		                </soapenv:Body> \
		            </soapenv:Envelope>";
		
		        $.ajax({
		            url: "/_vti_bin/lists.asmx",
		            type: "POST",
		            dataType: "xml",
		            data: soapEnv3,
		            complete: processResult3,
		            contentType: "text/xml; charset=\"utf-8\""
		        });
		        
		var soapEnv4 =
		            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
		                <soapenv:Body> \
		                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
		                        <listName>SubMenuColumn4</listName> \
		                        <viewFields> \
		                            <ViewFields> \
		                               <FieldRef Name='Title' /> \
		                               <FieldRef Name='HyperLink' /> \
		                           </ViewFields> \
		                        </viewFields> \
		                    </GetListItems> \
		                </soapenv:Body> \
		            </soapenv:Envelope>";
		
		        $.ajax({
		            url: "/_vti_bin/lists.asmx",
		            type: "POST",
		            dataType: "xml",
		            data: soapEnv4,
		            complete: processResult4,
		            contentType: "text/xml; charset=\"utf-8\""
		        });
		        
		var soapEnv5 =
		            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
		                <soapenv:Body> \
		                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
		                        <listName>SubMenuColumn5</listName> \
		                        <viewFields> \
		                            <ViewFields> \
		                               <FieldRef Name='Title' /> \
		                               <FieldRef Name='HyperLink' /> \
		                           </ViewFields> \
		                        </viewFields> \
		                    </GetListItems> \
		                </soapenv:Body> \
		            </soapenv:Envelope>";
		
		        $.ajax({
		            url: "/_vti_bin/lists.asmx",
		            type: "POST",
		            dataType: "xml",
		            data: soapEnv5,
		            complete: processResult5,
		            contentType: "text/xml; charset=\"utf-8\""
		        });

		var soapEnv6 =
		            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
		                <soapenv:Body> \
		                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
		                        <listName>SubMenuColumn6</listName> \
		                        <viewFields> \
		                            <ViewFields> \
		                               <FieldRef Name='Title' /> \
		                               <FieldRef Name='HyperLink' /> \
		                           </ViewFields> \
		                        </viewFields> \
		                    </GetListItems> \
		                </soapenv:Body> \
		            </soapenv:Envelope>";
		
		        $.ajax({
		            url: "/_vti_bin/lists.asmx",
		            type: "POST",
		            dataType: "xml",
		            data: soapEnv6,
		            complete: processResult6,
		            contentType: "text/xml; charset=\"utf-8\""
		        });
		        

        });
        
        /*Click Event for Slider Navigation starts here */
        
        /*Fetch Testimonial items from List Starts here */
        var soapEnvTesttimonial =
	            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
	                <soapenv:Body> \
	                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
	                        <listName>Testimonial</listName> \
	                        <viewFields> \
	                            <ViewFields> \
	                               <FieldRef Name='Title' /> \
	                               <FieldRef Name='Nameofperson' /> \
	                               <FieldRef Name='Designation' /> \
	                               <FieldRef Name='Description' /> \
	                               <FieldRef Name='URL' /> \
	                               <FieldRef Name='ImageURL' /> \
	                               <FieldRef Name='Visibility' /> \
	                               <FieldRef Name='ReviewStatus' /> \
	                           </ViewFields> \
	                       </viewFields> \
	                    </GetListItems> \
	                </soapenv:Body> \
	            </soapenv:Envelope>";
	
	        $.ajax({
	            url: "/_vti_bin/lists.asmx",
	            type: "POST",
	            dataType: "xml",
	            data: soapEnvTesttimonial,
	            complete: processResultTestimonial,
	            contentType: "text/xml; charset=\"utf-8\""
	        });
        /*Fetch Testimonial items from List Ends here */

       /*Fetch News  items from List Starts here */
        	var soapEnvNews =
        		"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
	               	<soapenv:Body> \
	                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
	                        <listName>News</listName> \
	                        <viewFields> \
								<ViewFields> \
	                               <FieldRef Name='Title' /> \
	                               <FieldRef Name='DateOfNews' /> \
	                               <FieldRef Name='News' /> \
	                               <FieldRef Name='ImageURL' /> \
								   <FieldRef Name='URL' /> \
	                               <FieldRef Name='Visibility' /> \
	                               <FieldRef Name='ReviewStatus' /> \
	                               <FieldRef Name='ElaboratedNews' /> \
	                         </ViewFields> \
							</viewFields> \
							<query> \
	                            <Query> \
	                           		<OrderBy> \
	                           			<fieldRef Name='DateOfNews' Ascending='True' /> \
	                           		</OrderBy> \
	                            </Query> \
	                       </query> \
	                    </GetListItems> \
	                </soapenv:Body> \
	            </soapenv:Envelope>";
	
	        $.ajax({
	            url: "/_vti_bin/lists.asmx",
	            type: "POST",
	            dataType: "xml",
	            data: soapEnvNews ,
	            complete: processResultNews,
	            contentType: "text/xml; charset=\"utf-8\""
	        });  
	        
        /*Fetch News items from List Ends here */
        
        /*Fetch News  items from List Starts here */
        	var soapEnvHeaderRotator =
	            "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
	                <soapenv:Body> \
	                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
	                        <listName>HeaderImages</listName> \
	                        <viewFields> \
	                            <ViewFields> \
	                               <FieldRef Name='Title' /> \
	                               <FieldRef Name='NameofthePicture' /> \
	                           </ViewFields> \
	                        </viewFields> \
	                    </GetListItems> \
	                </soapenv:Body> \
	            </soapenv:Envelope>";
	
	        $.ajax({
	            url: "/_vti_bin/lists.asmx",
	            type: "POST",
	            dataType: "xml",
	            data: soapEnvHeaderRotator,
	            complete: processResultImages,
	            contentType: "text/xml; charset=\"utf-8\""
	        });  
	        
        /*Fetch News items from List Ends here */

    });


	/* Process News Results Starts Here */
	 function processResultNews(xData, status) {
     $("#News").html("");
     
     	var tmpPathName = window.location.pathname;
		var isRootPage = false;
		if (tmpPathName.toLowerCase().indexOf('default.aspx') >=0)
		{
			isRootPage = true;			
		}
		else if(tmpPathName.toLowerCase().indexOf('irish.aspx') >=0)
		{
			isRootPage = true;
		}

	var newsItemCounter=0;
	var MultiArray = new Array($(xData.responseXML).find("rs\\:data").attr("ItemCount"));
	var tmpStrStart;
	var tmpDtStart;

	var browserName=navigator.appName; 
	if (browserName=="Microsoft Internet Explorer")
 	{
 
  		$(xData.responseXML).find("z\\:row").each(function() {

				if($(this).attr("ows_ReviewStatus")== "Completed")
				{
					//if(isRootPage)
					//{
						newsItemCounter = newsItemCounter+1
					//}
					var iHtml = "<table border='0px' CellPadding='0' CellSpacing='0' width='100%'><tr>"				
						iHtml += "<td width='30%' valign='top'><img src='" + $(this).attr("ows_ImageURL") + "'/>" + "</td>"
						iHtml += "<td width='7px'>&nbsp;&nbsp;</td>"
						iHtml += "<td width='69%' valign='middle'><table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
						iHtml += "<tr><td style='font-family : Verdana; font-size : 14px; font-style :normal;font-weight : bold;Color : #505676;'>" +  $(this).attr("ows_News")  + "</td></tr>"
						iHtml += "<tr><td style='font-family : Verdana; font-size : 11px; font-style :normal;font-weight : normal;Color : #505676'>" +  $(this).attr("ows_ElaboratedNews")  + "</td></tr>"
						iHtml += "<tr><td>" + "<a href=" + $(this).attr("ows_URL")  + ">" + "<font color='#F58C4B'>" + "Read More..." + " </a>" + "</Span>" + "</td></tr>"
						iHtml += "</table></td></tr>"
						iHtml += "<tr height='7px'><td></td></tr>"
						iHtml += "</table>"
					//$("#News").append(iHtml);									
					MultiArray[newsItemCounter] = new Array(2);
					tmpStrStart = String($(this).attr("ows_DateOfNews")).split("/")
					tmpDtStart = new Date(tmpStrStart[2],tmpStrStart[1],tmpStrStart[0]);
					MultiArray[newsItemCounter][0] = tmpDtStart.getTime();
					MultiArray[newsItemCounter][1] = iHtml;
				}
        });
 	}
 	else
 	{
 		$(xData.responseText).find("z\\:row").each(function() {

				if($(this).attr("ows_ReviewStatus")== "Completed")
				{
					//if(isRootPage)
					//{
						newsItemCounter = newsItemCounter+1
					//}

					var iHtml = "<table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
						iHtml += "<td width='30%' valign='top'><img src='" + $(this).attr("ows_ImageURL") + "'/>" + "</td>"
						iHtml += "<td width='7px'>&nbsp;&nbsp;</td>"
						iHtml += "<td width='69%' valign='middle'><table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
						iHtml += "<tr><td style='font-family : Verdana; font-size : 14px; font-style :normal;font-weight : bold;Color : #505676;'>" +  $(this).attr("ows_News")  + "</td></tr>"
						iHtml += "<tr><td style='font-family : Verdana; font-size : 11px; font-style :normal;font-weight : normal;Color : #505676'>" +  $(this).attr("ows_ElaboratedNews")  + "</td></tr>"
						iHtml += "<tr><td>" + "<a href=" + $(this).attr("ows_URL")  + ">" + "<font color='#F58C4B'>" + "Read More..." + " </a>" + "</Span>" + "</td></tr>"
						iHtml += "</table></td></tr>"
						iHtml += "<tr height='7px'><td></td></tr>"
						iHtml += "</table>"
	
					//$("#News").append(iHtml);									
					MultiArray[newsItemCounter] = new Array(2);
					tmpStrStart = String($(this).attr("ows_DateOfNews")).split("/")
					tmpDtStart = new Date(tmpStrStart[2],tmpStrStart[1],tmpStrStart[0]);
					MultiArray[newsItemCounter][0] = tmpDtStart.getTime();
					MultiArray[newsItemCounter][1] = iHtml;

				}	

        });

 	}
 
    MultiArray.sort(byint(0,-1));
	var row;
     for (row = 0; row < MultiArray.length; ++ row)
     {
        if(MultiArray[row] === undefined)
        {
        }
        else{
            if((isRootPage)&& row>2)
     		{
     			break;
     		}

     		$("#News").append(MultiArray[row][1]);
     	}
     }
     
        	            
    }
 function byint(i,dir) {
return function(a,b){a = a[i];b = b[i];return a == b ? 0 : (a < b ? -1*dir : dir)}
}
   
   	/* Process News Results Ends Here */

		/* Testimonial Slideshow Functions */
		
		function slideSwitchTestimonial() {
	    var $active = $('#slideshow2 DIV.active');
	
	    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
	
	    // use this to pull the divs in the order they appear in the markup
	    var $next =  $active.next().length ? $active.next()
	        : $('#slideshow2 DIV:first');

	    $active.addClass('last-active');
	
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate({opacity: 1.0}, 1000, function() {
	            $active.removeClass('active last-active');
	        });
		}
	
		$(function() {
		    setInterval( "slideSwitchTestimonial()", 5000 );
		});

		function slideShow() {

				//Set the opacity of all images to 0
				$('#gallery a').css({opacity: 0.0});
				
				//Get the first image and display it (set it to full opacity)
				$('#gallery a:first').css({opacity: 1.0});
				
				//Set the caption background to semi-transparent
				$('#gallery .caption').css({});
			
				//Resize the width of the caption according to the image width
				$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
				
				//Get the caption of the first image from REL attribute and display it
				$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
				.animate({opacity: 100}, 400);
				
				//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
				setInterval('gallery()',6000);

		}
		
		function gallery() {
				//if no IMGs have the show class, grab the first image
				var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));
			
				//Get next image, if it reached the end of the slideshow, rotate it back to the first image
				var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
				
				//Get next image caption
				var caption = next.find('img').attr('rel');	
				
				//Set the fade in effect for the next image, show class has higher z-index
				next.css({opacity: 0.0})
				.addClass('show')
				.animate({opacity: 1.0}, 1000);
			
				//Hide the current image
				current.animate({opacity: 0.0}, 1000)
				.removeClass('show');
				
				//Set the opacity to 0 and height to 1px
				$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:50 }).animate({height: '1px'}, { queue:true, duration:300 });	
				
				//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
				$('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '100px'},500 );
				
				//Display the content
				$('#gallery .content').html(caption);
	
			
		}
		
	/* Testimonial Slideshow Functions Ends Here*/

	
	/* Slider Menu Functions */
	
    function processResult1(xData, status) {
     $("#nav_inner1").html("");

	var browserName=navigator.appName; 
	if (browserName=="Microsoft Internet Explorer")
 	{
 	$(xData.responseXML).find("z\\:row").each(function() {
        
            var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            $("#nav_inner1").append(liHtml);
        });
 	}
 	else
 	{
 		$(xData.responseText).find("z\\:row").each(function() {
        
            var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            $("#nav_inner1").append(liHtml);
        });
 	
 	}
    }
    
    function processResult2(xData, status) {
     $("#nav_inner2").html("");
		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
 		{

        	$(xData.responseXML).find("z\\:row").each(function() {
           	 var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
           	 $("#nav_inner2").append(liHtml);
        	});
        }
        else
        {
        	$(xData.responseText).find("z\\:row").each(function() {
           	 var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
           	 $("#nav_inner2").append(liHtml);
        	});

        }
    }

    function processResult3(xData, status) {
     $("#nav_inner3").html("");
		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
 		{
	        $(xData.responseXML).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
           	 	$("#nav_inner3").append(liHtml);
        	});
        }
        else
        {
        	$(xData.responseText).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
           	 	$("#nav_inner3").append(liHtml);
        	});
        }
    }

    function processResult4(xData, status) {
     $("#nav_inner4").html("");
		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
 		{
        	$(xData.responseXML).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            	$("#nav_inner4").append(liHtml);
        	});
        }
        else
        {
        	$(xData.responseText).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            	$("#nav_inner4").append(liHtml);
        	});
        }
    }

    function processResult5(xData, status) {
     $("#nav_inner5").html("");
		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
 		{
        	$(xData.responseXML).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            	$("#nav_inner5").append(liHtml);
        	});
        }
        else
        {
        	$(xData.responseText).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            	$("#nav_inner5").append(liHtml);
        	});

        }
    }
    
    function processResult6(xData, status) {
     $("#nav_inner6").html("");
		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
 		{
        	$(xData.responseXML).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            	$("#nav_inner6").append(liHtml);
        	});
        }
        else
        {
        	$(xData.responseText).find("z\\:row").each(function() {
            	var liHtml = "<div style='color:#8A887D; padding-left:1px; font-size:10px; text-align:left; width:99%;'> <span style='color:Black;'>   » </span><a href='"+ $(this).attr("ows_HyperLink") +"'>" + $(this).attr("ows_Title") + "</div></a><br/>";
            	$("#nav_inner6").append(liHtml);
        	});

        }
    }

	/* Slider Menu Functions Ends here*/
	
	
	


 	/* Process Events Results Starts Here */
	 function processLoadEvents(xData, status) 
	 { 
     	$("#Events").html("");
     	$("#HomeEvents").html("");
     	
     	var tmpPathName = window.location.pathname;
		var isRootPage = false;
		if (tmpPathName.toLowerCase().indexOf('default.aspx') >=0)
		{
			isRootPage = true;			
		}
		else if(tmpPathName.toLowerCase().indexOf('irish.aspx') >=0)
		{
			isRootPage = true;
		}
	 	var Today = new Date(); 
		
	 	/*get the event*/
	 	var strStart; 
		var dtStart = new Date();
 		var tmpStrStart; 
 		var tmpDStart = new Date();
 		var strEnd;
 		var dtEnd = new Date();
 		var tmpStrEnd;
 		var tmpDtEnd = new Date();

 		var tmpIsRecurringEvent;
 		var tmpIsAllDayEvent;
 		var isRecurringEvent;
 		var isAllDayEvent;
 		var EventTitle;
 		var EventDescription;
 		var EventImageUrl;
 		var EventStatus = 4; /*1=Current, 2=Recurring, 3=Future, 4=NoEvent*/
 		
 		var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    	var monthname=new Array("January","Feburary","March","April","May","June","July","August","September","October","November","December");
    	var monthnameShort=new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
    	
    	/*Set dates and bits*/
		var strEventdate;
		var strEventtime ='';
		var strEventType;
		var strEventTypeTime ='';

    	var homePageCounterEvents=0;
    	
    	var MultiArray = new Array($(xData.responseXML).find("[nodeName=rs:data]").attr("ItemCount"));

    	$(xData.responseXML).find("[nodeName=z:row]").each(function() { 		
				EventStatus = 4;
    		// two situations ( only for completed ones)
    		//1) home hape only display 2
    		//2) display page display all
    		
            	if($(this).attr("ows_ReviewStatus")== "Completed")
				{
				    //homePageCounterEvents = homePageCounterEvents+1;
					/*assign temporary values from event*/
					tmpStrStart = String($(this).attr("ows_EventDate"));
					tmpDtStart = new Date(tmpStrStart.substring(0,4),tmpStrStart.substring(5,7)-1,tmpStrStart.substring(8,10),tmpStrStart.substring(11,13), tmpStrStart.substring(14,16));
					tmpStrEnd = String($(this).attr("ows_EndDate"));
					tmpDtEnd = new Date(tmpStrEnd.substring(0,4),tmpStrEnd.substring(5,7)-1,tmpStrEnd.substring(8,10));
					tmpIsRecurringEvent = $(this).attr("ows_fRecurrence");
					tmpIsAllDayEvent = $(this).attr("ows_fAllDayEvent");

						strStart = tmpStrStart;
						dtStart = tmpDtStart;
						strEnd = tmpStrEnd;
						dtEnd = tmpDtEnd; 
					
						isRecurringEvent = tmpIsRecurringEvent;
						isAllDayEvent = tmpIsAllDayEvent;
					
						EventTitle = $(this).attr("ows_Title");
						EventDescription = $(this).attr("ows_EventDescription");
						EventImageUrl = $(this).attr("ows_ImageURL");


					/*check if it is today*/
					if( tmpDtStart .getFullYear() == Today.getFullYear() && tmpDtStart .getMonth() == Today.getMonth() && tmpDtStart .getDate() == Today.getDate() )
					{
						EventStatus = 1;
						
						//return; /*we can not do better than to show todays event so exit loop/function*/
					}
					/*Check for recurring*/
					else if(tmpIsRecurringEvent = 1 && (tmpDtStart*1 <= Today*1 && tmpDtEnd*1 >= Today*1))
					{
						EventStatus=2; /*Recurring*/
						
					}
					/*Check if it is future*/
					//else if (EventStatus == 4 || (EventStatus >= 3 && (tmpDtStart > Today.getDate() && tmpDtStart < dtStart)))
					else if (tmpDtStart*1 > Today*1)
					{  
						EventStatus=3; /*Future*/
					}
						/*Set dates and bits*/	
						strEventdate = monthnameShort[dtStart.getMonth()];
						strEventdate +=  "-" + dtStart.getDate();
						if(dtStart.getHours() > 0)
						{ 
								if(dtStart.getHours()>12)
								{
									strEventdate +=  " " + tmpStrStart.substring(11,13)  + ":" + tmpStrStart.substring(14,16) + " PM";
									strEventtime = tmpStrStart.substring(11,13)  + ":" + tmpStrStart.substring(14,16) + " PM";
								}
								else
								{
									strEventdate += " " + tmpStrStart.substring(11,13) + ":" + tmpStrStart.substring(14,16) + " AM";
									strEventtime = tmpStrStart.substring(11,13)  + ":" + tmpStrStart.substring(14,16) + " AM";
								}
									
						}
									
						strEventType = '';
						if( isRecurringEvent == 1) 
						{ 
							strEventType = "Ongoing Event from ";
							strEventTypeTime = "Ongoing Event from ";
						}
						else if( isAllDayEvent == 1)
						{  
							strEventType = "Ongoing Event each "; 
							strEventTypeTime = "Ongoing Event each ";
						}
						
						/*End of dates and Bits*/
				
				
						//var browserName=navigator.appName; 
					 	var iHtml ='';
						//if (browserName=="Microsoft Internet Explorer")
						if(isRootPage && (EventStatus !=4))
				 		{
							iHtml = "<table style='text-align:left;padding-left:5px; padding-top:12px;' border='0px' CellPadding='0' CellSpacing='0'width='100%'>"		
							iHtml +=  "<tr>"
							iHtml +=    "<td width='15' valign='top'><table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
							iHtml +=  	    "<tr><td><BR></td></tr>"
							iHtml +=        "<tr>"
							iHtml +=            "<td align='center'><div class='EventFont'> <span  style='#F58C4B dashed; width:50px;'>"
							iHtml +=                monthnameShort[dtStart.getMonth()]
							iHtml +=            "</span><div></td>"
							iHtml +=       "</tr>"
							iHtml +=        "<tr>"
							iHtml +=            "<td class='EventFont' align='center'>" + dtStart.getDate() + "</td>"
							iHtml +=        "</tr>"
							iHtml +=    "</table></td>"
							iHtml +=    "<td width='85%' valign='middle'>";
							iHtml +=    "<table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
							iHtml +=        "<tr>"
							iHtml +=            "<td><div class='EventHeader'> <span  style='border-bottom:1px #F58C4B dashed; width:50px;'>"
							iHtml +=                EventTitle
							iHtml +=            "</span><div></td>"
							iHtml +=        "</tr>"
							iHtml +=        "<tr>"
							iHtml +=            "<td class='EventFont'>" + EventDescription + "</td>"
							iHtml +=        "</tr>"
							iHtml +=        "<tr><td><BR></td></tr>"
							iHtml +=        "<tr>"
							iHtml +=            "<td class='EventFont'>" + strEventTypeTime + strEventtime + "</td>"
							iHtml +=        "</tr>"
							iHtml +=    "</table>"
							iHtml +=    "</td>"
							iHtml += "</tr>"
							iHtml += "<tr height='2px'><td colspan='2' class='EventBottom'></td></tr>"
							iHtml += "</table>"
				        }	
				        else if(EventStatus !=4)
				        {
									iHtml = "<table style='text-align:left;padding-left:5px; padding-top:12px;' border='0px' CellPadding='0' CellSpacing='0'width='100%'>"
									
									iHtml +=  "<tr>"
									iHtml +=    "<td width='15' valign='top'> <img height='80' width='70' src='" + EventImageUrl +"'></td>"
									iHtml +=    "<td width='85%' valign='middle'>";
									iHtml +=    "<table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
									iHtml +=        "<tr>"
									iHtml +=            "<td><div class='EventHeader'> <span  style='border-bottom:1px #F58C4B dashed; width:50px;'>"
									iHtml +=               EventTitle
									iHtml +=            "</span><div></td>"
									iHtml +=       "</tr>"
									iHtml +=        "<tr>"
									iHtml +=            "<td class='EventFont'>" + strEventType + strEventdate + "</td>"
									iHtml +=        "</tr>"
									iHtml +=        "<tr>"
									iHtml +=            "<td class='EventFont'>" + EventDescription + "</td>"
									iHtml +=        "</tr>"
									iHtml +=    "</table>"
									iHtml +=    "</td>"
									iHtml += "</tr>"
									iHtml += "<tr height='2px'><td colspan='2' class='EventBottom'></td></tr>"
									iHtml += "</table>"								    
						}
								 
						if(iHtml != '')
						{
										
										//$("#Events").append(iHtml);
										//$("#HomeEvents").append(iHtml);	
										MultiArray[homePageCounterEvents] = new Array(2);
										MultiArray[homePageCounterEvents][0] = tmpDtStart.getTime();
										MultiArray[homePageCounterEvents][1] = iHtml;
										homePageCounterEvents = homePageCounterEvents+1;
						}

				} /*End of if completed*/
			        	       
            });
/*End Of getting event*/
 	MultiArray.sort(byint(0,-1));
	var row;
     for (row = 0; row < MultiArray.length; ++ row)
     {
        if(MultiArray[row] === undefined)
        {
        }
        else{ 
         	if((isRootPage) && (row >=2))
			{
				break;
				//only display max of 2 events and they are completed
			}  
     		$("#Events").append(MultiArray[row][1]);
     		$("#HomeEvents").append(MultiArray[row][1]);
     	}
     }

    } /*End Of Function*/

	
	/*** 
	    Simple jQuery Slideshow Script
	    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
	***/
	
	function slideSwitch() {
	//alert( $('#slideshow DIV.active'));
	    var $active = $('#slideshow DIV.active');
	
	    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
	
	    // use this to pull the divs in the order they appear in the markup
	    var $next =  $active.next().length ? $active.next()
	        : $('#slideshow DIV:first');
	
	  
	
	
	    $active.addClass('last-active');
	
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate({opacity: 1.0}, 1000, function() {
	            $active.removeClass('active last-active');
	        });
	}
	
	$(function() {
	    setInterval( "slideSwitch()", 5000 );
	});

	function processResultTestimonial(xData, status) {
	
        var tmpPathName;
        var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
 		{
 			 tmpPathName = window.location.pathname;
		}
		else
		{
			tmpPathName = window.location.pathname;
		}
		
		var isRootPage = false;
		if (tmpPathName.toLowerCase().indexOf('default.aspx') >=0)
		{
			isRootPage = true;			
		}
		else if(tmpPathName.toLowerCase().indexOf('irish.aspx') >=0)
		{
			isRootPage = true;
		}

	    $("#slideshow2").html("");
	    $("#TestimonialsListing").html("");
	    $(xData.responseXML).find("[nodeName=z:row]").each(function() {
	    //$(xData.responseXML).find("z\\:row").each(function() {		        

						        if(isRootPage)
					    		{
										        var i;
										        i=0;
										        if($(this).attr("ows_Visibility") == '1')
										        {
														        var sh;
														        if(i == 0)
														        {
														        		sh = 'class="active"';
														        }else{
														        	sh="";
														        }
														          
																 var iHtml = '<div class="'+ sh +'"><img src="'+ $(this).attr("ows_ImageURL") +'" alt="'+ $(this).attr("ows_Title") +'" Title="'+ $(this).attr("ows_Title")+'" />'
												 				 //iHtml += '<p>'+ $(this).attr("ows_Description") +'</p></div>'
												 				 iHtml += '<p><span><b><font size="2" color="#505676">'+ $(this).attr("ows_Nameofperson") +'</font></b></span><br/><br/>'
																 iHtml += '<span>'+ $(this).attr("ows_Designation") +'</span><br/>'
																 iHtml += '<span>'+ $(this).attr("ows_Description") +'</span><br/>'
																 iHtml += '<span><a style="color:#F58C4B;text-decoration:none;" href="'+ $(this).attr("ows_URL") +'">Read More...</a></span><br/></p></div>'				 
												
												                 i++;
													            $("#slideshow2").append(iHtml);
									            }
								}
				 				else
				 				{
								 				if($(this).attr("ows_Visibility") == '1')		          
												{
								
												 //var iHtml = '<div><img src="'+ $(this).attr("ows_ImageURL") +'" alt="'+ $(this).attr("ows_Title") +'" Title="'+ $(this).attr("ows_Title")+'" />'
								 				 //iHtml += '<p><span><b><font size="2" color="#505676">'+ $(this).attr("ows_Nameofperson") +'</font></b></span><br/><br/>'
												 //iHtml += '<span>'+ $(this).attr("ows_Designation") +'</span><br/>'
												 //iHtml += '<span>'+ $(this).attr("ows_Description") +'</span><br/>'
												 //iHtml += '<br/></p></div>'		
												 
													var iHtml = "<table style='text-align:left;padding-left:5px; padding-top:12px;' border='0px' CellPadding='0' CellSpacing='0'width='100%'>"
													
													iHtml +=  "<tr>"
													iHtml +=    "<td width='15%' valign='top'>" 
													iHtml +=    "<img height='80' width='70' src='" + $(this).attr("ows_ImageURL") +"' alt='" + $(this).attr("ows_Title") +"' Title='"+ $(this).attr("ows_Title")+ "' >"
													iHtml +=    "</td>"
													iHtml +=    "<td width='85%' valign='middle'>";
													iHtml +=    "<table border='0px' CellPadding='0' CellSpacing='0' width='100%'>"
													iHtml +=        "<tr>"
													iHtml +=            "<td><div class='EventHeader'> <span  style='border-bottom:1px #F58C4B dashed; width:50px;'>"
													iHtml +=               $(this).attr("ows_Nameofperson")
													iHtml +=            "</span><div></td>"
													iHtml +=       "</tr>"
													iHtml +=        "<tr>"
													iHtml +=            "<td class='EventFont'>" + $(this).attr("ows_Designation") + "</td><br/>"
													iHtml +=        "</tr>"
													iHtml += 		"<tr height='2px'><td>&nbsp;</td></tr>"
													iHtml +=        "<tr>"
													iHtml +=            "<td class='EventFont'>" + $(this).attr("ows_Description") + "</td>"
													iHtml +=        "</tr>"
													iHtml +=    "</table>"
													iHtml +=    "</td>"
													iHtml += "</tr>"
													iHtml += "<tr height='2px'><td colspan='2' class='EventBottom'></td></tr>"
													iHtml += "</table>"
															 
								    	         $("#TestimonialsListing").append(iHtml);
								
								    	 		}
								    }
    	 		
			}); 
						   	//setInterval( "slideSwitch()", 5000 );
							if(isRootPage)
							{
								 slideSwitchTestimonial();
							}								           
	}
		 
	function processResultImages(xData, status) {
					$("#slideshow").html("");	
					var j;
					j=0;
					
					var browserName=navigator.appName; 
					if (browserName=="Microsoft Internet Explorer")
 					{
						//	alert(browserName);
			        	$(xData.responseXML).find("z\\:row").each(function() {
			        	var sh;
			        	if(j == 0)
			        	{
			        		sh = 'class="active"';
			        	}else{
			        		sh="";
			        	}
			            var randomnumber=Math.floor(Math.random()*11)
					 	var iHtml = '<div id="'+randomnumber+'" class="'+ sh +'"><a target="_blank" href="'+ $(this).attr("ows_NameofthePicture") +'"><img src='+ $(this).attr("ows_NameofthePicture") +'?'+randomnumber+' alt="'+ $(this).attr("ows_Title")+'" Title="'+ $(this).attr("ows_Title")+'" /></a> </div>'
                     	j++;
                     	//alert($(this).attr("ows_NameofthePicture"));
 		            	$("#slideshow").append(iHtml);

			        	});
			        	
			          	//setInterval( "slideSwitch()", 5000 );
			          	slideSwitch();

					}
					else
					{
					//alert(browserName);

			       	 	$(xData.responseText).find("z\\:row").each(function() {
			        	var sh;
			        	if(j == 0)
			        	{
			        		sh = 'class="active"';
			        	}else{
			        		sh="";
			        	}
			          
 
					 	var iHtml = '<div class="'+ sh +'"><a target="_blank" href="'+ $(this).attr("ows_NameofthePicture") +'"><img src='+ $(this).attr("ows_NameofthePicture") +' alt="'+ $(this).attr("ows_Title")+'" Title="'+ $(this).attr("ows_Title")+'" /></a> </div>'
                     	j++;
 		            	$("#slideshow").append(iHtml);

			        	});
			          	//setInterval( "slideSwitch()", 5000 );
			          	slideSwitch();
    
					}
					
	}

	/* Process QuickLinks Starts Here */
	 function processQLinks(xData, status) {			    

     $("#CommonQuicklinks").html("");

		var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
		{

				    $(xData.responseXML).find("z\\:row").each(function() {
				
					if(($(this).attr("ows_ReviewStatus")== "Completed") && ($(this).attr("ows_Visibility")== "1"))
					{
				
							var iHtml = '<ul class="navbar"><li><a title="' + $(this).attr("ows_Title") + '"+ href="'+ $(this).attr("ows_URL") + '">'+ $(this).attr("ows_DisplayText") + '</a></li></ul>'
									
							$("#CommonQuicklinks").append(iHtml);
							}
				    });
		}
		else
		{
			$(xData.responseText).find("z\\:row").each(function() {

				if(($(this).attr("ows_ReviewStatus")== "Completed") && ($(this).attr("ows_Visibility")== "1"))
				{

					var iHtml = '<ul class="navbar"><li><a title="' + $(this).attr("ows_Title") + '"+ href="'+ $(this).attr("ows_URL") + '">'+ $(this).attr("ows_DisplayText") + '</a></li></ul>'
					
					$("#CommonQuicklinks").append(iHtml);
				}
        	});

		}
			
       	            
    }
    
			    
	/* Process QuickLinks Starts Here */
	 function processGateways(xData, status) {
     $("#CommonGateways").html("");
     	var browserName=navigator.appName; 
		if (browserName=="Microsoft Internet Explorer")
		{
			$(xData.responseXML).find("z\\:row").each(function() {

				if(($(this).attr("ows_ReviewStatus")== "Completed") && ($(this).attr("ows_Visibility")== "1"))
				{

					var iHtml = '<ul class="navbar"><li><a title="' + $(this).attr("ows_Title") + '"+ href="'+ $(this).attr("ows_URL") + '">'+ $(this).attr("ows_DisplayText") + '</a></li></ul>'
					$("#CommonGateways").append(iHtml);
				}
        	});

		}
		else
		{
        	$(xData.responseText).find("z\\:row").each(function() {

				if(($(this).attr("ows_ReviewStatus")== "Completed") && ($(this).attr("ows_Visibility")== "1"))
				{

					var iHtml = '<ul class="navbar"><li><a title="' + $(this).attr("ows_Title") + '"+ href="'+ $(this).attr("ows_URL") + '">'+ $(this).attr("ows_DisplayText") + '</a></li></ul>'
					$("#CommonGateways").append(iHtml);
				}
        	});
        }
    }
