function rldContent(t, def) {
	if (t.value == def) {
		t.value = '';
	}
}

function rldContent2(t, def) {
	if (!t.value) {
		t.value = def;
	}	
}

function openw(url, title, options) {
	var newwin = window.open(url, title, options);
	newwin.focus();
}



function hideGalPic(n) {
	if (document.getElementById) {
		document.getElementById('picNoScript_' + n).style.display = 'none';
	}
}

function doNext() {
	var bts = document.getElementsByName(NDIV);
	var i;
	
	if(currentPic < (NUM_PICS)) {
		//document.getElementById(NDIV).style.textDecoration='none';
		//document.getElementById(NDIV).style.color='';
		
		for (i = 0; i < bts.length; i ++) {
			bts[i].style.textDecoration='underline';
			bts[i].style.color='';			
		}
		
	} else {
		for (i = 0; i < bts.length; i ++) {
			bts[i].style.textDecoration='line-through';
			bts[i].style.color=DISABLECOLOR;
		}		
		
		//document.getElementById(NDIV).style.color=DISABLECOLOR;
		//document.getElementById(NDIV).style.textDecoration='line-through';
	}
}

function doBack(){
	var bts = document.getElementsByName(BDIV);
	var i;	
	
	if(currentPic > 1) {
		for (i = 0; i < bts.length; i ++) {
			bts[i].style.textDecoration='underline';
			bts[i].style.color='';			
		}		
		//document.getElementById(BDIV).style.textDecoration='none';
		//document.getElementById(BDIV).style.color='';
	} else {
		for (i = 0; i < bts.length; i ++) {
			bts[i].style.textDecoration='line-through';
			bts[i].style.color=DISABLECOLOR;
		}			
		//document.getElementById(BDIV).style.color=DISABLECOLOR;
		//document.getElementById(BDIV).style.textDecoration='line-through';
	}
	//alert(bts[0].style.textDecoration);
}

function showDiv(nDiv) {	
	for(var i = 1; i <= NUM_PICS; i++) {
		
		//~ if (NUM_PICS > 1) {
			//~ document.getElementById(LINKID_PREF + i).style.backgroundPosition= '0 0';
			//~ document.getElementById(LINKID_PREF + i).className = '';
			
			//document.getElementById(LINKID_PREF + i).style.color= currentPicColor;
		//~ }
		
		var buttonid = i;
		var id = PICID_PREF + i;
		var node = document.getElementById(id);
		if(node && i==nDiv) {
			node.style.display='block';
			currentPic = i;
			document.getElementById(LINKID_PREF + i).style.backgroundPosition= '0 -112px';
			//document.getElementById(LINKID_PREF + currentPic).style.color= unselectedColor;
		} else if(node) {
			node.style.display='none';
			document.getElementById(LINKID_PREF + i).style.backgroundPosition= '';
		}
	}
	doBack();
	doNext();
}

function showRelDiv(nDiv) {
	for(var i = 1; i <= NUM_PICS; i++) {
		
		var buttonid = i;
		var id = PICID_PREF + i;
		var node = document.getElementById(id);
		if(node && i==nDiv) {
			node.style.display='block';
			currentPic = i;
		} else if(node) {
			node.style.display='none';
		}
	}
	doBack();
	doNext();		
}

function showDivPrev() {
	if(currentPic > 1) {
		if (!RelGall) {
			showDiv(currentPic - 1);
		} else {
			showRelDiv(currentPic - 1);
		}
	}
}

function showDivNext() {
	if(currentPic < NUM_PICS) {
		//alert(RelGall);
		if (!RelGall) {
			showDiv(currentPic + 1);
		} else {
			showRelDiv(currentPic + 1);
		}				
	}
}

function GallInit() {
	var i;

	for (i = 1; i < 20; i ++) {
		if (document.getElementById(NAV_DIV + i)) {
			document.getElementById(NAV_DIV + i).style.display='block';
		}
	}

	showDiv(1);
}
function RelGallInit() {
	showRelDiv(1);
	document.getElementById(NAV_DIV).style.display='block';
}

function SwapFields(t) {
	var tab = document.getElementById('corptable');
	var rows = tab.getElementsByTagName('tr');

	for (i = 0; i < rows.length; i ++) {
		if (rows[i].getAttribute('name') == 'hidesmall') {
			if (t.options[t.selectedIndex].value == 1) {
				rows[i].style.display = '';
			} else {
				rows[i].style.display = 'none';
			}
		}
		if (rows[i].getAttribute('name') == 'hidebig') {
			if (t.options[t.selectedIndex].value == 2) {
				rows[i].style.display = '';
			} else {
				rows[i].style.display = 'none';
			}
		}
		if (rows[i].getAttribute('name') == 'hideburzo') {
			if (t.options[t.selectedIndex].value == 3) {
				rows[i].style.display = '';
			} else {
				rows[i].style.display = 'none';
			}
		}		
	}
}

var kumulatsize = 0;
function resize(oper) {
	var elem = document.getElementById("ourStoryContent");
	if (oper == '+' && kumulatsize < 5) kumulatsize = kumulatsize + 1;
	if (oper == '-' && kumulatsize > -5) kumulatsize = kumulatsize - 1;
	elem.className = 'fontSize' + kumulatsize;
}

function vbaneri2(section, htmlstart, htmlend) {
	if (!banners[section]) return false;
	if (showban1==1) {
		document.write(htmlstart);
		vbaneri(section);
		document.write(htmlend);
	}
}

function rldContentBuletin(t) {	
	if (t.value == 'Вашата е-поща') {
		t.value = '';
	}
	t.style.color = '#000';
}

function rldContentBuletin2(t) {
	if (!t.value) {
		t.value = 'Вашата е-поща';
	}	
	t.style.color = '#A4A4A4';
}