// JavaScript Document
var imgSrc01;
var imgSrc02;
var imgSrc03;
var imgSrc04;
var imgSrc05;
var imgSrc06;
var queryString = "0";
var intervalId;

	function myFunc()
	{
	alert ("themessage");
	}

$(document).ready(function(){ 
	setInterval("rotateMsg()",7000);


	//intervalID = window.setInterval(rotateMsg(), 1000);
	//.delay(1000, 
	function querySt(ji) {
		hu = window.location.search.substring(1);
		gy = hu.split("&");
		for (i=0;i<gy.length;i++) {
			ft = gy[i].split("=");
			if (ft[0] == ji) {
				return ft[1];
			}
		}
	}
	//var galtoset = getQueryParamValue("setgallery");
	
	queryString = querySt("setimage");
	setImages(queryString);
});
function setImages(queryStringInuput) {
	if (queryStringInuput == '1') {
		imgSrc01 = 'wp-content/themes/ymcatheme/images/home-foryouth_03.jpg';
		imgSrc02 = 'wp-content/themes/ymcatheme/images/home-foryouth_05.jpg';
		imgSrc03 = 'wp-content/themes/ymcatheme/images/home-foryouth_08.jpg';
		imgSrc04 = 'wp-content/themes/ymcatheme/images/home-foryouth_09.jpg';
		imgSrc05 = 'wp-content/themes/ymcatheme/images/home-foryouth_06.jpg';	
		imgSrc06 = 'wp-content/themes/ymcatheme/images/home-foryouth_07.jpg';
	} else if (queryStringInuput == '2') {
		imgSrc01 = 'wp-content/themes/ymcatheme/images/home-forhealthy_03.jpg';
		imgSrc02 = 'wp-content/themes/ymcatheme/images/home-forhealthy_05.jpg';
		imgSrc03 = 'wp-content/themes/ymcatheme/images/home-forhealthy_08.jpg';
		imgSrc04 = 'wp-content/themes/ymcatheme/images/home-forhealthy_09.jpg';
		imgSrc05 = 'wp-content/themes/ymcatheme/images/home-forhealthy_06.jpg';	
		imgSrc06 = 'wp-content/themes/ymcatheme/images/home-forhealthy_07.jpg';
	} else if (queryStringInuput == '3') {
		imgSrc01 = 'wp-content/themes/ymcatheme/images/home-social_03.jpg';
		imgSrc02 = 'wp-content/themes/ymcatheme/images/home-social_05.jpg';
		imgSrc03 = 'wp-content/themes/ymcatheme/images/home-social_08.jpg';
		imgSrc04 = 'wp-content/themes/ymcatheme/images/home-social_09.jpg';
		imgSrc05 = 'wp-content/themes/ymcatheme/images/home-social_06.jpg';	
		imgSrc06 = 'wp-content/themes/ymcatheme/images/home-social_07.jpg';
	} else {
		imgSrc01 = 'wp-content/themes/ymcatheme/images/home-welcome_03.jpg';
		imgSrc02 = 'wp-content/themes/ymcatheme/images/home-welcome_05.jpg';
		imgSrc03 = 'wp-content/themes/ymcatheme/images/home-welcome_08.jpg';
		imgSrc04 = 'wp-content/themes/ymcatheme/images/home-welcome_09.jpg';
		imgSrc05 = 'wp-content/themes/ymcatheme/images/home-welcome_06.jpg';	
		imgSrc06 = 'wp-content/themes/ymcatheme/images/home-welcome_07.jpg';
	}
	document.getElementById("buttonid").getElementsByTagName("img")[0].src = imgSrc01;
	document.getElementById("buttonid").getElementsByTagName("img")[1].src = imgSrc02;
	document.getElementById("buttonid").getElementsByTagName("img")[2].src = imgSrc03;
	document.getElementById("buttonid").getElementsByTagName("img")[3].src = imgSrc04;
	document.getElementById("buttonid").getElementsByTagName("img")[4].src = imgSrc05;
	document.getElementById("buttonid").getElementsByTagName("img")[5].src = imgSrc06;
}
//function startTimer() {

//}
function rotateMsg() {
	if(queryString == 1) {
		queryString = 2;
	} else if (queryString == 2) {
		queryString = 3;	
	} else if (queryString == 3) {
		queryString = 0;
	} else if (queryString == 0) {
		queryString = 1
	} else {
		queryString = 0;
	}
	setImages(queryString);
}

