
//<!-- Begin
var initialsubj	= "Hallo, hier eine interessante Seite bei SUCH SUCH";
var initialmsg	= "Schau Dir mal diese Seite an: "+window.location;
var good;

function get_article_liveid() {
	var id 		= 0;
	try {
		var url 		= window.location.href;
		var temp_array 	= url.split('/');
		var temp_array2 = temp_array[temp_array.length-1].split('.');
		id 		= temp_array2[0];
	}
	catch(e) {
	//	alert( e.toString() );
	}
	return id;
}

var article_liveid  = get_article_liveid();

function checkEmailAddress(field) {
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	if (goodEmail) {
		good = true;
	}
	else {
		alert('Bitte eine Email Adresse eingeben');
		field.focus();
		field.select();
		good = false;
   }
}
u = window.location;
function mailThisUrl() {
	good = false;
	checkEmailAddress(document.eMailer.email);
	if (good) {
		//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
		window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg;
   }
}
//  End -->

//ecards
//<!-- Textgroesse anfang -->
var faktor = 0.15; 			
var start_groesse = 0.75; 		
var anz = 0; 					

function openNewWindow2(url, name, x, y) {
	window.open(url, name, "height="+x+", width="+y+", toolbar=no, scrollbars=no");
}
//<!-- VideoPlayer ende -->

/** allgemeine Funktionen */
/** Bildergalerie start */ 
function trim_text(text, strlimit, wordlimit) { 
	if(text.length > strlimit) {
		textA		= text.split(" ");
		text_short	= "";
		for(w=0; w<wordlimit; w++) {
			text_short 	+= textA[w] + " "; 
		}
		text_short 	+= " ...";
	}
	else text_short = text;
	return text_short;
}

function change_div(div_id, content) {
	if(document.getElementById && document.getElementById(div_id)) {
		document.getElementById(div_id).innerHTML = content;
	} else if(document.all && document.all[div_id]) {
		document.all[div_id].innerHTML = content;
	}
}

function in_array(value, array_name) {
	found = false;
	for(n=0; n<array_name.length; n++) {
		if(array_name[n] == value) {
			found = true;
			break;
		}
	}
	return found;
}

function change_class(divname, class_name) {
	try {
		if(document.getElementById(divname)) {
			document.getElementById(divname).className = class_name;
		}
	}
	catch(e) {
	//	show_error(e + ": " + divname);
	}
}

function dummy() {
	//return;
}
/** Bildergalerie end */ 


/** MC - POPUP Start **/
function open_mc(url) {
	// NEU: Neuen Fensternamen für jedes MC!
	var omc_wname = Math.floor(Math.random()*1000000000000);
	var default_window_height = 790;
	var default_window_width = 840;
	var default_scrollbars = "no";
	
	var screen_height = screen.height;
	if (isNaN(screen_height)) {
		screen_height = 768;		
	}
	var max_window_height = Math.floor(screen_height-50);
	
	if ((url.indexOf("tennis") > 0) || (url.indexOf("radsport") > 0)) {
		var window_height = 735;
		var window_width = default_window_width;
	} else {
		if ((url.indexOf("fussball") > 0) && (url.indexOf("em-qualifikation") > 0)) {
			// Bundesliga: Wallpaper: Größeres Fenster
			var window_height = 790;
			var window_width = 1000;
		} else {
			// Default
			var window_height = 790;
			var window_width = default_window_width;
	}
	}
	if (window_height > max_window_height) {
		window_height = max_window_height;
		default_scrollbars = "yes";
		window_width = Math.floor(window_width+20);
	}
	window.open(url, omc_wname, "width=" +(window_width)+ ",height=" +(window_height)+ ",top=50,left=50,scrollbars=" +(default_scrollbars)+ ",resizable=no");
}
/** MC - POPUP End**/

function border_scroll() {
	var scroll_y = 0;
	if(document.all) {
		scroll_y = document.body.scrollTop;
	} else {
		scroll_y = window.pageYOffset;
	}
	return scroll_y;
}
function object_place(object, pos_x, pos_y) {
	if(document.all) {
		window.document.all[object].style.left	= pos_x;
		window.document.all[object].style.top	= pos_y;
	} else {
		window.document.getElementById(object).style.left	= pos_x;
		window.document.getElementById(object).style.top	= pos_y;
	}
}

function add_comment(art_liveid) {
	//dummy
}
