var pressed1=1;
var pressed2=0;
var pressed3=0;
var thandle;
var i=2;
var currentPage=1;
var trueOk=1;
function resetStyle2(IconNumber) {
  	elem = document.getElementById('lfs_header');
	elem.style.backgroundImage = 'url(/i/lifestyle/sg/background' + IconNumber + '.jpg)';

	pTitle1 = document.getElementById('lfsHeadBigTitle1');
	pTitle2 = document.getElementById('lfsHeadBigTitle2');
	pTitle3 = document.getElementById('lfsHeadBigTitle3');
	pLead1 = document.getElementById('lfsHeadLead1');
	pLead2 = document.getElementById('lfsHeadLead2');
	pLead3 = document.getElementById('lfsHeadLead3');
	if (IconNumber==1) {
		pTitle1.style.display = 'block';
		pTitle2.style.display = 'none';
		pTitle3.style.display = 'none';
		pLead1.style.display = 'block';
		pLead2.style.display = 'none';
		pLead3.style.display = 'none';
		pressed1++;
		pressed2=0;
		pressed3=0;
	} else if (IconNumber==2) {
		pTitle1.style.display = 'none';
		pTitle2.style.display = 'block';
		pTitle3.style.display = 'none';
		pLead1.style.display = 'none';
		pLead2.style.display = 'block';
		pLead3.style.display = 'none';
		pressed1=0;
		pressed2++;
		pressed3=0;
	} else if (IconNumber==3) {
		pTitle1.style.display = 'none';
		pTitle2.style.display = 'none';
		pTitle3.style.display = 'block';
		pLead1.style.display = 'none';
		pLead2.style.display = 'none';
		pLead3.style.display = 'block';
		pressed1=0;
		pressed2=0;
		pressed3++;
	}

	i++; if (i>3) { i=1}

	if (pressed1 > 1 || pressed2 > 1 || pressed3 > 1) {
		return true;
	} else {
		return false;
	}
	
	
}


function headCycle() {
		thandle = setInterval('resetStyle2(i)', 8000);
}

function changeCursor(type,side) {
			document.body.style.cursor = type;
	return true;
}

function pageSwitch(page) {
var prevButt = document.getElementById('Pop');
var prevArr = document.getElementById('lArr');
var nextButt = document.getElementById('Nast');
var nextArr = document.getElementById('rArr');
var archiveBtn = document.getElementById('archiveBtn');
var archiveArr = document.getElementById('archiveArr');

	page1 = document.getElementById('catNav_1'); button1 = document.getElementById('button_1');
	page2 = document.getElementById('catNav_13'); button2 = document.getElementById('button_2');
	page3 = document.getElementById('catNav_25'); button3 = document.getElementById('button_3');
	page4 = document.getElementById('catNav_37'); button4 = document.getElementById('button_4');
		
	switch (page) {
		case 1 :
			page1.style.display = 'block'; button1.style.fontWeight = 'bold';
			page2.style.display = 'none'; button2.style.fontWeight = 'normal';
			page3.style.display = 'none'; button3.style.fontWeight = 'normal';
			page4.style.display = 'none'; button4.style.fontWeight = 'normal';
			currentPage = 1;
			break;
		case 2 :
			if (currentPage>2) {
					  page1.style.display = 'none'; button1.style.fontWeight = 'normal';
					  page2.style.display = 'block'; button2.style.fontWeight = 'bold';
					  page3.style.display = 'none'; button3.style.fontWeight = 'normal';
					  page4.style.display = 'none'; button4.style.fontWeight = 'normal';
			} else {
					  page2.style.display = 'block'; button2.style.fontWeight = 'bold';
					  page1.style.display = 'none'; button1.style.fontWeight = 'normal';
					  page3.style.display = 'none'; button3.style.fontWeight = 'normal';
					  page4.style.display = 'none'; button4.style.fontWeight = 'normal';
			}
			currentPage = 2;
			break;
		case 3 :
			if (currentPage>3) {
					  page1.style.display = 'none'; button1.style.fontWeight = 'normal';
					  page2.style.display = 'none'; button2.style.fontWeight = 'normal';
					  page3.style.display = 'block'; button3.style.fontWeight = 'bold';
					  page4.style.display = 'none'; button4.style.fontWeight = 'normal';
			} else {
					  page3.style.display = 'block'; button3.style.fontWeight = 'bold';
					  page1.style.display = 'none'; button1.style.fontWeight = 'normal';
					  page2.style.display = 'none'; button2.style.fontWeight = 'normal';
					  page4.style.display = 'none'; button4.style.fontWeight = 'normal';
			}
			currentPage = 3;
			break;
		case 4 :
			page4.style.display = 'block'; button4.style.fontWeight = 'bold';
			page1.style.display = 'none'; button1.style.fontWeight = 'normal';
			page2.style.display = 'none'; button2.style.fontWeight = 'normal';
			page3.style.display = 'none'; button3.style.fontWeight = 'normal';
			currentPage = 4;
			break;
		
		case "r" :
			if (currentPage == 1) {
				page2.style.display = 'block'; button2.style.fontWeight = 'bold';
				page1.style.display = 'none'; button1.style.fontWeight = 'normal';
				currentPage = 2;
			} else if (currentPage ==2 ) {
				page3.style.display = 'block'; button3.style.fontWeight = 'bold';
				page2.style.display = 'none'; button2.style.fontWeight = 'normal';
				currentPage = 3;
			} else if (currentPage ==3 ) {
				page4.style.display = 'block'; button4.style.fontWeight = 'bold';
				page3.style.display = 'none'; button3.style.fontWeight = 'normal';
				currentPage = 4;
			} else if (currentPage ==4 ) {
				currentPage = 4;

			}
			break;

		case "l" :
			if (currentPage == 1) {
				currentPage = 1;
			} else if (currentPage ==2 ) {
				page1.style.display = 'block'; button1.style.fontWeight = 'bold';
				page2.style.display = 'none'; button2.style.fontWeight = 'normal';
				currentPage = 1;
			} else if (currentPage ==3 ) {
				page2.style.display = 'block'; button2.style.fontWeight = 'bold';
				page3.style.display = 'none'; button3.style.fontWeight = 'normal';
				currentPage = 2;
			} else if (currentPage ==4 ) {
				page3.style.display = 'block'; button3.style.fontWeight = 'bold';
				page4.style.display = 'none'; button4.style.fontWeight = 'normal';
				currentPage = 3;
			}
			break;

	}
	
	if (currentPage==1) {
		prevButt.style.visibility = 'hidden';
		prevArr.style.visibility = 'hidden';

		nextButt.style.visibility = 'visible';
		nextButt.style.display = 'inline';
		nextArr.style.visibility = 'visible';
		nextArr.style.display = 'inline';
		
		archiveBtn.style.display = 'none';
		archiveArr.style.display = 'none';
	} else if (currentPage==4) {
//		nextButt.style.visibility = 'hidden';
//		nextArr.style.visibility = 'hidden';
		nextButt.style.display = 'none';
		nextArr.style.display = 'none';
		archiveBtn.style.display = 'inline';
		archiveArr.style.display = 'inline';
		prevButt.style.visibility = 'visible';
		prevArr.style.visibility = 'visible';
	} else {
		prevButt.style.visibility = 'visible';
		prevArr.style.visibility = 'visible';

		nextButt.style.visibility = 'visible';
		nextButt.style.display = 'inline';
		nextArr.style.visibility = 'visible';
		nextArr.style.display = 'inline';

		archiveBtn.style.display = 'none';
		archiveArr.style.display = 'none';
	}
	return true;

}


//function disableSelection(target){
//  if (typeof target.onselectstart!="undefined") //IE route
//	 target.onselectstart=function(){return false}
//	  else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
//		 target.style.MozUserSelect="none"
//	  else //All other route (ie: Opera)
//		 target.onmousedown=function(){return false}
//	  target.style.cursor = "default"
//}

