function right(){
	var width = document.documentElement.clientWidth;
	document.getElementById("right_box").style.width = 26 + 'px';
	if( width < 1200 && width > 1000){
  	document.getElementById("right_box").style.width = 26 + ( width - 1000)*0.2 + 'px';
	}else if( width > 1199 ) {
		document.getElementById("right_box").style.width = 66 + 'px';
	}
}

function initTiny( element, wwwroot ){
	tinyMCE.init({
		mode : "exact",
		elements : element,
		theme : "advanced",
		plugins : "advimage,advlink,media,contextmenu,table,flash,fullscreen,inlinepopups,contextmenu,directionality",
		theme_advanced_buttons1: "justifyleft,justifycenter,justifyright,justifyfull,ltr,rtl,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap,image, media",
		theme_advanced_buttons2: "styleselect,bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,separator,cleanup,removeformat,separator,code",
		theme_advanced_buttons3: "tablecontrols,fullscreen,insertimage,insertfile",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_path_location: "bottom",
		extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
		content_css: wwwroot+"/css/style_tinymce.css",
		width : "500",
		height : "400",
		language : "uk",
		paste_use_dialog : false,
		theme_advanced_resizing : true,
		theme_advanced_resize_horizontal : true,
		apply_source_formatting : true,
		force_br_newlines : true,
		force_p_newlines : false,	
		relative_urls : true,
		//file_browser_callback : "ajaxfilemanager"
		
		file_browser_callback : function (field_name, url, type, win) {
      var ajaxfilemanagerurl = wwwroot+"/js/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php";
      switch (type) {
        case "image": break;
        case "media": break;
        case "flash": break;
        case "file": break;
        default:
          return false;
      }
      tinyMCE.activeEditor.windowManager.open({
          url: ajaxfilemanagerurl,
          width: 900,
          height: 500,
          inline : "yes",
          close_previous : "no"
          },{
          window : win,
          input : field_name
      });
    }
  
	});
}

function ajaxfilemanager(field_name, url, type, win) {
	var ajaxfilemanagerurl = "../ajaxfilemanager/ajaxfilemanager.php";
	switch (type) {
		case "image": break;
		case "media": break;
		case "flash": break;
		case "file": break;
		default:
			return false;
	}
	tinyMCE.activeEditor.windowManager.open({
			url: "../ajaxfilemanager/ajaxfilemanager.php",
			width: 900,
			height: 500,
			inline : "yes",
			close_previous : "no"
			},{
			window : win,
			input : field_name
	});
}

function linkcolor( type )
{
	
	if (document.getElementById('class_type'+type).style.display == "none") {
		if( document.getElementById('class_type1') ){
			if (document.getElementById('class_type1').style.display != "none") {
				Effect.SlideUp('class_type1');
			}
		}
		if( document.getElementById('class_type2') ){
			if (document.getElementById('class_type2').style.display != "none") {
				Effect.SlideUp('class_type2');
			}
		}
		if(	document.getElementById('class_type3') ){
			if (document.getElementById('class_type3').style.display != "none") {
				Effect.SlideUp('class_type3');
			}
		}
		
		Effect.SlideDown('class_type'+type);
	}
}
