// getContent.js THIS GETS ALL THE CONTENT FROM EXTERNAL HTML FILES IN CONTENT FOLDER

function getRightContent () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/rightContent.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('rightContent').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getMainContent () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
				url: 'contentLayout/mainContent.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('content').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getHeaderContent () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/header.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('header').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getFooterContent () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/footer.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('footer').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getAccordionPane_0_Content () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/accordion_0.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('accordion_0').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getAccordionPane_1_Content () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/accordion_1.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('accordion_1').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getAccordionPane_2_Content () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/accordion_2.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('accordion_2').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function getAccordionPane_3_Content () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/accordion_3.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('accordion_3').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function makeMyIframe(){
	var myiframe = dojo.doc.createElement("IFRAME");
	myiframe.id='externalContent';
	myiframe.style.height='500px';
	myiframe.style.width='600px';
	dojo.doc.body.appendChild(myiframe);
}

function setIframeContent(url){
	// Then change the source of the iframe
	dojo.byId('externalContent').src=url;
}

function setMainContent (inputURL) {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: inputURL,
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('content').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function setAnyContent (inputURL, inputDOM) {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: inputURL,
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId(inputDOM).setContent( data );
					//dijit.byId('content').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function setWeatherContent () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/rtp_0.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('rightTitlePane0').setContent( data );
					//dijit.byId('content').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function setAdContent () {
            dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: 'contentLayout/rtp_1.html',
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('rightTitlePane1').setContent( data );
					//dijit.byId('content').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function myHandler(id,newValue){
			console.debug("onChange for id = " + id + ", value: " + newValue);
		}

function piwikStatsRegisterPage()
{	pkBaseURL = "http://mtbshred.com/piwik/";
		try {	var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
				piwikTracker.trackPageView();
				piwikTracker.enableLinkTracking();
			} 
		catch( err ) { console.log('piwik error'); }
}

function setMainContentPhp (inputURL) {
            var baseUrl = "js/php/getHTMLMethod.php?";
			var fullUrl = baseUrl + "url=" + inputURL + "&target=*";
			
			dojo.xhrGet ({
                // Location of the HTML content we want to grab
                url: fullUrl,
       
                // Called when the page loaded successfully
                load: function (data) {
					dijit.byId('content').setContent( data );
                },
       
                // Called if there was an error (such as a 404 response)
                error: function (data) {
                    console.error('Error: ', data);
                }
            });
        }
		
function setMainContentPhp2(inputURL)
{	var targetNode = dojo.byId("content");		//Look up the node we'll stick the text under.
	var phpUrl = "js/php/getHTMLMethod.php?";	//http://localhost/php/getHTML.php?sessionId=karolis&productId=879847650
	
	var destinationUrl = phpUrl + "url=" + inputURL + "&target=*";
		
    //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
    var xhrArgs = {
		url: destinationUrl,
		handleAs: "text",
	
	load: function(data){
        targetNode.innerHTML = data;
      },
      
	error: function(error){
        targetNode.innerHTML = "An unexpected error occurred: " + error;
      }
    }

    //Call the asynchronous xhrGet
    var deferred = dojo.xhrGet(xhrArgs);
}