/*12.02.2012*/
function ci(obj){obj.style.cssText="BORDER-BOTTOM:buttonface solid 1px;BORDER-LEFT:buttonface solid 1px;BORDER-RIGHT:buttonface solid 1px;BORDER-TOP:buttonface solid 1px;BORDER-LEFT-COLOR:#ffffff;BORDER-TOP-COLOR:#ffffff;BORDER-RIGHT-COLOR:#555555;BORDER-BOTTOM-COLOR:#555555;";}
function ri(obj){obj.style.cssText="BORDER-BOTTOM:buttonface solid 1px;BORDER-LEFT:buttonface solid 1px;BORDER-RIGHT:buttonface solid 1px;BORDER-TOP:buttonface solid 1px;disabled:true;";}
function b_mousedown(obj){obj.style.cssText="BORDER-BOTTOM:buttonface solid 1px;BORDER-LEFT:buttonface solid 1px;BORDER-RIGHT:buttonface solid 1px;BORDER-TOP:buttonface solid 1px;BORDER-LEFT-COLOR:#555555;BORDER-TOP-COLOR:#555555;BORDER-RIGHT-COLOR:#ffffff;BORDER-BOTTOM-COLOR:#ffffff;";}
function ButtAlign(el,obj1){
	makeAlignALL('viz_pole',el);

if(el=="left"){ci(document.getElementById("right_align"));ci(document.getElementById("center_align"));}else if(el=="center"){ci(document.getElementById("left_align"));ci(document.getElementById("right_align"));}else if(el=="right"){ci(document.getElementById("left_align"));ci(document.getElementById("center_align"));}
b_mousedown(obj1);return;}
function ButtAlignLine(alg,elem_name,obj1){
	//Ширина визитки
	var obj_all_width=document.getElementById("kapsula_border").style.width;
	var obj=document.getElementById(elem_name);
	
	if(alg=='center'){
		//Центральное выравнивание
			f_length=SizeBlockPx(obj.id,obj.innerHTML);
			center_align_left=parseInt((parseInt(obj_all_width)-parseInt(f_length))/2);
			obj.style.left=center_align_left+'px';
	} else if(alg=='right'){
		//Правое выравнивание
			f_length=SizeBlockPx(obj.id,obj.innerHTML);
			right_align_left=parseInt(obj_all_width)-parseInt(f_length);
			obj.style.left=right_align_left+'px';
	} else if(alg=='left'){
		//Левое выравнивание
			f_length=SizeBlockPx(obj.id,obj.innerHTML);
			left_align_left=0;
			obj.style.left=left_align_left+'px';
	
	} else { }
//obj.style.left=0;
obj.style.textAlign=alg;

if(alg=="left"){ci(document.getElementById("right_align_line"));ci(document.getElementById("center_align_line"));}else if(alg=="center"){ci(document.getElementById("left_align_line"));ci(document.getElementById("right_align_line"));}else if(alg=="right"){ci(document.getElementById("left_align_line"));ci(document.getElementById("center_align_line"));}
b_mousedown(obj1);
;return;}
function ButtPressLine(el,obj1){
	var obj=document.getElementById(el);
	if(obj.style.visibility=="visible"){obj.style.visibility="hidden";ci(obj1);}else{
	obj.style.visibility="visible";
	//hor
	if(el=='out_hr1'){obj.style.width="500px";obj.style.height="2px";}
	//vert
	if(el=='out_vr1'){obj.style.width="2px";obj.style.height="250px";}
	
	b_mousedown(obj1);}
return;}
function ButtUnderImage(el){var obj=document.getElementById("pic_layer");if(obj.style.zIndex=="0"){LayerZindex("nad");ci(el);}else{LayerZindex("pod");b_mousedown(el);}
return;}
function ButtUnderImage2(el){var obj=document.getElementById("pic_layer2");if(obj.style.zIndex=="0"){LayerZindex2("nad");ci(el);}else{LayerZindex2("pod");b_mousedown(el);}
return;}
function ButtLoadImage(el){var obj=document.getElementById("logo1");if(!obj){document.getElementById("uploadDialog").style.display = "block";b_mousedown(el);}else{nologo1();ci(el);}
return;}
function ButtLoadDesign(el){var obj=document.getElementById("new_pic");if(obj.value==''){openphoto('designs/index_designs.php',500,800,'yes');b_mousedown(el);}else{nodesign();ci(el);}
return;}
function butt_des_w(){var el=document.getElementById("butt_des");ci(el);return;}
function ButtVizColor(el){var obj=document.getElementById("colorDivPalitra");if(obj.style.visibility=="visible"){ci(el);}else{b_mousedown(el);palitraFon("fon_design","backgroundColor");ci(el);}
return;}
function ButtImageResize(el,obj1){
SL_UnSelect();
var intervalID;if(el=='big'){obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval("makeBig_Image()",50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
else{obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval("makeSmall_Image()",50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
return;}
function ButtImageResize2(el,obj1){
SL_UnSelect();
var intervalID;if(el=='big'){obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval("makeBig_Image2()",50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
else{obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval("makeSmall_Image2()",50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
return;}
function ButtBold(el,obj1){var obj=document.getElementById(el);var now_level=obj.style.fontWeight;if((now_level=="bold")||(now_level=="700")){

ci(obj1);obj.style.fontWeight="normal";
	//Ширина до изменения
	var old_block_width=parseInt(obj.style.width);
	
	//правильный размер
	SetBlockRealSize(el);
	
	//Ширина после изменения
	var new_block_width=parseInt(obj.style.width);
	//--[start]
	var lag=old_block_width-new_block_width;
	//right align
	if(obj.style.textAlign=='right'){var raznica=parseInt(obj.style.left)+lag; obj.style.left=raznica+'px';}
	else if(obj.style.textAlign=='center'){var raznica=parseInt(obj.style.left)+parseInt(lag/2); obj.style.left=raznica+'px';}
	else{}
	//--[end]


}else{b_mousedown(obj1);obj.style.fontWeight="bold";

	//Ширина до изменения
	var old_block_width=parseInt(obj.style.width);
	
	//правильный размер
	SetBlockRealSize(el);
	
	//Ширина после изменения
	var new_block_width=parseInt(obj.style.width);
	//--[start]
	var lag=old_block_width-new_block_width;
	//right align
	if(obj.style.textAlign=='right'){var raznica=parseInt(obj.style.left)+lag; obj.style.left=raznica+'px';}
	else if(obj.style.textAlign=='center'){var raznica=parseInt(obj.style.left)+parseInt(lag/2); obj.style.left=raznica+'px';}
	else{}
	//--[end]

}


return;}
function ButtItalic(el,obj1){
	var obj=document.getElementById(el);
	var now_level=obj.style.fontStyle;
	if(now_level=="italic"){
	ci(obj1);obj.style.fontStyle="normal";
		//Ширина до изменения
	var old_block_width=parseInt(obj.style.width);
	
	//правильный размер
	SetBlockRealSize(el);
	
	//Ширина после изменения
	var new_block_width=parseInt(obj.style.width);
	//--[start]
	var lag=old_block_width-new_block_width;
	//right align
	if(obj.style.textAlign=='right'){var raznica=parseInt(obj.style.left)+lag; obj.style.left=raznica+'px';}
	else if(obj.style.textAlign=='center'){var raznica=parseInt(obj.style.left)+parseInt(lag/2); obj.style.left=raznica+'px';}
	else{}
	//--[end]
	}else{b_mousedown(obj1);obj.style.fontStyle="italic";
		//Ширина до изменения
	var old_block_width=parseInt(obj.style.width);
	
	//правильный размер
	SetBlockRealSize(el);
	
	//Ширина после изменения
	var new_block_width=parseInt(obj.style.width);
	//--[start]
	var lag=old_block_width-new_block_width;
	//right align
	if(obj.style.textAlign=='right'){var raznica=parseInt(obj.style.left)+lag; obj.style.left=raznica+'px';}
	else if(obj.style.textAlign=='center'){var raznica=parseInt(obj.style.left)+parseInt(lag/2); obj.style.left=raznica+'px';}
	else{}
	//--[end]
	
	}
return;}
function ButtUnderline(el,obj1){var obj=document.getElementById(el);var now_level=obj.style.textDecoration;if(now_level=="underline"){ci(obj1);obj.style.textDecoration="none";}else{b_mousedown(obj1);obj.style.textDecoration="underline";}
return;}
function ButtTextColor(el,obj1){var obj=document.getElementById(el);b_mousedown(obj1);palitraFon(el,"color");ci(obj1);return;}
function ButtTextResize(el,obj1){var intervalID;if(el=='big'){obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval("makeBig()",50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
else{obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval("makeSmall()",50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
return;}
function ButtTextColorAll(el,obj1){var obj=document.getElementById(el);b_mousedown(obj1);palitraFon(el,"backgroundColor");ci(obj1);return;}
function ButtTextResizeAll(el,obj1){var intervalID;if(el=='big'){obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval('makeBigALL("viz_pole")',50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
else{obj1.onmousedown=function(){b_mousedown(this);intervalID=setInterval('makeSmallALL("viz_pole")',50);};obj1.onmouseup=function(){ci(this);clearInterval(intervalID);};}
return;}
function openPdfDialog(){var obj=document.getElementById("pdfDialog");if(obj.style.display=="none"){obj.style.display="block";}else{obj.style.display="none";}
return;}
function ButtGrid(el,obj1){
	var obj=document.getElementById(el);
	var grid_filename="url("+'"'+"img/grid.gif"+'"'+")";
    if(obj.style.backgroundImage!=""){
		obj.style.backgroundImage="";
		/*
		obj=getElementsByClass('viz_pole',null,'div');for(i=0;i<obj.length;i++){obj[i].style.border="0px";}
		*/
		ci(obj1);
	} else {
		obj.style.backgroundImage=grid_filename;
		// dashed;border-color:#E6E6E6;
		/*	
		obj=getElementsByClass('viz_pole',null,'div');
		for(i=0;i<obj.length;i++){
			if(obj[i].style.innerHTML!=""){obj[i].style.border="1px dashed #F50527";}else{obj[i].style.border="0px";}
		}
		*/
		b_mousedown(obj1);
	}
return;}
function ButtZoomImage(param){
	var obj=document.getElementById("logo1");
	var obj_b=document.getElementById("fon_design");
	if(param=='out'){
		var obj_k=$("kapsula");
		obj.style.cssText='width:"";height:""';
		
		var new_width=parseInt(obj_b.style.width)
		var new_height=parseInt(obj_b.style.height);
		obj.width=new_width;
		obj.height=new_height;
		nodesign();
		
		//pic_layer
		var obj_div=document.getElementById("pic_layer");
		obj_div.style.left="-17px";
		obj_div.style.top="-17px";
		obj_div.style.width=new_width+'px';
		obj_div.style.height=new_height+'px';

		obj_b.style.backgroundColor='rgb(255,255,255)';
		ci(document.getElementById("butt_des"));
	 }
	 else {
		document.getElementById("img_cache").src=obj.src;
		document.getElementById("pic_layer").innerHTML='';
	 	document.getElementById("logo_filename1").value=document.getElementById("img_cache").src;
		setnewlogo1();
		document.getElementById("img_cache").src="img/10x10.gif";
	}

return;
}
// Vertical Distribution [start]
function ButtVertDistrib(obj1){

 	b_mousedown(obj1);
	ci(obj1);
	$("vc_info_line").innerHTML=$F("sel_vert_distribution_info");
	var elem_arr = new Array();
	elem_arr =Vert_Distrib_BaseBlocks();
	var high_elem=elem_arr["high_elem"];
	var low_elem=elem_arr["low_elem"];
	if((high_elem=='')||(low_elem=='')){return;}
	Vert_Distrib_field_calc(high_elem,low_elem);
 		
return;
}
// Vertical Distribution [end]
// Selected Horisontal Align Left-Center-Right [start]
function ButtSelectHorAlign(alg,obj1){

 	b_mousedown(obj1);
	ci(obj1);
	$("vc_info_line").innerHTML=$F("sel_vert_distribution_info");
	Hor_ALIGN(alg);
		
return;
}
// Selected Horisontal Align Left-Center-Right[end]
 
// Horisontal Distribution [start]
function ButtHorDistrib(obj1){

 	b_mousedown(obj1);
	ci(obj1);
	$("vc_info_line").innerHTML=$F("sel_vert_distribution_info");
	var elem_arr = new Array();
	elem_arr =Hor_Distrib_BaseBlocks();
	var right_elem=elem_arr["right_elem"];
	var left_elem=elem_arr["left_elem"];
	if((left_elem=='')||(right_elem=='')){return;}
	Hor_Distrib_field_calc(right_elem,left_elem);
 		
return;
}
// Horisontal Distribution [end]
// Selected Vertical Align Left-Center-Right [start]
function ButtSelectVertAlign(alg,obj1){

 	b_mousedown(obj1);
	ci(obj1);
	$("vc_info_line").innerHTML=$F("sel_vert_distribution_info");
	Vert_ALIGN(alg);
		
return;
}
// Selected  Vertical Align Left-Center-Right[end]

