function makeHomePage() {
	//ah = document.getElementById("home");
	//ah.style.behavior='url(#default#homepage)';
	//ah.setHomePage('http://www.emilaleksov.com');

	//this.style.behavior='url(#default#homepage)';
	//this.setHomePage('http://www.codelifter.com');
}

function bookmarksite(url, title){
	if (document.all) 
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}


function addToFavorites() {
	window.external.AddFavorite('http://www.emilaleksov.com', '.:Emil Aleksov:. - личен сайт');
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}



function checkAll (field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = true;
	}
}


function uncheckAll (field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = false;
	}
}


function reverseSelection (field) {
	for (i = 0; i < field.length; i++) {
		if (field[i].checked == true) {
			field[i].checked = false;
		} else {
			field[i].checked = true;
		}
	}
}


function validateCommentForm (message) {
	if (trim(document.comment_form.comment_text.value) == "") 
		alert(message); 
	else 
		document.comment_form.submit();
}


function openWeatherForecastsBG(lang) {
	if (lang=="en") {
		window.open('http://vremeto.v.bg/c/index.pl%3Fplace=15&action=real&lang=_eng.html','','');
	} else {
		window.open('http://vremeto.v.bg/c/index.pl%3Fplace=15&action=real&lang=_bul.html','','');
	}
	window.open('http://www.btv.bg/weather/bg_forecast.pcgi','','');
	window.open('http://www.weather.com/common/drilldown/BU.html','','');
	window.open('http://gismeteo.ru/city/catalog/cities/?country=BG&id=24');
}


function openSendToFriend() {
	OpenWin = window.open("send_to_friend.php", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=500,height=400,top=0,left=0");
}


function showImage(image, width, height, story_id, lang) {
	OpenWin = this.open("storyimage.php?image="+image+"&story_id="+story_id+"&lang="+lang, "", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width="+(width+50)+",height="+(height+80)+",top=0,left=0");
}


function deleteUser(user_id, lang) {
	if(confirm("Delete user with ID = "+user_id+"?")) {
		window.location="index.php?module=administration&action=view_users&del_confirm=yes&del_user_id="+user_id+"&lang="+lang;
	}
}
