function showLogin(type){
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '240px';
	var type_text = '<a href="javascript:void(0)" onclick="javascript:showRegistration();" title="регистрация">регистрация</a>';
	if (type == 1) type_text = '<a href="/user/create_designer" title="регистрация">регистрация</a>';
	if (type == 2) type_text = '<a href="/user/create_employer" title="регистрация">регистрация</a>';
    newdiv_p_w.innerHTML = '<form name="login" method="post" id="login"><div id="popup_close"><a href="javascript:void(0)" onclick="javascript:closePopup();" title="Закрыть"></a></div><div class="space"></div><h5>Вход и '+type_text+'</h5><div class="input"><input type="text" name="login" value="Логин" onfocus="this.value=\'\';" ></div><div class="input"><input type="password" name="password" onfocus="document.forms.login.pas_text.value=\'\'" class="input_pas_p"><input type="text" value="Пароль" name="pas_text" class="input_pas_t" readonly></div><div class="re_pas"><a href="javascript:void(0)" onclick="javascript:showRemindPassword();">Ой, я пароль забыл</a></div><input type="submit" name="submit_login" value=" " id="input_supmit_popup"></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
	
	
	/*
	p_bg = document.getElementById("popup_bg");
	p = document.getElementById("popup");
	
	p.style.filter ="progid:DXImageTransform.Microsoft.Alpha(Opacity = 0)";
	p.style.opacity = 0;
	p_bg.style.filter ="progid:DXImageTransform.Microsoft.Alpha(Opacity = 0)";
	p_bg.style.opacity = 0;
	
	p_bg.style.display = "block";
	for (i=1; i<=5; i++){
		o = 0.1*i;
		ie_o = Math.round(o*100);
		t = i*30;
		setTimeout('p_bg.style.opacity = '+o, t);
		setTimeout('p_bg.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = '+ie_o, t);
	}
	p.style.display = "block";
	for (i=1; i<=10; i++){
		o = 0.1*i;
		ie_o = Math.round(o*100);
		t = i*30;
		setTimeout('p.style.opacity = '+o, t);
		setTimeout('p.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = '+ie_o, t);
	}
	*/
}
function showRegistration(){
	// popup_window
    newdiv_p_w = document.getElementById("popup_win");
    newdiv_p_w.innerHTML = '<div id="login"><div id="popup_close"><a href="javascript:void(0)" onclick="javascript:closePopup();" title="Закрыть"></a></div><div class="space"></div><h5>Регистрация</h5><div class="popup_text">Определитесь с выбором:</div><div class="create_e_d"><center><div class="create_employer"><a href="/user/create_employer" title="Я &ndash; работодатель!" id="reg_2">Я &ndash; работодатель!</a></div><div class="create_designer"><a href="/user/create_designer" title="Я &ndash; дизайнер!" id="reg_1">Нет, я дизайнер</a></div></center></div></div>';
}
function showRemindPassword(){
	// popup_window
    newdiv_p_w = document.getElementById("popup_win");
    newdiv_p_w.innerHTML = '<div id="login"><div id="popup_close"><a href="javascript:void(0)" onclick="javascript:closePopup();" title="Закрыть"></a></div><div class="space"></div><h5>Процедура<br>восстановления<br>пароля</h5><form name="repas" method="post" id="login"><div class="input_repass"><input type="text" name="email" onfocus="javascript: if (this.value==\'Вспоминаем e-mail\') this.value=\'\';" onBlur="javascript: if (this.value==\'\') this.value=\'Вспоминаем e-mail\';" value="Вспоминаем e-mail"></div><div id="input_supmit_repass"><a href="javascript:void(0)" onclick="javascript:submitRepass();" title="Вспоминаем e-mail"></a></div></form></div>';
}
function getBirthday(birthday){
	// popup_window
    el_div = document.getElementById("date_calend");
	el_div.style.display="block";
}
function closeBirthday(){
	el_div = document.getElementById("date_calend");
	el_div.style.display="none";
}
function closeLogin(){
	p_bg = document.getElementById("popup_bg");
	p = document.getElementById("popup");
	
	p.style.filter ="progid:DXImageTransform.Microsoft.Alpha(Opacity = 100)";
	p_bg.style.filter ="progid:DXImageTransform.Microsoft.Alpha(Opacity = 50)";
	
	p_bg.style.display = "block";
	for (i=1; i<=5; i++){
		o = 0.5-0.1*i;
		ie_o = Math.round(o*100);
		t = i*30;
		setTimeout('p_bg.style.opacity = '+o, t);
		setTimeout('p_bg.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = '+ie_o, t);
	}
	p.style.display = "block";
	for (i=1; i<=10; i++){
		o = 1-0.1*i;
		ie_o = Math.round(o*100);
		t = i*30;
		setTimeout('p.style.opacity = '+o, t);
		setTimeout('p.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = '+ie_o, t);
	}
	
	setTimeout('p_bg.style.display = "none"', t);
	setTimeout('p.style.display = "none"', t);
}

function showBlockFewW(el_sh) {
	El = document.getElementById("content_"+el_sh);
	if (El.style.display == "none" || El.style.display=="") {
		for (i = 1; i <= 5; i++) {
			if (document.getElementById("content_"+i)) document.getElementById("content_"+i).style.display = "none";
			document.getElementById("nav_"+i).style.background = "url(/images/slider_na.gif) no-repeat center center";
			document.getElementById("nav_"+i).style.width = " 20px ";
		}
		El.style.display = "block";
		El.style.display = "progid:DXImageTransform.Microsoft.Alpha(Opacity = 0)";
		El.style.opacity = 0;
		for (i=1; i<=10; i++){
			o = 0.1*i;
			ie_o = Math.round(o*100);
			t = i*30;
			setTimeout('El.style.opacity = '+o, t);
			setTimeout('El.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = '+ie_o, t);
		}
		document.getElementById("nav_"+el_sh).style.background = "url('/images/slider_a.gif') no-repeat center center";
		document.getElementById("nav_"+el_sh).style.width = " 30px ";
	}
}
function closePopup(){
	remDiv = document.getElementById("popup_bg");
	document.body.removeChild(remDiv);
	remDiv = document.getElementById("popup_win");
	document.body.removeChild(remDiv);
}
function get_ww() {
	var frameWidth=800; 
	if (self.innerWidth) frameWidth = self.innerWidth; 
	else if (document.documentElement && document.documentElement.clientWidth) frameWidth = document.documentElement.clientWidth; 
	else if (document.body) frameWidth = document.body.clientWidth; 
	return frameWidth; 
}
function get_wh() {
	var frameHeight=640; 
	if (self.innerHeight) frameHeight = self.innerHeight; 
	else if (document.documentElement && document.documentElement.clientHeight) frameHeight = document.documentElement.clientHeight; 
	else if (document.body) frameHeight = document.body.clientHeight; 
	return frameHeight; 
}
function deletePhoto() {
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '140px';
    newdiv_p_w.innerHTML = '<form name="del_photo" method="post"><center><div class="question">Точно удалить?</div><br><input type="submit" name="submit_delete_photo" value=" " id="supmit_yes"><input type="button" name="submit_cancel" value="" id="supmit_no" onclick="javascript: closePopup(); return false;"></center></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
	
	/*var newdiv = document.createElement('div');
    newdiv.className = 'popup';
    newdiv.id = 'myPId';
	newdiv.style.position = "absolute"
	newdiv.style.left = '100px';
	newdiv.style.top = '100px';
    newdiv.style.width = '300px';
    newdiv.style.height = '200px';
    newdiv.innerHTML = "html";
    parent.appendChild(newdiv);*/
}

function deletePortfolio(pf_id) {
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '140px';
    newdiv_p_w.innerHTML = '<form name="del_portfolio" method="post"><input type="hidden" name="pf_id" value="'+pf_id+'"><center><div class="question">Точно удалить?</div><br><input type="submit" name="delete_portfolio" value=" " id="supmit_yes"><input type="button" name="submit_cancel" value="" id="supmit_no" onclick="javascript: closePopup(); return false;"></center></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
}

function deleteJob(vac_id) {
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '140px';
    newdiv_p_w.innerHTML = '<form name="del_job" method="post"><input type="hidden" name="vac_id" value="'+vac_id+'"><center><div class="question">Точно удалить?</div><br><input type="submit" name="delete_job" value=" " id="supmit_yes"><input type="button" name="submit_cancel" value="" id="supmit_no" onclick="javascript: closePopup(); return false;"></center></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
}

function activeJob(vac_id, is_active) {
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '140px';
	if (is_active == 'yes') text_a = 'Скрыть';
	else text_a = 'Активировать';
    newdiv_p_w.innerHTML = '<form name="active_job" method="post"><input type="hidden" name="vac_id" value="'+vac_id+'"><input type="hidden" name="vac_is_active" value="'+is_active+'"><center><div class="question">'+text_a+'?</div><br><input type="submit" name="is_active_job" value=" " id="supmit_yes"><input type="button" name="submit_cancel" value="" id="supmit_no" onclick="javascript: closePopup(); return false;"></center></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
}

function deleteExperience(ex_id) {
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '140px';
    newdiv_p_w.innerHTML = '<form name="del_experience" method="post"><input type="hidden" name="ex_id" value="'+ex_id+'"><center><div class="question">Точно удалить?</div><br><input type="submit" name="delete_experience" value=" " id="supmit_yes"><input type="button" name="submit_cancel" value="" id="supmit_no" onclick="javascript: closePopup(); return false;"></center></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
}

function activeExperience(ex_id, is_active) {
	var parent = document.getElementsByTagName('BODY')[0];
	
	// popup_bg
	var newdiv_p_bg = document.createElement('div');
	newdiv_p_bg.id = 'popup_bg';
	newdiv_p_bg.style.left = '0';
	newdiv_p_bg.style.top = '0';
	newdiv_p_bg.innerHTML = " ";
	newdiv_p_bg.style.display = "block";
	newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
	parent.appendChild(newdiv_p_bg);
	
	// popup_window
    var newdiv_p_w = document.createElement('div');
    newdiv_p_w.id = 'popup_win';
	var left = get_ww()/2-150;
	newdiv_p_w.style.left = left+'px';
	var top = get_wh()/2-70;
	if (top>150) top = 150;
	newdiv_p_w.style.top = top+'px';
    newdiv_p_w.style.width = '300px';
    newdiv_p_w.style.height = '140px';
	if (is_active == 'yes') text_a = 'Скрыть';
	else text_a = 'Активировать';
    newdiv_p_w.innerHTML = '<form name="active_experience" method="post"><input type="hidden" name="ex_id" value="'+ex_id+'"><input type="hidden" name="ex_is_active" value="'+is_active+'"><center><div class="question">'+text_a+'?</div><br><input type="submit" name="is_active_experience" value=" " id="supmit_yes"><input type="button" name="submit_cancel" value="" id="supmit_no" onclick="javascript: closePopup(); return false;"></center></form>';
	newdiv_p_w.style.display = "block";
    parent.appendChild(newdiv_p_w);
}

function get_nextsibling(n){
	n = n.parentNode;
	if (n.nextSibling != null) x=n.nextSibling;
	else x=n.parentNode.firstChild;
	while (x.nodeType!=1) {
		if (x.nextSibling != null) x=x.nextSibling;
		else x=n.parentNode.firstChild;
	}
	return x;
}

function get_prevsibling(n){
	n = n.parentNode;
	if (n.previousSibling != null) x=n.previousSibling;
	else x=n.parentNode.lastChild;
	while (x.nodeType!=1) {
		if (x.previousSibling != null) x=x.previousSibling;
		else x=n.parentNode.lastChild;
	}
	return x;
}

function get_href(n){
	n=n.firstChild;
	while (n.nodeType!=1) n=n.nextSibling; 

	return n.getAttribute('href');
}

function bigImage(elem) {

	//alert (elem.getAttribute('href'));
	
	Img= new Image();
	Img.onload = function(){
		next = get_nextsibling(elem);
		next_id = next.getAttribute('id')
		next_href = get_href(next);
		prev = get_prevsibling(elem);
		prev_id = prev.getAttribute('id')
		prev_href = get_href(prev);
		
		var h = Img.height;
		var w = Img.width;
		if (h>0) h = h+150;
		else h = 500;
		if (w>0) w = w+100;
		else w = 500;
		
		var parent = document.getElementsByTagName('BODY')[0];
	
		// popup_bg
		var newdiv_p_bg = document.createElement('div');
		newdiv_p_bg.id = 'popup_bg';
		newdiv_p_bg.style.left = '0';
		newdiv_p_bg.style.top = '0';
		newdiv_p_bg.innerHTML = " ";
		newdiv_p_bg.style.display = "block";
		newdiv_p_bg.setAttribute('onclick', "javascript:closePopup();");
		parent.appendChild(newdiv_p_bg);
		
		// popup_window
		var newdiv_p_w = document.createElement('div');
		
		newdiv_p_w.id = 'popup_win';
		var left = get_ww()/2-(w/2);
		newdiv_p_w.style.left = left+'px';
		var top = get_wh()/2-(h/2);
		if (top>150) top = 150;
		newdiv_p_w.style.top = top+'px';
		newdiv_p_w.style.width = w+'px';
		newdiv_p_w.style.height = h+'px';
		newdiv_p_w.innerHTML = '<div id="popup_close"><a href="javascript:void(0)" onclick="javascript:closePopup();" title="Закрыть"></a></div><div class="big_image"><div class="b_prev"><a href="'+prev_href+'" onclick="return changeImage(\''+prev_id+'\');" style="height: '+Img.height+'px;"> </a></div><div class="image"><a href="'+next_href+'" onclick="return changeImage(\''+next_id+'\');"><img src="'+elem.getAttribute('href')+'" border="0"></a></div><div class="b_next"><a href="'+next_href+'" onclick="return changeImage(\''+next_id+'\');" style="height: '+Img.height+'px;"> </a></div></div><div class="image_text">'+elem.getAttribute('title')+'</div><div class="author_text"></div>';
		newdiv_p_w.style.display = "block";
		parent.appendChild(newdiv_p_w);
	}
	Img.src= elem.getAttribute('href');
	
	return false; 
}

function changeImage(id_elem) {
	elem = document.getElementById(id_elem);
	elem=elem.firstChild;
	while (elem.nodeType!=1) elem=elem.nextSibling; 
	
	Img= new Image();
	Img.onload = function(){
		next = get_nextsibling(elem);
		next_id = next.getAttribute('id')
		next_href = get_href(next);
		prev = get_prevsibling(elem);
		prev_id = prev.getAttribute('id')
		prev_href = get_href(prev);
		
		var h = Img.height;
		var w = Img.width;
		if (h>0) h = h+150;
		else h = 500;
		if (w>0) w = w+100;
		else w = 500;
		
		newdiv_p_w = document.getElementById('popup_win');
		var left = get_ww()/2-(w/2);
		newdiv_p_w.style.left = left+'px';
		var top = get_wh()/2-(h/2);
		if (top>150) top = 150;
		newdiv_p_w.style.top = top+'px';
		newdiv_p_w.style.width = w+'px';
		newdiv_p_w.style.height = h+'px';
		newdiv_p_w.innerHTML = '<div id="popup_close"><a href="javascript:void(0)" onclick="javascript:closePopup();" title="Закрыть"></a></div><div class="big_image"><div class="b_prev"><a href="'+prev_href+'" onclick="return changeImage(\''+prev_id+'\');" style="height: '+Img.height+'px;"> </a></div><div class="image"><a href="'+next_href+'" onclick="return changeImage(\''+next_id+'\');"><img src="'+elem.getAttribute('href')+'" border="0"></a></div><div class="b_next"><a href="'+next_href+'" onclick="return changeImage(\''+next_id+'\');" style="height: '+Img.height+'px;"> </a></div></div><div class="image_text">'+elem.getAttribute('title')+'</div><div class="author_text"></div>';
	}
	Img.src= elem.getAttribute('href');
	
	return false; 
}

