// CMS-Functions
function cms_popup(article_id, column_id, pos_left, pos_top, popupname)
{
	var windowprops = "location=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=500,height=500,pageXOffset="+pos_left+",pageYOffset"+pos_top;
	window.open(userIndex + url_separator + "site=show_popup" + url_separator + "popup=" + article_id + url_separator + "col_id="+column_id,popupname,windowprops);
}

function dynamic_block_win(dynamic_block_id)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=640,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=dynamic_block_edit" + url_separator + "dynamic_block_id="+dynamic_block_id,"dynamic_block_edit",windowprops);
}

// Event-Functions
function dayeventwin(day, month, year)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=640,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=dayevents" + url_separator + "day=" + day + url_separator + "month="+month + url_separator + "year="+year,"PartydatesofDay",windowprops);
}

function locationwin(loc_id)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=640,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=location_pres" + url_separator + "loc_id="+loc_id,"Location",windowprops);
}
function eventwin(event_id)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=640,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=event"+ url_separator + "event_id="+event_id,"Partydate",windowprops);
}

function event_remotesend_win(event_id)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=640,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=send_remote_event" + url_separator + "event_id="+event_id,"Partydate",windowprops);
}


function mediawin(parent_media_id, hidden_parent_media_id, parent_media_type, is_popup, radio_filter)
{
	var openlink = userIndex + url_separator + "site=mediaexplorer";
	if(is_popup == true) openlink += url_separator + "asPopup=1";
	openlink +=  url_separator + "parent_media_id="+parent_media_id+ url_separator + "hidden_parent_media_id=" + hidden_parent_media_id + url_separator + "parent_media_type=" + parent_media_type + url_separator + "radio_filter=" + radio_filter;
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=640,height=600,left=20";
	window.open(openlink,"Mediamanager",windowprops);
}

function pix_selector(	parent_media_id,
						hidden_parent_media_id, 
						hidden_option_name, 
						hidden_metric_name, 
						hidden_link_opt, 
						hidden_link_string, 
						parent_media_struct, 
						hidden_link_target, 
						parent_media_type)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=800,height=600,left=20"; 
	window.open(userIndex + url_separator +"site=pix_selector"+
		url_separator + "parent_media_id="+parent_media_id+
		url_separator + "hidden_parent_media_id="+hidden_parent_media_id+
		url_separator + "hidden_option_name="+hidden_option_name+
		url_separator + "hidden_metric_name="+hidden_metric_name+
		url_separator + "hidden_link_opt="+hidden_link_opt+
		url_separator + "hidden_link_string="+hidden_link_string+
		url_separator + "hidden_link_target="+hidden_link_target+
		url_separator + "parent_media_struct="+parent_media_struct+
		url_separator + "parent_media_type="+parent_media_type+
		url_separator + "asPopup=1",
		"pix_selector",windowprops);
}
function delete_pic(parent_media_id, hidden_parent_media_id, hidden_option_name, hidden_metric_name, hidden_link_opt, hidden_link_string, hidden_link_target)
{
	document.getElementById(parent_media_id).src = './images/CMS_pic_deleted.gif';
	document.getElementById(hidden_parent_media_id).value = '';
	document.getElementById(hidden_option_name).value = '';
	document.getElementById(hidden_metric_name).value = '';
	document.getElementById(hidden_link_opt).value = '';
	document.getElementById(hidden_link_string).value = '';
	document.getElementById(hidden_link_target).value = '';
}

// Scripte bei Artikel-neu-erstellen
function checked_item_start()
{
	if(document.template_form.time_start_status.checked == true)
	{
		document.getElementById("time_start_select").style.display = 'block';
		document.getElementById("time_start_inactive").style.display = 'none';
	}
	else
	{
		document.getElementById("time_start_select").style.display = 'none';
		document.getElementById("time_start_inactive").style.display = 'block';
	}
}

function checked_item_end()
{
	if(document.template_form.time_end_status.checked == true)
	{
		document.getElementById("time_end_select").style.display = 'block';
		document.getElementById("time_end_inactive").style.display = 'none';
	}
	else
	{
		document.getElementById("time_end_select").style.display = 'none';
		document.getElementById("time_end_inactive").style.display = 'block';
	}
}

function show_previewBlock(alert_warning)
{
	if(document.getElementById("use_previewBlock").style.display == 'none') {
		document.getElementById("use_previewBlock").style.display = 'block';
		document.getElementById("use_previewOption").style.display = 'block';		
	} else {
		document.getElementById("use_previewOption").style.display = 'none';
		document.getElementById("use_previewBlock").style.display = 'none';
		alert(alert_warning);
	}
}

function selectTemplate(col_id)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=600,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=edit_article_props" + url_separator + "action=add" + url_separator + "col_id=" + col_id,"selecttemplate",windowprops);
}

function EditArticle(ArticleID, col_id, detail)
{
	var windowsprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizeable=1,width=800,height=600,left=20";
	var windowslink	 = userIndex + url_separator + "site=edit_article"+url_separator +"art_id=" + ArticleID + url_separator +"col_id=" + col_id;
	if (detail == true)
	{
		windowslink += url_separator + "view=detail";
	}
	window.open(windowslink,"editarticle",windowsprops);
}

function EditArticleProps(ArticleID, col_id)
{
	var windowsprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizeable=1,width=600,height=600,left=20";
	var windowslink	 = userIndex + url_separator + "site=edit_article_props"+url_separator +"action=edit"+url_separator + "art_id=" + ArticleID + url_separator +"col_id=" + col_id;
	window.open(windowslink,"editarticlestatus",windowsprops);
}


function sortArticle(col_id)
{
	var windowprops = "location=0,status=0,scrollbars=1,menubar=0,toolbar=0,resizable=1,width=600,height=600,left=20"; 
	window.open(userIndex + url_separator + "site=article_order" + url_separator +"col_id=" + col_id,"sorttemplate",windowprops);
}

function show_hide_properties(ArtikelID, HyperLink, LangTextShow, LangTextHide)
{
	
	if(document.getElementById(ArtikelID).style.display == 'none') 
	{
		document.getElementById(ArtikelID).style.display = 'block';
		document.getElementById(HyperLink).firstChild.nodeValue = LangTextShow;	
	}
	else
	{
		document.getElementById(ArtikelID).style.display = 'none';
		document.getElementById(HyperLink).firstChild.nodeValue = LangTextHide;	
	}
}
