var sys={
	generatePass:function() 
	{
		var r
		var digit = new Array("0","1","2","3","4","5","6","7","8","9")
		var halp = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","Y","Z")
		var lalp = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y","z")
		pasw = new String()
		pasw = ""
	
		for (var i= 0; i<8; i++)
		{
			r = Math.random()
			if ( (r - 1.0/3.0) < 0.0)
			{
				r = Math.floor(Math.random() * 9);
				pasw += digit[r];
			}
			else if ( (r - 2.0/3.0) < 0.0)
			{
				r = Math.floor(Math.random() * 24);
				pasw += halp[r];
			}
			else
			{
				r = Math.floor(Math.random() * 24);
				pasw += lalp[r];
			}
		}
		return pasw;
	},
	
	stripTags:function(text)
	{
		return text.replace(/<\/?[^>]+>/gi, '');
	},
	
	getSelection:function(){
	
		if (window.getSelection)
			result = window.getSelection();
		else if (document.getSelection)
			result = document.getSelection();
		else if (document.selection)
			result = document.selection.createRange().text;
		return result.toString();
	},
	
	centerObj:function(obj){
		obj.css('position','absolute');
		obj.css('left',$(window).width()/2-obj.width()/2);
		obj.css('z-index',101);
		obj.css('top',$(window).scrollTop()+$(window).height()/2-obj.height()/2);
		$(window).scroll(
			function(){
				obj.css('top',$(window).scrollTop()+$(window).height()/2-obj.height()/2);
			}
		)
	},
	
	getMCE:function(mode){
		if(_sys.frontendSkin)
			var cssUrl=_sys.rootUrl+'mods/main/fnd/default/html/skins/'+_sys.frontendSkin+'/content.css';
		else
			var cssUrl=_sys.rootUrl+'mods/main/fnd/default/html/content.css';
		result={
			script_url : _sys.rootUrl+'3pary/tinyMCE/tiny_mce.js',
			relative_urls : false,
		  	remove_script_host : true,
			mode : "none",
			file_browser_callback : "tinyBrowser",
			theme : "advanced",
			language : _sys.lang.code,
			gecko_spellcheck : true,
			body_class : 'xContent',
			content_css : cssUrl,
			plugins : "table,advimage, paste,advlink,searchreplace,contextmenu,paste,-externalplugin, fullscreen, insertdatetime, media, style, visualchars, emotions",
			dialog_type : "modal",
			fullscreen_settings : {
				theme_advanced_path_location : "top"
			},
			plugin_insertdate_dateFormat : _sys.dateFormat,
			plugin_insertdate_timeFormat : _sys.timeFormat,
			
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_resizing : true,
			theme_advanced_resize_horizontal : false,
			theme_advanced_statusbar_location:"bottom",
			theme_advanced_buttons1 : "bold, italic, underline, strikethrough, sub, sup, |,"+
			"justifyleft, justifycenter, justifyright, justifyfull, |,"+
			"forecolor, backcolor, |,"+
			"bullist, numlist, outdent, indent, |,"+
			"cut,copy,paste,pastetext,pasteword,selectall,undo,redo,|,"+
			"search,replace,|,",
			theme_advanced_buttons2 :  "fontselect, fontsizeselect, styleselect, |, "+
			"link, unlink, anchor, image,media, emotions, hr, charmap, blockquote,  |,",
			theme_advanced_buttons3 :  "fullscreen,code, cleanup, removeformat,styleprops, visualaid, |, tablecontrols "
		}	
		
		if(mode=='simple')
		{
			result.plugins="emotions, inlinepopups, media";
			result.fullscreen_settings={
				theme_advanced_path_location : "top"
			};
			result.theme_advanced_resizing=false;
			result.theme_advanced_resize_horizontal=false;
			result.theme_advanced_statusbar_location="bottom";
			result.theme_advanced_buttons1 = "bold, italic, underline, strikethrough, sub, sup, |,"+
			"justifyleft, justifycenter, justifyright, justifyfull, |,"+
			"bullist, numlist, outdent, indent, |, link, unlink, image, emotions";
			result.theme_advanced_buttons2=false,
			result.theme_advanced_buttons3=false
		}
		
		if(mode=='bnd')
		{
			
		}
		return result;
	}
}

