var isRefreshable=false;
var anyErrors = false;

function refresh(){
	document.getElementById("refreshButton").click();
}

function refreshParent() {
		if(!anyErrors && window.opener.isRefreshable) {
			window.opener.location.reload();
			document.getElementById("itemAdded").style.display='';
			if(document.getElementById("content")) {document.getElementById("content").style.display='none';}
			if(document.getElementById("announceCreateForm")) {document.getElementById("announceCreateForm").style.display='none';}
			window.close();
			}
	}

function handleRefreshForParentWindow(){
			window.opener.isRefreshable = true;
	}

function openProductWindow(type,id){
	if(type == 'pu') {
		window.open('/productCreate.dlg?pid='+id+'&t=u','productUpdateWindow','width=685,height=470,scrollbars=no,left=150,top=100,screenX=150,screenY=100');
		}
	if(type == 'pc'){
		window.open('/productCreate.dlg?cid='+id+'&t=c','productCreateWindow','width=685,height=420,scrollbars=no,left=300,top=200,screenX=300,screenY=200');
		}
}

function openAnnProductList(id,type) {
	window.open('/productList.dlg?oid='+id+'&ot='+type,'productListWindow','width=680,height=470,scrollbars=yes,left=300,top=150,screenX=300,screenY=150');	
}

function openAnnouncementWindow(aid,atype){
	window.open('/announcementCreate.dlg?annId='+aid+'&t=u&atype='+atype,'announcementUpdateWindow','width=750,height=550,left=150,top=50,screenX=150,screenY=50');
}		

function openSponsorWindow(type,id){
	if(type == 'update') {
		window.open('/sponsorCreate.dlg?spId='+id, 'sponsorUpdateWindow', 'width=685,height=470,scrollbars=no,left=150,top=100,screenX=150,screenY=100');
		}
	if(type == 'create'){
		window.open('/sponsorCreate.dlg?spId='+id, 'sponsorCreateWindow', 'width=685,height=420,scrollbars=no,left=150,top=100,screenX=150,screenY=100');
		}
}

function openRelatedPeopleWindow() {
	window.open('/relatedPeople.dlg', 'relatedPeopleWindow', 'width=800,height=500,scrollbars=no,left=150,top=100,screenX=150,screenY=100');
}

	
	
	
	