
//<!-- Begin
var initialsubj	= "Hallo, hier eine interessante Seite bei Sportal.ch";
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
function open_ecard(id) {
	//http://www.sportal.de
	ecardsWindow = window.open("/sportal/service/ecards/ecard.php?" + id, "ECards", "width=660, height=640, top=50,left=50,scrollbars=no,resizable=no");
}
	
//<!-- Tell a friend -->
function win_tellafriend1() {    
	var url=window.location;
	//http://www.sportal.de
	tellafriendWindow=window.open("/scripts/tellafriend/tellafriend.php?url="+url, "win_tellafriend","height=400,width=450,left=350,top=155,scrollbars=no,resizable=no");    
}    



/** MC - POPUP Start **/
function popup(url) {
	// NEU: Neuen Fensternamen für jedes MC!
	var omc_wname = Math.floor(Math.random()*1000000000000);
	var default_window_height = 450;
	var default_window_width = 600;
	var default_scrollbars = "no";
	
	var screen_height = screen.height;
	if (isNaN(screen_height)) {
		screen_height = 700;		
	}
	var max_window_height = Math.floor(screen_height-50);
		
	// Default
	var window_height = 450;
	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**/
//-->


//<!-- Textgroesse anfang -->
var faktor = 0.15; 			
var start_groesse = 0.75; 		
var anz = 0; 					
function fontsizer(inc, reset) {
	if ((anz + inc >= 0) && (anz + inc <= 2)) {
		anz += inc;
		neue_groesse = anz * faktor + start_groesse;
		artikel_text = document.getElementById('content_artikel');
		artikel_text.style.fontSize = neue_groesse + "em";
	}
	switch (anz) {
		case 0:
			document.getElementById("fsminus").src = "/sportch/images/icons/schrift_minus_inaktiv.gif";
			break;
		case 2:
			document.getElementById("fsplus").src = "/sportch/images/icons/schrift_plus_inaktiv.gif";
			break;
		default:	
			document.getElementById("fsplus").src = "/sportch/images/icons/schrift_plus.gif";
			document.getElementById("fsminus").src = "/sportch/images/icons/schrift_minus.gif";
			break;					
	}
}
//<!-- Textgroesse ende -->

//<!-- Kontaktformular anfang -->
function open_kontakt() {
	kontaktWindow = window.open("/de/sportch/service/kontakt/kontakt.php?", "poppage", "width=440,height=590,top=155,left=350,scrollbars=no,resizable=no");
}
//<!-- Kontaktformular ende -->

//<!-- Kontaktformular anfang -->
function open_kontakt_sc() {
	kontaktWindow = window.open("/de/spenglercup/service/kontakt/kontakt.php?", "poppage", "width=460,height=590,top=155,left=350,scrollbars=yes,resizable=no");
}
//<!-- Kontaktformular ende -->

//<!-- Kontaktformular english anfang -->
function open_kontakt_sc_en() {
	kontaktWindow = window.open("/de/spenglercup/service/kontakt/kontakt_en.php?", "poppage_en", "width=460,height=590,top=155,left=350,scrollbars=yes,resizable=no");
}
//<!-- Kontaktformular english ende -->

function openNewWindow2(url, name, x, y) {
	window.open(url, name, "height="+x+", width="+y+", toolbar=no, scrollbars=no");
}

/** i.P. 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_width   = 840;
	var default_window_height  = 790;
    var default_scrollbars     = "no";
	var window_width           = default_window_width;
	var window_height          = default_window_height;
    	
	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) {
		window_height = 735;
		window_width = default_window_width;
	} 
    else if(url.indexOf("fussball") > 0 && url.indexOf("bundesliga") > 0) {
		// Bundesliga: Wallpaper: Größeres Fenster
		window_height = 810;
		window_width = 980;
	} 
    else if(url.indexOf("eishockey") > 0) {
        if(url.indexOf("nla") > 0) {
            // Eishockey NLA: Größeres Fenster
            window_height = 830;
            window_width = 1000;
		}
		else if(url.indexOf("spengler-cup") != -1) {
        // Eishockey Spengler Cup: Wallpaper
            window_height = 820;
            window_width = 1000;
        }
	} 
    
	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**/