var SiteC = {

	SiteCpopup		: '',
	SiteCAdminPopup	: '',
	
	openWindow: function(url, parameters, admin) {
		if(admin) {
			SiteCAdminPopup = window.open(url, 'SiteCAdminPopup', parameters);
			SiteCAdminPopup.focus();
		} else {
			SiteCpopup = window.open(url, 'SiteCpopup', parameters);
			SiteCpopup.focus();
		}
	},
	
 	setSefValue: function(field, value, trim) {
		var char;
		var rex;
		var specialChars = {
			a 	: 'àáâãäå',
			ae	: 'æ',
			c	: 'ç',
			d	: 'Ð',
			e	: 'èéêë',
			i	: 'ìíîï',
			n	: 'ñ',
			o	: 'òóôõöø',
			ss	: 'ß',
			u	: 'ùúûü',
			x	: '×', 
			y	: 'ýÿ'
		};
		
		//lower case
		value = value.toLowerCase();
		
		//strips all leading and trailing whitespace
		if((typeof trim == 'undefined') || (trim == true)) {
			value = value.strip();
		};
		
		//convert all whitespaces to - char
		value = value.replace(/\s/g, '-');
		
		//convert all dots to - char
		value = value.replace('.', '-');
		
		//convert utf8 chars to normal chars
		for(char in specialChars) {		
			rex = new RegExp('['+specialChars[char]+']', 'g');
			value = value.replace(rex, char);
		};
		
		//only keep letters,numbers,slashes,minus and underscore
		value = value.replace(/[^a-z0-9/\-_]/g, '');
		
		//remove any multiple minus chars
		while(value.indexOf('--') != -1) {
			value = value.replace('--', '-');
		};
		
		//remove any multiple slash chars
		while(value.indexOf('//') != -1) {
			value = value.replace('//', '/');
		};
		
		$(field).value = value;	
	},

	setSectionTitles: function() {
		if($F('section_title') != '' && $F('section_title_menu') == '' && $F('section_title_browser') == '' && $F('section_title_sef') == '') {
			$('section_title_menu').value = $F('section_title');
			$('section_title_browser').value = $F('section_title');
			this.setSefValue($('section_title_sef'), $F('section_title'), true);
		};
	}
};

//module compatibility
setSefValue = SiteC.setSefValue;

function cms_cancelEventBubbling(evt) {
	//this fuctions cancels the event you put in it
	//example: if you have buttonlink in a tr-link you have to block the tr-link
	//window.event.cancelBubble doesnt work in firefox
	//call function exactly like this: cms_cancelEventBubbling(event);
	
	Event.stop(evt);
}
