// JavaScript Document

function changeText(alias,tn,table_id){
	if(tn!=undefined) {tn="&tn="+tn;}
	else {tn="";}
	
	if(table_id!=undefined) {table_id="&table_id="+table_id;}
	else {table_id="";}
	window.open('/php.admin/change.data.php?alias='+alias+tn+table_id,'CMS1', 'left=120,top=50,width=740,height=670,toolbar=0,resizable=1,scrollbars=1');
}

function changeSelects(id,alias){
	if(alias!=undefined) {alias="&alias="+alias;}
	else {alias="";}
	window.open('/php.admin/change.selects.php?id='+id+alias,'CMS_selectes', 'left=120,top=50,width=540,height=270,toolbar=0,resizable=1,scrollbars=1');
}

function changeTree(id,parent){
	if(parent!=undefined) {parent="&parent="+parent;}
	else {parent="";}
	window.open('/php.admin/change.tree.php?id='+id+parent,'treeCMS', 'left=120,top=50,width=600,height=450,toolbar=0,resizable=1,scrollbars=1');
}


function izdrukat(id, detail){
	if(detail!=undefined) {detail="&detail="+detail;}
	else {detail="";}
	window.open('/php.templates/headers/printpage.php?id='+id+detail,'print', 'left=120,top=50,width=720,height=650,toolbar=0,resizable=1,scrollbars=1');
}



function changeNews(id,parent){
	if(parent!=undefined) {parent="&parent="+parent;}
	else {parent="";}
	window.open('/php.admin/news.admin.php?id='+id+parent,'newsCMS', 'left=120,top=50,width=750,height=690,toolbar=0,resizable=1,scrollbars=1');
}

function changeGalleries(id,ptable,pid,tips){
	if(ptable!=undefined) {ptable="&ptable="+ptable;} else {ptable="";}
	if(pid!=undefined) {pid="&pid="+pid;} else {pid="";}
	if(tips!=undefined) {tips="&tips="+tips;} else {tips="";}	
	window.open('/php.admin/galleries.admin.php?id='+id+ptable+pid+tips,'galleriesCMS1', 'left=120,top=50,width=450,height=390,toolbar=0,resizable=1,scrollbars=1');
}

function changeBanners(id,pid,tips){
	if(pid!=undefined) {pid="&pid="+pid;} else {pid="";}
	if(tips!=undefined) {tips="&tips="+tips;} else {tips="";}	
	window.open('/php.admin/banners.admin.php?id='+id+pid+tips,'bannersCMS1', 'left=120,top=50,width=620,height=420,toolbar=0,resizable=1,scrollbars=1');
}

function changeBannersNew(id,pid,tips, pos){
	if(pid!=undefined) {pid="&pid="+pid;} else {pid="";}
	if(tips!=undefined) {tips="&position="+tips;} else {tips="";}	
	window.open('/php.admin/new.banners.admin.php?id='+id+pid+tips,'bannersCMS1', 'left=120,top=50,width=720,height=720,toolbar=0,resizable=1,scrollbars=1');
}


function changeAptauja(id,pid,tips){
	if(pid!=undefined) {pid="&pid="+pid;} else {pid="";}
	if(tips!=undefined) {tips="&tips="+tips;} else {tips="";}	
	window.open('/php.admin/aptaujas.admin.php?id='+id+pid+tips,'aptaujasCMS1', 'left=120,top=50,width=620,height=220,toolbar=0,resizable=1,scrollbars=1');
}

function changeProperties(id,pid){
	if(pid!=undefined) {pid="&pid="+pid;} else {pid="";}
	window.open('/php.admin/properties.admin.php?id='+id+pid,'propsCMS1', 'left=120,top=50,width=620,height=430,toolbar=0,resizable=1,scrollbars=1');
}

function changeBanners_center(id,pid) {
	if(pid!=undefined) {pid="&pid="+pid;} else {pid="";}
	window.open('/php.admin/banners_center.admin.php?id='+id+pid,'banners2CMS1', 'left=120,top=50,width=640,height=600,toolbar=0,resizable=1,scrollbars=1');
}

function changePartner(id){
	window.open('/php.admin/partners.admin.php?id='+id,'newsCMS2', 'left=120,top=50,width=750,height=690,toolbar=0,resizable=1,scrollbars=1');
}


function getAdminControls(active) {
	var out = new Array();

	out[out.length+1] = "<a href='javascript:changeText(\"tree"+active.Id+"\",\"cms_tree\");'>•</a>";	

	if(active.Active==0) { out[out.length+1] = "<a href='"+changeUrl( "", "show_tree",active.Id)+"'>[s]</a>"; }
	if(active.Active==1) { out[out.length+1] = "<a href='"+changeUrl( "", "hide_tree",active.Id)+"'>[h]</a>"; }

	out[out.length+1] = "<a onClick='return confirm('Sure?');' href='"+changeUrl( "", "del_tree", active.Id )+"'>(x)</a>";


	out[out.length+1] = "<a href='"+changeUrl( "", "tree_up", active.Id )+"'>↑</a>";

	out[out.length+1] = "<a href='"+changeUrl( "", "tree_down", active.Id )+"'>↓</a>";

	out[out.length+1] = "<a href='"+changeUrl( "", "new_tree", active.Id )+"'>[+]</a>";
	return out.join(" ");
}
