var countClick = 0;

function submenuAppearance(idElement){
	var list = document.getElementById(idElement);
	list.style.display="block";
}

function submenuDisappearance(idElement){
	var list = document.getElementById(idElement);
	list.style.display="none";
}

function currentPagePointStyle(currentPage){
	document.getElementById(currentPage).setAttribute("class", "curpoint");
	$("#" + currentPage).css({color:'#fff'});
}

function addArrowDownServices(idArrowDownDiv){
	document.getElementById(idArrowDownDiv).innerHTML='<img src="img/arrow-down.gif" class="arrow" onclick="listScrollDownServices()">';
	document.getElementById(idArrowDownDiv).setAttribute("class", "arrows-services");
}

function delArrowDownServices(idArrowDownDiv){
	document.getElementById(idArrowDownDiv).innerHTML='';
	document.getElementById(idArrowDownDiv).setAttribute("class", "arrowservices");
}

function addArrowUpServices(idArrowUpDiv){
	document.getElementById(idArrowUpDiv).innerHTML='<img src="img/arrow-up.gif" class="arrow" onclick="listScrollUpServices()">';
	document.getElementById(idArrowUpDiv).setAttribute("class", "arrows-services");
}

function delArrowUpServices(idArrowUpDiv){
	document.getElementById(idArrowUpDiv).innerHTML='';
	document.getElementById(idArrowUpDiv).setAttribute("class", "arrowservices");
}

function listScrollDownServices(){
	if (countClick < hiddenPointsServices) countClick = countClick + 1;
	if (countClick>0 && countClick<hiddenPointsServices) addArrowUpServices('arrowUpServices')
	else if (countClick == hiddenPointsServices) delArrowDownServices('arrowDownServices');
	if (countClick >= 0 && countClick<=hiddenPointsServices){
		var marginTopValue = countClick*(-19);
		$("#" + "listOfServices").css({marginTop:marginTopValue});
	}
}

function listScrollUpServices(){
	if (countClick > 0) countClick = countClick - 1;
	if (countClick<=0) delArrowUpServices('arrowUpServices');
	if (countClick>0) addArrowDownServices('arrowDownServices');
	if (countClick >= 0){
		var marginTopValue = countClick*(-19);
		$("#" + "listOfServices").css({marginTop:marginTopValue});
	}
}

function addArrowDownSkills(idArrowDownDiv){
	document.getElementById(idArrowDownDiv).innerHTML='<img src="img/arrow-down.gif" class="arrow" onclick="listScrollDownSkills()">';
	document.getElementById(idArrowDownDiv).setAttribute("class", "arrows-skills");
}

function delArrowDownSkills(idArrowDownDiv){
	document.getElementById(idArrowDownDiv).innerHTML='';
	document.getElementById(idArrowDownDiv).setAttribute("class", "arrowskills");
}

function addArrowUpSkills(idArrowUpDiv){
	document.getElementById(idArrowUpDiv).innerHTML='<img src="img/arrow-up.gif" class="arrow" onclick="listScrollUpSkills()">';
	document.getElementById(idArrowUpDiv).setAttribute("class", "arrows-skills");
}

function delArrowUpSkills(idArrowUpDiv){
	document.getElementById(idArrowUpDiv).innerHTML='';
	document.getElementById(idArrowUpDiv).setAttribute("class", "arrowskills");
}

function listScrollDownSkills(){
	if (countClick < hiddenPointsServices) countClick = countClick + 1;
	if (countClick>0 && countClick<hiddenPointsServices) addArrowUpSkills('arrowUpSkills')
	else if (countClick == hiddenPointsServices) delArrowDownSkills('arrowDownSkills');
	if (countClick >= 0 && countClick<=hiddenPointsServices){
		var marginTopValue = countClick*(-19);
		$("#" + "listOfServices").css({marginTop:marginTopValue});
	}
}

function listScrollUpSkills(){
	if (countClick > 0) countClick = countClick - 1;
	if (countClick<=0) delArrowUpSkills('arrowUpSkills');
	if (countClick>0) addArrowDownSkills('arrowDownSkills');
	if (countClick >= 0){
		var marginTopValue = countClick*(-19);
		$("#" + "listOfSkills").css({marginTop:marginTopValue});
	}
}

function addHandler(node, evt, func) {
	if (node.addEventListener) {
		node.addEventListener(evt, func, false);
	} else {
		node.attachEvent('on' + evt, func);    
	}
}

function isParent(child, parent) {
	if (!child || !parent) {
		return false;
	}
	while (true) {
		if (child == parent) {
			return true;
		}
		if (child.parentElement) {
			child = child.parentElement;
		} else if (child.parentNode) {
			child = child.parentNode;
		} else {
			return false;
		}
	}
}
