var myDomain="www.all4quotes.com";
var utrack = true;
function nexItat_show_author(authorID,categoryID,languCode,authorFullname){	
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_aj&authorID='+authorID+'&categoryID='+categoryID+'&languCode='+languCode,'fullquote');
	if(utrack)urchinTracker('/author/'+authorFullname+'/');
}
function nexItat_mail_quote(m_to,m_from,greet_content,nexitationID,categoryID,languCode,elementID){	
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_quote_card_send&m_to='+m_to+'&m_from='+m_from+'&greet_content='+greet_content+'&nexitationID='+nexitationID+'&categoryID='+categoryID+'&languCode='+languCode,elementID);
	if(utrack)urchinTracker('/Zitatekarte-Abgesendet/'+nexitationID+'/');
}

function nexItat_show_quote_pure(nexitationID,elementID,categoryID,languCode,quote_hash){
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_quote_pure&nexitationID='+nexitationID+'&categoryID='+categoryID+'&languCode='+languCode,elementID);
	if(utrack)urchinTracker('/quote/'+quote_hash+'/');
}
function nexItat_show_quote_content(nexitationID,elementID,categoryID,languCode,quote_hash){
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_quotecon&nexitationID='+nexitationID+'&categoryID='+categoryID+'&languCode='+languCode,elementID);
	if(utrack)urchinTracker('/quote/'+quote_hash+'/');
}

function nexItat_edit_quote(nexitationID,elementID,categoryID,languCode){
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_admin_edit_quote&nexitationID='+nexitationID+'&categoryID='+categoryID+'&languCode='+languCode,elementID);
}
function nexItat_add_author (fullname,copyright,details,birth_day,birth_month,birth_year,death_day,death_month,death_year,categoryID,languCode) {
//	if(fullname.length<5){alert('Bitte prufen Sie den Namen');break;}
//	if(copyright.length<1){alert('Bitte prufen Sie den Copyright-Vermerk');break;}
//	if(birth_year.length!=4){alert('Bitte prufen Sie das Geburtsjahr');break;}
	details = str_replace("\n","<br />",details);
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_admin_add_author_save&fullname='+fullname+'&copyright='+copyright+'&details='+details+'&birth_day='+birth_day+'&birth_month='+birth_month+'&birth_year='+birth_year+'&death_day='+death_day+'&death_month='+death_month+'&death_year='+death_year+'&categoryID='+categoryID+'&languCode='+languCode,'author_div');
}

function nexItat_add_quote(authorID,quote_content,categoryID,languCode){	
	quote_content = str_replace("\n","<br />",quote_content);
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_admin_add_save&authorID='+authorID+'&content='+quote_content+'&categoryID='+categoryID+'&languCode='+languCode,'nexitation_div');
}
function nexItat_update_quote(nexitationID,quote_content,elementID,categoryID,languCode){	
	quote_content = str_replace("\n","<br />",quote_content);
	ajaxpage('http://'+myDomain+'/index.php?i=nexitation_admin_edit_quote_update&nexitationID='+nexitationID+'&content='+quote_content+'&categoryID='+categoryID+'&languCode='+languCode,elementID);
}

function nexItat_quote_onoff(nexitationID,new_online,categoryID,languCode){
	var nexTmcoo_value='';
	nexTmcoo_value='http://'+myDomain+'/index.php?i=nexitation_admin_edit_quote_online&nexitationID='+ nexitationID +'&new_online='+ new_online +'&categoryID='+ categoryID +'&languCode='+languCode;
	var imageURL='';
	imageURL = document.getElementById('img_quote_onoff_'+ nexitationID).src;
	var elementID='';
	elementID = 'img_quote_onoff_'+ nexitationID +'_div';
	ajaxpage(nexTmcoo_value, elementID);	
}

function nexItat_author_onoff(authorID,new_online,categoryID,languCode){
	var nexTmcoo_value='';
	nexTmcoo_value='http://'+myDomain+'/index.php?i=nexitation_admin_edit_author_online&authorID='+ authorID +'&new_online='+ new_online +'&categoryID='+ categoryID +'&languCode='+languCode;
	var imageURL='';
	imageURL = document.getElementById('img_author_onoff_'+ authorID).src;
	var elementID='';
	elementID = 'img_author_onoff_'+ authorID +'_div';
	ajaxpage(nexTmcoo_value, elementID);	
}
function nexItat_tag_onoff(tagID,new_online,categoryID,languCode){
	var nexTmcoo_value='';
	nexTmcoo_value='http://'+myDomain+'/index.php?i=nexitation_admin_edit_tag_online&tagID='+ tagID +'&new_online='+ new_online +'&categoryID='+ categoryID +'&languCode='+languCode;
	var imageURL='';
	imageURL = document.getElementById('img_tag_onoff_'+ tagID).src;
	var elementID='';
	elementID = 'img_tag_onoff_'+ tagID +'_div';
	ajaxpage(nexTmcoo_value, elementID);
}
var authorFullname='';
var indexValues='';
function nexItat_config_if_exp(){
	var url_s='';
	exp_format = document.nexitation_configurator.exp_format;
	exp_ty = document.nexitation_configurator.exp_type;
	
	if(nexItatCheckradio(exp_format)=='rss'){
		mode = 'rss';
		if(nexItatCheckradio(exp_ty)=='rand'){
			url_s = 'http://'+myDomain+'/quote/rss/quotes/';
		}
		if(nexItatCheckradio(exp_ty)=='author'){
			url_s = 'http://'+myDomain+'/author/rss/'+ authorFullname +'/';
		}
		if(nexItatCheckradio(exp_ty)=='index'){
			indexValues = escape(indexValues);
			indexValues = str_replace("%20","+",indexValues);
			url_s = 'http://'+myDomain+'/tagged-quotes/rss/'+ indexValues +'/';
		}
		if(nexItatCheckradio(exp_ty)=='quote'){
			url_s = 'http://'+myDomain+'/quote/rss//';
		}
		
		document.nexitation_configurator.finalcode_rss.value = url_s;
	}
	if(nexItatCheckradio(exp_format)=='iframe'){
		mode = 'iframe';
		theTypeParam='';
		width_total = document.nexitation_configurator.width_total.value;
		width_inner = document.nexitation_configurator.width_inner.value;
		height_total = document.nexitation_configurator.height_total.value;
		color_bg = document.nexitation_configurator.color_bg.value;
		color_font = document.nexitation_configurator.color_font.value;
		color_border = document.nexitation_configurator.color_border.value;
		color_link = document.nexitation_configurator.color_link.value;
		font_size = document.nexitation_configurator.font_size.value;
		font_face = document.nexitation_configurator.font_face;
		font_face_val = font_face.options[font_face.selectedIndex].value;
		
		if(nexItatCheckradio(exp_ty)=='author'){
			theTypeParam='&fullname='+ authorFullname +'';
		}
		if(nexItatCheckradio(exp_ty)=='index'){
			indexValues = escape(indexValues);
			indexValues = str_replace("%20","+",indexValues);
			theTypeParam='&tagID='+ indexValues +'';
		}
		
		url_s = 'http://'+myDomain+'/?i=nexitation_exp&categoryID=1&mode='+mode+'&width_total='+width_total+'&width_inner='+width_inner+'&color_bg='+color_bg+'&color_font='+color_font+'&color_link='+color_link+'&color_border='+color_border+'&font_face='+font_face_val+'&font_size='+font_size+''+theTypeParam;
		
		if_s = '<iframe id="quotes_iframe" name="quotes_iframe" src="'+url_s+'" width="'+width_total+'" height="'+height_total+'" scrolling="no" frameborder="no"></iframe><noframes><a href="http://www.all4quotes.com/">Kostenlose Zitate f&uuml;r Ihre Homepage</a></noframes>';
		document.nexitation_configurator.finalcode_iframe.value = if_s;
		document.getElementById('preview_iframe').src = url_s;
		document.getElementById('preview_iframe').width=width_total;
		document.getElementById('preview_iframe').height=height_total;
	}
	if(nexItatCheckradio(exp_format)=='js'){
		mode = 'js';
		theTypeParam='';
		width_total = document.nexitation_configurator.width_total.value;
		width_inner = document.nexitation_configurator.width_inner.value;
		height_total = document.nexitation_configurator.height_total.value;
		color_bg = document.nexitation_configurator.color_bg.value;
		color_font = document.nexitation_configurator.color_font.value;
		color_border = document.nexitation_configurator.color_border.value;
		color_link = document.nexitation_configurator.color_link.value;
		font_size = document.nexitation_configurator.font_size.value;
		font_face = document.nexitation_configurator.font_face;
		font_face_val = font_face.options[font_face.selectedIndex].value;
		
		if(nexItatCheckradio(exp_ty)=='author'){
			theTypeParam='&fullname='+ authorFullname +'';
		}
		if(nexItatCheckradio(exp_ty)=='index'){
			indexValues = escape(indexValues);
			indexValues = str_replace("%20","+",indexValues);
			theTypeParam='&tagID='+ indexValues +'';
		}
		
		url_s = 'http://'+myDomain+'/?i=nexitation_exp&categoryID=1&mode='+mode+'&width_total='+width_total+'&width_inner='+width_inner+'&color_bg='+color_bg+'&color_font='+color_font+'&color_link='+color_link+'&color_border='+color_border+'&font_face='+font_face_val+'&font_size='+font_size+''+theTypeParam;
		
		if_s = '<script src="'+ url_s +'" type="text/javascript"></script><noscript><a href="http://www.all4quotes.com/">Kostenlose Zitate f&uuml;r Ihre Homepage</a></noscript>';
		
		document.nexitation_configurator.finalcode_js.value = if_s;
		ajaxpage(url_s + '&prev_mode=1','preview_js_inner_div');
	}
	
}
function nexItat_config_exp_ty(categoryID,languCode){
	exp_ty = document.nexitation_configurator.exp_type;
	if(nexItatCheckradio(exp_ty)=='author'){
		genericshowhide('ausgabe_typ_author','block');
		genericshowhide('ausgabe_typ_quote','none');
		genericshowhide('ausgabe_typ_index','none');
		ajaxpage('http://'+myDomain+'/index.php?i=nexitation_config_author&categoryID='+categoryID+'&languCode='+languCode, 'ausgabe_typ_author');
	} else if(nexItatCheckradio(exp_ty)=='index'){
		genericshowhide('ausgabe_typ_author','none');
		genericshowhide('ausgabe_typ_quote','none');
		genericshowhide('ausgabe_typ_index','block');
		ajaxpage('http://'+myDomain+'/index.php?i=nexitation_config_index&categoryID='+categoryID+'&languCode='+languCode, 'ausgabe_typ_index');
	} else if(nexItatCheckradio(exp_ty)=='rand'){
		genericshowhide('ausgabe_typ_author','none');
		genericshowhide('ausgabe_typ_quote','none');
		genericshowhide('ausgabe_typ_index','none');
	} else if(nexItatCheckradio(exp_ty)=='quote'){
		genericshowhide('ausgabe_typ_author','none');
		genericshowhide('ausgabe_typ_quote','block');
		genericshowhide('ausgabe_typ_index','none');
		ajaxpage('http://'+myDomain+'/index.php?i=nexitation_config_quote&categoryID='+categoryID+'&languCode='+languCode, 'ausgabe_typ_quote');
	}
}
function nexItatCheckradio(feld){
	for (i=0; i<feld.length; i++){
		if(feld[i].checked == true){
			return feld[i].value;
		}
	}
}
function nexItat_pate_preview(nID){
	var t = document.getElementById('s_linktext_'+nID).value;
	var l = document.getElementById('s_url_'+nID).value;
	var tl = document.getElementById('s_trackingurl_'+nID).value;
	var objjj = document.getElementById('pate_example_div_'+nID);
	var details = str_replace("\n","<br />",t);
	var linkPrev = '<p class="fullquote_sponsor_p"><a href="'+l+'" title="'+t+'">'+details+'</a></p>';
	objjj.innerHTML = linkPrev;
}
function nexItat_suggestor(q,event){
	setLastQ(q);
	var code;	
	if (event.keyCode) code = event.keyCode;
	if(q.length>0 && code!=40 && code!=38 && code!=13 && code!=37 && code!=39){
		fm_r = document.nexitation_find.fm;
		fm = nexItatCheckradio(fm_r)
		ajaxpage('http://'+myDomain+'/index.php?i=nexitation_find_suggestor&q='+q+'&fm='+fm, 'nexitation_suggestor_div');
		genericshowhide('nexitation_suggestor_div','block');
		suggestor_count=0;
		setTimeout("nexItat_suggestor_sel('suggestor_'+suggestor_count)",500);
	}
	if(q.length==0){
		nexItat_hide_suggestor();
	}	
}
function nexItat_hide_suggestor(){
	genericshowhide('nexitation_suggestor_div','none');
}
var suggestor_count = 0;
var suggestor_href = '';

var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function nexItat_suggestor_cud(q,event){
	if(event.keyCode == 40 || event.keyCode == 38){
		var total_suggs = 10;
		var conti = true;
		while(total_suggs>0 && conti==true){
			conti=false;
			try {
				tester = document.getElementById('suggestor_'+total_suggs).value;
			}
			catch(e) {
				total_suggs--;
				conti=true;
			}
		}
		if(!isset('suggestor_count') || suggestor_count<0 || suggestor_count>total_suggs)suggestor_count=0;
		
		obj = 'suggestor_'+suggestor_count;
		
		//Pfeil nach oben
		if(event.keyCode == 38){
			if(suggestor_count>0)suggestor_count--;
			else suggestor_count=total_suggs;
			next_tid = 'suggestor_'+suggestor_count;
			suggestor_href = document.getElementById('a_suggestor_'+suggestor_count).href;
		}
		
		//Pfeil nach unten
		if(event.keyCode == 40){
			if(suggestor_count<total_suggs)suggestor_count++;
			else suggestor_count=0;
			next_tid = 'suggestor_'+suggestor_count;
			suggestor_href = document.getElementById('a_suggestor_'+suggestor_count).href;
		}
		a_txt = document.getElementById('a_suggestor_'+suggestor_count);
		objDiv = document.getElementById('nexitation_suggestor_div');
		objDiv.scrollTop = a_txt.offsetTop;
		nexItat_suggestor_desel(obj);
		//
		nexItat_suggestor_sel(next_tid);
		what = trim(stripTags(a_txt.innerHTML));
		txt = document.getElementById('nexitation_suggestor_q');
		txt.value = what;
		setTimeout("nexItat_suggestor_mark_all()",100);
		return false;
	} else if(event.keyCode == 13){
		//13==ENTER
		if(isset('suggestor_href'))window.location = suggestor_href;
	}
	if(q.length==0){
		nexItat_hide_suggestor();
	}
}
function setLastQ(q){
	DeleteCookie('lastQ');
	SetCookie ('lastQ', q, exp);
	fm_r = document.nexitation_find.fm;
	fm = nexItatCheckradio(fm_r)
	DeleteCookie('lastQ_FM');
	SetCookie ('lastQ_FM', fm, exp);
}
function nexItat_suggestor_mo(s_id){
	var total_suggs = 10;
	var conti = true;
	while(total_suggs>0 && conti==true){
		conti=false;
		try {
			tester = document.getElementById('suggestor_'+total_suggs).value;
		}
		catch(e) {
			// bei Misserfolg Funktion beenden
			total_suggs--;
			conti=true;
		}
	}
	for(i=0;i<=total_suggs;i++){
		nexItat_suggestor_desel('suggestor_'+i);
	}
	//
	nexItat_suggestor_sel(str_replace("a_","",s_id));
	
	suggestor_count = str_replace("a_suggestor_","",s_id);
	
	suggestor_href = document.getElementById(s_id).href;
	a_txt = document.getElementById('a_suggestor_'+suggestor_count);
	what = trim(stripTags(a_txt.innerHTML));
	txt = document.getElementById('nexitation_suggestor_q');
	txt.value = what;
	setTimeout("nexItat_suggestor_mark_all()",100);
	return false;
}


function nexItat_suggestor_mark_all(){
	document.getElementById('nexitation_suggestor_q').focus();
	document.getElementById('nexitation_suggestor_q').select();
}
function nexItat_suggestor_sel(tid){
	obj = document.getElementById(tid);
	obj.className = "suggestor_sel";
}
function nexItat_suggestor_desel(tid){
	obj = document.getElementById(tid);
	obj.className="suggestor_desel";
}